From d88e8dcc728c6a536270c0ce06aed2ef45b78c6b Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 17 Dec 2022 05:03:57 +0000 Subject: [PATCH] [lld] llvm::Optional::value => operator*/operator-> std::optional::value() has undesired exception checking semantics and is unavailable in some older Xcode. The call sites block std::optional migration. --- lld/wasm/SyntheticSections.cpp | 4 ++-- lld/wasm/Writer.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lld/wasm/SyntheticSections.cpp b/lld/wasm/SyntheticSections.cpp index 9411aa4233aaf..bf32754e29914 100644 --- a/lld/wasm/SyntheticSections.cpp +++ b/lld/wasm/SyntheticSections.cpp @@ -236,8 +236,8 @@ void ImportSection::writeBody() { if (config->memoryImport) { WasmImport import; - import.Module = config->memoryImport.value().first; - import.Field = config->memoryImport.value().second; + import.Module = config->memoryImport->first; + import.Field = config->memoryImport->second; import.Kind = WASM_EXTERNAL_MEMORY; import.Memory.Flags = 0; import.Memory.Minimum = out.memorySec->numMemoryPages; diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp index 6906da0ab693e..5a0026b62b983 100644 --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -475,7 +475,7 @@ void Writer::populateTargetFeatures() { } if (config->extraFeatures.has_value()) { - auto &extraFeatures = config->extraFeatures.value(); + auto &extraFeatures = *config->extraFeatures; allowed.insert(extraFeatures.begin(), extraFeatures.end()); } @@ -483,7 +483,7 @@ void Writer::populateTargetFeatures() { bool inferFeatures = !config->features.has_value(); if (!inferFeatures) { - auto &explicitFeatures = config->features.value(); + auto &explicitFeatures = *config->features; allowed.insert(explicitFeatures.begin(), explicitFeatures.end()); if (!config->checkFeatures) goto done;