diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-04-14 21:41:27 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-06-22 18:20:56 +0000 |
commit | bdd1243df58e60e85101c09001d9812a789b6bc4 (patch) | |
tree | a1ce621c7301dd47ba2ddc3b8eaa63b441389481 /contrib/llvm-project/llvm/lib/Support/OptimizedStructLayout.cpp | |
parent | 781624ca2d054430052c828ba8d2c2eaf2d733e7 (diff) | |
parent | e3b557809604d036af6e00c60f012c2025b59a5e (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Support/OptimizedStructLayout.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Support/OptimizedStructLayout.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/contrib/llvm-project/llvm/lib/Support/OptimizedStructLayout.cpp b/contrib/llvm-project/llvm/lib/Support/OptimizedStructLayout.cpp index 19a93ed6776d..7b21f927a346 100644 --- a/contrib/llvm-project/llvm/lib/Support/OptimizedStructLayout.cpp +++ b/contrib/llvm-project/llvm/lib/Support/OptimizedStructLayout.cpp @@ -11,6 +11,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/OptimizedStructLayout.h" +#include <optional> using namespace llvm; @@ -345,9 +346,8 @@ llvm::performOptimizedStructLayout(MutableArrayRef<Field> Fields) { // Helper function to try to find a field in the given queue that'll // fit starting at StartOffset but before EndOffset (if present). // Note that this never fails if EndOffset is not provided. - auto tryAddFillerFromQueue = [&](AlignmentQueue *Queue, - uint64_t StartOffset, - Optional<uint64_t> EndOffset) -> bool { + auto tryAddFillerFromQueue = [&](AlignmentQueue *Queue, uint64_t StartOffset, + std::optional<uint64_t> EndOffset) -> bool { assert(Queue->Head); assert(StartOffset == alignTo(LastEnd, Queue->Alignment)); assert(!EndOffset || StartOffset < *EndOffset); @@ -356,7 +356,8 @@ llvm::performOptimizedStructLayout(MutableArrayRef<Field> Fields) { // queue if there's nothing in it that small. auto MaxViableSize = (EndOffset ? *EndOffset - StartOffset : ~(uint64_t)0); - if (Queue->MinSize > MaxViableSize) return false; + if (Queue->MinSize > MaxViableSize) + return false; // Find the matching field. Note that this should always find // something because of the MinSize check above. @@ -372,7 +373,7 @@ llvm::performOptimizedStructLayout(MutableArrayRef<Field> Fields) { // Helper function to find the "best" flexible-offset field according // to the criteria described above. - auto tryAddBestField = [&](Optional<uint64_t> BeforeOffset) -> bool { + auto tryAddBestField = [&](std::optional<uint64_t> BeforeOffset) -> bool { assert(!BeforeOffset || LastEnd < *BeforeOffset); auto QueueB = FlexibleFieldsByAlignment.begin(); auto QueueE = FlexibleFieldsByAlignment.end(); @@ -436,7 +437,7 @@ llvm::performOptimizedStructLayout(MutableArrayRef<Field> Fields) { // Phase 2: repeatedly add the best flexible-offset field until // they're all gone. while (!FlexibleFieldsByAlignment.empty()) { - bool Success = tryAddBestField(None); + bool Success = tryAddBestField(std::nullopt); assert(Success && "didn't find a field with no fixed limit?"); (void) Success; } |