From e3b557809604d036af6e00c60f012c2025b59a5e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 11 Feb 2023 13:38:04 +0100 Subject: Vendor import of llvm-project main llvmorg-16-init-18548-gb0daacf58f41, the last commit before the upstream release/17.x branch was created. --- llvm/lib/Support/OptimizedStructLayout.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Support/OptimizedStructLayout.cpp') diff --git a/llvm/lib/Support/OptimizedStructLayout.cpp b/llvm/lib/Support/OptimizedStructLayout.cpp index 19a93ed6776d..7b21f927a346 100644 --- a/llvm/lib/Support/OptimizedStructLayout.cpp +++ b/llvm/lib/Support/OptimizedStructLayout.cpp @@ -11,6 +11,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/OptimizedStructLayout.h" +#include using namespace llvm; @@ -345,9 +346,8 @@ llvm::performOptimizedStructLayout(MutableArrayRef 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 EndOffset) -> bool { + auto tryAddFillerFromQueue = [&](AlignmentQueue *Queue, uint64_t StartOffset, + std::optional EndOffset) -> bool { assert(Queue->Head); assert(StartOffset == alignTo(LastEnd, Queue->Alignment)); assert(!EndOffset || StartOffset < *EndOffset); @@ -356,7 +356,8 @@ llvm::performOptimizedStructLayout(MutableArrayRef 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 Fields) { // Helper function to find the "best" flexible-offset field according // to the criteria described above. - auto tryAddBestField = [&](Optional BeforeOffset) -> bool { + auto tryAddBestField = [&](std::optional BeforeOffset) -> bool { assert(!BeforeOffset || LastEnd < *BeforeOffset); auto QueueB = FlexibleFieldsByAlignment.begin(); auto QueueE = FlexibleFieldsByAlignment.end(); @@ -436,7 +437,7 @@ llvm::performOptimizedStructLayout(MutableArrayRef 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; } -- cgit v1.2.3