From 320d4fb58b6b1c6a0c7ffeab3d4672d1479d5e17 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 14 Apr 2023 23:41:27 +0200 Subject: Merge llvm-project main llvmorg-16-init-18548-gb0daacf58f41 This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-16-init-18548-gb0daacf58f41. PR: 271047 MFC after: 1 month (cherry picked from commit bdd1243df58e60e85101c09001d9812a789b6bc4) --- .../llvm-project/llvm/lib/Support/OptimizedStructLayout.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'contrib/llvm-project/llvm/lib/Support/OptimizedStructLayout.cpp') 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 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