diff options
author | Kazu Hirata <kazu@google.com> | 2022-12-20 15:42:32 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-12-20 15:42:32 -0800 |
commit | 77c90c8ce0fe763b6ee2809a6dc437d6f18e1af2 (patch) | |
tree | 15a121e20136c30cacf9258d23b34d61c46a79bd | |
parent | 0b401ba71325c06a61f948c801685de021455b13 (diff) | |
download | llvm-77c90c8ce0fe763b6ee2809a6dc437d6f18e1af2.zip llvm-77c90c8ce0fe763b6ee2809a6dc437d6f18e1af2.tar.gz llvm-77c90c8ce0fe763b6ee2809a6dc437d6f18e1af2.tar.bz2 |
[llvm] Use std::optional instead of Optional
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
35 files changed, 108 insertions, 113 deletions
diff --git a/llvm/include/llvm/ADT/BreadthFirstIterator.h b/llvm/include/llvm/ADT/BreadthFirstIterator.h index cfeb7a7..41f3d8e 100644 --- a/llvm/include/llvm/ADT/BreadthFirstIterator.h +++ b/llvm/include/llvm/ADT/BreadthFirstIterator.h @@ -57,11 +57,11 @@ private: using ChildItTy = typename GT::ChildIteratorType; // First element is the node reference, second is the next child to visit. - using QueueElement = std::pair<NodeRef, Optional<ChildItTy>>; + using QueueElement = std::pair<NodeRef, std::optional<ChildItTy>>; // Visit queue - used to maintain BFS ordering. - // Optional<> because we need markers for levels. - std::queue<Optional<QueueElement>> VisitQueue; + // std::optional<> because we need markers for levels. + std::queue<std::optional<QueueElement>> VisitQueue; // Current level. unsigned Level = 0; @@ -78,10 +78,10 @@ private: inline bf_iterator() = default; inline void toNext() { - Optional<QueueElement> Head = VisitQueue.front(); + std::optional<QueueElement> Head = VisitQueue.front(); QueueElement H = *Head; NodeRef Node = H.first; - Optional<ChildItTy> &ChildIt = H.second; + std::optional<ChildItTy> &ChildIt = H.second; if (!ChildIt) ChildIt.emplace(GT::child_begin(Node)); diff --git a/llvm/include/llvm/ADT/DepthFirstIterator.h b/llvm/include/llvm/ADT/DepthFirstIterator.h index 04223d5f..4105a95 100644 --- a/llvm/include/llvm/ADT/DepthFirstIterator.h +++ b/llvm/include/llvm/ADT/DepthFirstIterator.h @@ -97,7 +97,7 @@ private: // First element is node reference, second is the 'next child' to visit. // The second child is initialized lazily to pick up graph changes during the // DFS. - using StackElement = std::pair<NodeRef, Optional<ChildItTy>>; + using StackElement = std::pair<NodeRef, std::optional<ChildItTy>>; // VisitStack - Used to maintain the ordering. Top = current block std::vector<StackElement> VisitStack; @@ -123,7 +123,7 @@ private: inline void toNext() { do { NodeRef Node = VisitStack.back().first; - Optional<ChildItTy> &Opt = VisitStack.back().second; + std::optional<ChildItTy> &Opt = VisitStack.back().second; if (!Opt) Opt.emplace(GT::child_begin(Node)); diff --git a/llvm/include/llvm/ADT/None.h b/llvm/include/llvm/ADT/None.h index d55bd46..c497821 100644 --- a/llvm/include/llvm/ADT/None.h +++ b/llvm/include/llvm/ADT/None.h @@ -20,7 +20,7 @@ #include <optional> namespace llvm { -/// A simple null object to allow implicit construction of Optional<T> +/// A simple null object to allow implicit construction of std::optional<T> /// and similar types without having to spell out the specialization's name. LLVM_DEPRECATED("Use std::nullopt_t instead", "std::nullopt_t") typedef std::nullopt_t NoneType; diff --git a/llvm/include/llvm/BinaryFormat/Wasm.h b/llvm/include/llvm/BinaryFormat/Wasm.h index eebd2aa..d185516 100644 --- a/llvm/include/llvm/BinaryFormat/Wasm.h +++ b/llvm/include/llvm/BinaryFormat/Wasm.h @@ -206,11 +206,11 @@ struct WasmSymbolInfo { uint8_t Kind; uint32_t Flags; // For undefined symbols the module of the import - Optional<StringRef> ImportModule; + std::optional<StringRef> ImportModule; // For undefined symbols the name of the import - Optional<StringRef> ImportName; + std::optional<StringRef> ImportName; // For symbols to be exported from the final module - Optional<StringRef> ExportName; + std::optional<StringRef> ExportName; union { // For function, table, or global symbols, the index in function, table, or // global index space. diff --git a/llvm/include/llvm/DWP/DWP.h b/llvm/include/llvm/DWP/DWP.h index f60f8cc..ff26140 100644 --- a/llvm/include/llvm/DWP/DWP.h +++ b/llvm/include/llvm/DWP/DWP.h @@ -44,7 +44,7 @@ struct InfoSectionUnitHeader { // dwo_id field. This resides in the header only if Version >= 5. // In earlier versions, it is read from DW_AT_GNU_dwo_id. - Optional<uint64_t> Signature = std::nullopt; + std::optional<uint64_t> Signature = std::nullopt; // Derived from the length of Length field. dwarf::DwarfFormat Format = dwarf::DwarfFormat::DWARF32; diff --git a/llvm/include/llvm/Debuginfod/Debuginfod.h b/llvm/include/llvm/Debuginfod/Debuginfod.h index df7fd9f..cd9cc3b 100644 --- a/llvm/include/llvm/Debuginfod/Debuginfod.h +++ b/llvm/include/llvm/Debuginfod/Debuginfod.h @@ -106,8 +106,8 @@ class DebuginfodCollection { sys::RWMutex DebugBinariesMutex; StringMap<std::string> DebugBinaries; Error findBinaries(StringRef Path); - Expected<Optional<std::string>> getDebugBinaryPath(object::BuildIDRef); - Expected<Optional<std::string>> getBinaryPath(object::BuildIDRef); + Expected<std::optional<std::string>> getDebugBinaryPath(object::BuildIDRef); + Expected<std::optional<std::string>> getBinaryPath(object::BuildIDRef); // If the collection has not been updated since MinInterval, call update() and // return true. Otherwise return false. If update returns an error, return the // error. diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h index 70fe88c..2c1abe9 100644 --- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h +++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h @@ -94,7 +94,7 @@ public: std::optional<bool> HasRequiresUnifiedSharedMemory; // Flag for specifying if offloading is mandatory. - Optional<bool> OpenMPOffloadMandatory; + std::optional<bool> OpenMPOffloadMandatory; /// First separator used between the initial two parts of a name. std::optional<StringRef> FirstSeparator; diff --git a/llvm/include/llvm/FuzzMutate/IRMutator.h b/llvm/include/llvm/FuzzMutate/IRMutator.h index 9a1f7f0..d0708c7 100644 --- a/llvm/include/llvm/FuzzMutate/IRMutator.h +++ b/llvm/include/llvm/FuzzMutate/IRMutator.h @@ -77,8 +77,8 @@ public: class InjectorIRStrategy : public IRMutationStrategy { std::vector<fuzzerop::OpDescriptor> Operations; - Optional<fuzzerop::OpDescriptor> chooseOperation(Value *Src, - RandomIRBuilder &IB); + std::optional<fuzzerop::OpDescriptor> chooseOperation(Value *Src, + RandomIRBuilder &IB); public: InjectorIRStrategy(std::vector<fuzzerop::OpDescriptor> &&Operations) diff --git a/llvm/include/llvm/LineEditor/LineEditor.h b/llvm/include/llvm/LineEditor/LineEditor.h index 9f4ea5b..e8c7763 100644 --- a/llvm/include/llvm/LineEditor/LineEditor.h +++ b/llvm/include/llvm/LineEditor/LineEditor.h @@ -36,8 +36,8 @@ public: /// Reads a line. /// - /// \return The line, or llvm::Optional<std::string>() on EOF. - llvm::Optional<std::string> readLine() const; + /// \return The line, or std::optional<std::string>() on EOF. + std::optional<std::string> readLine() const; void saveHistory(); void loadHistory(); diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h index 1305c9b..8a984db 100644 --- a/llvm/include/llvm/Support/Error.h +++ b/llvm/include/llvm/Support/Error.h @@ -1051,7 +1051,7 @@ inline void consumeError(Error Err) { /// Uses of this method are potentially indicative of problems: perhaps the /// error should be propagated further, or the error-producer should just /// return an Optional in the first place. -template <typename T> Optional<T> expectedToOptional(Expected<T> &&E) { +template <typename T> std::optional<T> expectedToOptional(Expected<T> &&E) { if (E) return std::move(*E); consumeError(E.takeError()); diff --git a/llvm/include/llvm/XRay/InstrumentationMap.h b/llvm/include/llvm/XRay/InstrumentationMap.h index c95d406..211f328 100644 --- a/llvm/include/llvm/XRay/InstrumentationMap.h +++ b/llvm/include/llvm/XRay/InstrumentationMap.h @@ -90,10 +90,10 @@ public: const FunctionAddressMap &getFunctionAddresses() { return FunctionAddresses; } /// Returns an XRay computed function id, provided a function address. - Optional<int32_t> getFunctionId(uint64_t Addr) const; + std::optional<int32_t> getFunctionId(uint64_t Addr) const; /// Returns the function address for a function id. - Optional<uint64_t> getFunctionAddr(int32_t FuncId) const; + std::optional<uint64_t> getFunctionAddr(int32_t FuncId) const; /// Provide read-only access to the entries of the instrumentation map. const SledContainer &sleds() const { return Sleds; }; diff --git a/llvm/lib/CodeGen/BasicBlockSections.cpp b/llvm/lib/CodeGen/BasicBlockSections.cpp index 776ab634..67db95b 100644 --- a/llvm/lib/CodeGen/BasicBlockSections.cpp +++ b/llvm/lib/CodeGen/BasicBlockSections.cpp @@ -167,7 +167,7 @@ static void updateBranches( bool getBBClusterInfoForFunction( const MachineFunction &MF, BasicBlockSectionsProfileReader *BBSectionsProfileReader, - std::vector<Optional<BBClusterInfo>> &V) { + std::vector<std::optional<BBClusterInfo>> &V) { // Find the assoicated cluster information. std::pair<bool, SmallVector<BBClusterInfo, 4>> P = @@ -201,9 +201,9 @@ bool getBBClusterInfoForFunction( // and "Cold" succeeding all other clusters. // FuncBBClusterInfo represent the cluster information for basic blocks. If this // is empty, it means unique sections for all basic blocks in the function. -static void -assignSections(MachineFunction &MF, - const std::vector<Optional<BBClusterInfo>> &FuncBBClusterInfo) { +static void assignSections( + MachineFunction &MF, + const std::vector<std::optional<BBClusterInfo>> &FuncBBClusterInfo) { assert(MF.hasBBSections() && "BB Sections is not set for function."); // This variable stores the section ID of the cluster containing eh_pads (if // all eh_pads are one cluster). If more than one cluster contain eh_pads, we @@ -331,7 +331,7 @@ bool BasicBlockSections::runOnMachineFunction(MachineFunction &MF) { BBSectionsProfileReader = &getAnalysis<BasicBlockSectionsProfileReader>(); - std::vector<Optional<BBClusterInfo>> FuncBBClusterInfo; + std::vector<std::optional<BBClusterInfo>> FuncBBClusterInfo; if (BBSectionsType == BasicBlockSection::List && !getBBClusterInfoForFunction(MF, BBSectionsProfileReader, FuncBBClusterInfo)) diff --git a/llvm/lib/CodeGen/RegAllocGreedy.h b/llvm/lib/CodeGen/RegAllocGreedy.h index 188cc56..e0ac88c 100644 --- a/llvm/lib/CodeGen/RegAllocGreedy.h +++ b/llvm/lib/CodeGen/RegAllocGreedy.h @@ -185,7 +185,7 @@ private: std::unique_ptr<Spiller> SpillerInstance; PQueue Queue; std::unique_ptr<VirtRegAuxInfo> VRAI; - Optional<ExtraRegInfo> ExtraInfo; + std::optional<ExtraRegInfo> ExtraInfo; std::unique_ptr<RegAllocEvictionAdvisor> EvictAdvisor; std::unique_ptr<RegAllocPriorityAdvisor> PriorityAdvisor; diff --git a/llvm/lib/Debuginfod/Debuginfod.cpp b/llvm/lib/Debuginfod/Debuginfod.cpp index 17d034d..026f118 100644 --- a/llvm/lib/Debuginfod/Debuginfod.cpp +++ b/llvm/lib/Debuginfod/Debuginfod.cpp @@ -425,7 +425,7 @@ Error DebuginfodCollection::findBinaries(StringRef Path) { return Error::success(); } -Expected<Optional<std::string>> +Expected<std::optional<std::string>> DebuginfodCollection::getBinaryPath(BuildIDRef ID) { Log.push("getting binary path of ID " + buildIDToString(ID)); std::shared_lock<sys::RWMutex> Guard(BinariesMutex); @@ -437,7 +437,7 @@ DebuginfodCollection::getBinaryPath(BuildIDRef ID) { return std::nullopt; } -Expected<Optional<std::string>> +Expected<std::optional<std::string>> DebuginfodCollection::getDebugBinaryPath(BuildIDRef ID) { Log.push("getting debug binary path of ID " + buildIDToString(ID)); std::shared_lock<sys::RWMutex> Guard(DebugBinariesMutex); @@ -452,10 +452,10 @@ DebuginfodCollection::getDebugBinaryPath(BuildIDRef ID) { Expected<std::string> DebuginfodCollection::findBinaryPath(BuildIDRef ID) { { // Check collection; perform on-demand update if stale. - Expected<Optional<std::string>> PathOrErr = getBinaryPath(ID); + Expected<std::optional<std::string>> PathOrErr = getBinaryPath(ID); if (!PathOrErr) return PathOrErr.takeError(); - Optional<std::string> Path = *PathOrErr; + std::optional<std::string> Path = *PathOrErr; if (!Path) { Expected<bool> UpdatedOrErr = updateIfStale(); if (!UpdatedOrErr) @@ -483,10 +483,10 @@ Expected<std::string> DebuginfodCollection::findBinaryPath(BuildIDRef ID) { Expected<std::string> DebuginfodCollection::findDebugBinaryPath(BuildIDRef ID) { // Check collection; perform on-demand update if stale. - Expected<Optional<std::string>> PathOrErr = getDebugBinaryPath(ID); + Expected<std::optional<std::string>> PathOrErr = getDebugBinaryPath(ID); if (!PathOrErr) return PathOrErr.takeError(); - Optional<std::string> Path = *PathOrErr; + std::optional<std::string> Path = *PathOrErr; if (!Path) { Expected<bool> UpdatedOrErr = updateIfStale(); if (!UpdatedOrErr) diff --git a/llvm/lib/Frontend/OpenMP/OMPContext.cpp b/llvm/lib/Frontend/OpenMP/OMPContext.cpp index 9217f8f..50ca01d 100644 --- a/llvm/lib/Frontend/OpenMP/OMPContext.cpp +++ b/llvm/lib/Frontend/OpenMP/OMPContext.cpp @@ -163,7 +163,7 @@ static int isVariantApplicableInContextHelper( // context based on the match kind selected by the user via // `implementation={extensions(match_[all,any,none])}' auto HandleTrait = [MK](TraitProperty Property, - bool WasFound) -> Optional<bool> /* Result */ { + bool WasFound) -> std::optional<bool> /* Result */ { // For kind "any" a single match is enough but we ignore non-matched // properties. if (MK == MK_ANY) { @@ -212,7 +212,7 @@ static int isVariantApplicableInContextHelper( return Ctx.matchesISATrait(RawString); }); - if (Optional<bool> Result = HandleTrait(Property, IsActiveTrait)) + if (std::optional<bool> Result = HandleTrait(Property, IsActiveTrait)) return *Result; } @@ -232,7 +232,7 @@ static int isVariantApplicableInContextHelper( if (ConstructMatches) ConstructMatches->push_back(ConstructIdx - 1); - if (Optional<bool> Result = HandleTrait(Property, FoundInOrder)) + if (std::optional<bool> Result = HandleTrait(Property, FoundInOrder)) return *Result; if (!FoundInOrder) { diff --git a/llvm/lib/FuzzMutate/IRMutator.cpp b/llvm/lib/FuzzMutate/IRMutator.cpp index a588bc8..fa43422 100644 --- a/llvm/lib/FuzzMutate/IRMutator.cpp +++ b/llvm/lib/FuzzMutate/IRMutator.cpp @@ -102,7 +102,7 @@ std::vector<fuzzerop::OpDescriptor> InjectorIRStrategy::getDefaultOps() { return Ops; } -Optional<fuzzerop::OpDescriptor> +std::optional<fuzzerop::OpDescriptor> InjectorIRStrategy::chooseOperation(Value *Src, RandomIRBuilder &IB) { auto OpMatchesPred = [&Src](fuzzerop::OpDescriptor &Op) { return Op.SourcePreds[0].matches({}, Src); diff --git a/llvm/lib/LineEditor/LineEditor.cpp b/llvm/lib/LineEditor/LineEditor.cpp index 32a58f0..bb40841 100644 --- a/llvm/lib/LineEditor/LineEditor.cpp +++ b/llvm/lib/LineEditor/LineEditor.cpp @@ -248,7 +248,7 @@ void LineEditor::loadHistory() { } } -Optional<std::string> LineEditor::readLine() const { +std::optional<std::string> LineEditor::readLine() const { // Call el_gets to prompt the user and read the user's input. int LineLen = 0; const char *Line = ::el_gets(Data->EL, &LineLen); @@ -292,7 +292,7 @@ LineEditor::~LineEditor() { void LineEditor::saveHistory() {} void LineEditor::loadHistory() {} -Optional<std::string> LineEditor::readLine() const { +std::optional<std::string> LineEditor::readLine() const { ::fprintf(Data->Out, "%s", Prompt.c_str()); std::string Line; diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp index fb6ce47..efb5faa8 100644 --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -1638,7 +1638,7 @@ class llvm::vfs::RedirectingFileSystemParser { return std::nullopt; } - Optional<RedirectingFileSystem::RootRelativeKind> + std::optional<RedirectingFileSystem::RootRelativeKind> parseRootRelativeKind(yaml::Node *N) { SmallString<12> Storage; StringRef Value; diff --git a/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp b/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp index d96aa2a..c8ef0d1 100644 --- a/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp +++ b/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp @@ -94,7 +94,7 @@ MachineTypes getDefaultMachine() { return getMachine(Triple(sys::getDefaultTargetTriple())); } -Optional<std::string> getPrefix(StringRef Argv0) { +std::optional<std::string> getPrefix(StringRef Argv0) { StringRef ProgName = llvm::sys::path::stem(Argv0); // x86_64-w64-mingw32-dlltool -> x86_64-w64-mingw32 // llvm-dlltool -> None @@ -149,7 +149,7 @@ int llvm::dlltoolDriverMain(llvm::ArrayRef<const char *> ArgsArr) { } COFF::MachineTypes Machine = getDefaultMachine(); - if (Optional<std::string> Prefix = getPrefix(ArgsArr[0])) { + if (std::optional<std::string> Prefix = getPrefix(ArgsArr[0])) { Triple T(*Prefix); if (T.getArch() != Triple::UnknownArch) Machine = getMachine(T); diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp index 58a565d..c038875 100644 --- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp @@ -388,7 +388,7 @@ private: bool DetectUseAfterScope; bool UsePageAliases; - llvm::Optional<uint8_t> MatchAllTag; + std::optional<uint8_t> MatchAllTag; unsigned PointerTagShift; uint64_t TagMaskByte; diff --git a/llvm/lib/XRay/InstrumentationMap.cpp b/llvm/lib/XRay/InstrumentationMap.cpp index ce15a1d..ee190d9e 100644 --- a/llvm/lib/XRay/InstrumentationMap.cpp +++ b/llvm/lib/XRay/InstrumentationMap.cpp @@ -33,14 +33,15 @@ using namespace llvm; using namespace xray; -Optional<int32_t> InstrumentationMap::getFunctionId(uint64_t Addr) const { +std::optional<int32_t> InstrumentationMap::getFunctionId(uint64_t Addr) const { auto I = FunctionIds.find(Addr); if (I != FunctionIds.end()) return I->second; return std::nullopt; } -Optional<uint64_t> InstrumentationMap::getFunctionAddr(int32_t FuncId) const { +std::optional<uint64_t> +InstrumentationMap::getFunctionAddr(int32_t FuncId) const { auto I = FunctionAddresses.find(FuncId); if (I != FunctionAddresses.end()) return I->second; diff --git a/llvm/unittests/ADT/STLForwardCompatTest.cpp b/llvm/unittests/ADT/STLForwardCompatTest.cpp index a024012..e9cd88c 100644 --- a/llvm/unittests/ADT/STLForwardCompatTest.cpp +++ b/llvm/unittests/ADT/STLForwardCompatTest.cpp @@ -82,13 +82,15 @@ TEST(TransformTest, MoveTransformStd) { } TEST(TransformTest, TransformLlvm) { - llvm::Optional<int> A; + std::optional<int> A; - llvm::Optional<int> B = llvm::transformOptional(A, [&](int N) { return N + 1; }); + std::optional<int> B = + llvm::transformOptional(A, [&](int N) { return N + 1; }); EXPECT_FALSE(B.has_value()); A = 3; - llvm::Optional<int> C = llvm::transformOptional(A, [&](int N) { return N + 1; }); + std::optional<int> C = + llvm::transformOptional(A, [&](int N) { return N + 1; }); EXPECT_TRUE(C.has_value()); EXPECT_EQ(4, *C); } @@ -96,10 +98,10 @@ TEST(TransformTest, TransformLlvm) { TEST(TransformTest, MoveTransformLlvm) { using llvm::MoveOnly; - llvm::Optional<MoveOnly> A; + std::optional<MoveOnly> A; MoveOnly::ResetCounts(); - llvm::Optional<int> B = llvm::transformOptional( + std::optional<int> B = llvm::transformOptional( std::move(A), [&](const MoveOnly &M) { return M.val + 2; }); EXPECT_FALSE(B.has_value()); EXPECT_EQ(0u, MoveOnly::MoveConstructions); @@ -108,7 +110,7 @@ TEST(TransformTest, MoveTransformLlvm) { A = MoveOnly(5); MoveOnly::ResetCounts(); - llvm::Optional<int> C = llvm::transformOptional( + std::optional<int> C = llvm::transformOptional( std::move(A), [&](const MoveOnly &M) { return M.val + 2; }); EXPECT_TRUE(C.has_value()); EXPECT_EQ(7, *C); diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp index d061381..ebfba7c 100644 --- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp @@ -128,7 +128,7 @@ TEST(DWARFDebugFrame, DumpEH64FDE) { } static Error parseCFI(dwarf::CIE &C, ArrayRef<uint8_t> Instructions, - Optional<uint64_t> Size = std::nullopt) { + std::optional<uint64_t> Size = std::nullopt) { DWARFDataExtractor Data(Instructions, /*IsLittleEndian=*/true, /*AddressSize=*/8); uint64_t Offset = 0; diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp index d14b303..2129915 100644 --- a/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp @@ -147,8 +147,8 @@ SmallString<0> DWARFExpressionCopyBytesTest::emitObjFile(StringRef ExprBytes) { void DWARFExpressionCopyBytesTest::parseCFIsAndCheckExpression( const llvm::object::ObjectFile &E, ArrayRef<uint8_t> Expected) { - auto FetchFirstCfaExpression = - [](const DWARFDebugFrame &EHFrame) -> Optional<CFIProgram::Instruction> { + auto FetchFirstCfaExpression = [](const DWARFDebugFrame &EHFrame) + -> std::optional<CFIProgram::Instruction> { for (const dwarf::FrameEntry &Entry : EHFrame.entries()) { const auto *CurFDE = dyn_cast<dwarf::FDE>(&Entry); if (!CurFDE) diff --git a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.h b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.h index e55dc07..4d97059b 100644 --- a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.h +++ b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.h @@ -220,7 +220,7 @@ private: // Calculate the number of bytes the Contents will take up. size_t getContentsSize() const; - llvm::Optional<DWARFDebugLine::Prologue> Prologue; + std::optional<DWARFDebugLine::Prologue> Prologue; std::vector<ValueAndLength> CustomPrologue; std::vector<ValueAndLength> Contents; diff --git a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp index 3cd0504..d094bd3 100644 --- a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp @@ -99,7 +99,7 @@ TEST_F(CoreAPIsStandardTest, MaterializationSideEffctsOnlyBasic) { // results. std::unique_ptr<MaterializationResponsibility> FooR; - Optional<SymbolMap> Result; + std::optional<SymbolMap> Result; cantFail(JD.define(std::make_unique<SimpleMaterializationUnit>( SymbolFlagsMap( diff --git a/llvm/unittests/IR/CFGBuilder.cpp b/llvm/unittests/IR/CFGBuilder.cpp index fb05a9d..6a4e0874 100644 --- a/llvm/unittests/IR/CFGBuilder.cpp +++ b/llvm/unittests/IR/CFGBuilder.cpp @@ -126,13 +126,13 @@ void CFGBuilder::buildCFG(const std::vector<Arc> &NewArcs) { } } -Optional<CFGBuilder::Update> CFGBuilder::getNextUpdate() const { +std::optional<CFGBuilder::Update> CFGBuilder::getNextUpdate() const { if (UpdateIdx == Updates.size()) return std::nullopt; return Updates[UpdateIdx]; } -Optional<CFGBuilder::Update> CFGBuilder::applyUpdate() { +std::optional<CFGBuilder::Update> CFGBuilder::applyUpdate() { if (UpdateIdx == Updates.size()) return std::nullopt; Update NextUpdate = Updates[UpdateIdx++]; diff --git a/llvm/unittests/IR/CFGBuilder.h b/llvm/unittests/IR/CFGBuilder.h index 97be4a1..6fb03ee 100644 --- a/llvm/unittests/IR/CFGBuilder.h +++ b/llvm/unittests/IR/CFGBuilder.h @@ -72,8 +72,8 @@ public: std::vector<Update> Updates); BasicBlock *getOrAddBlock(StringRef BlockName); - Optional<Update> getNextUpdate() const; - Optional<Update> applyUpdate(); + std::optional<Update> getNextUpdate() const; + std::optional<Update> applyUpdate(); void dump(raw_ostream &OS = dbgs()) const; private: diff --git a/llvm/unittests/IR/ConstantRangeTest.cpp b/llvm/unittests/IR/ConstantRangeTest.cpp index 6d2d85c..cb53801 100644 --- a/llvm/unittests/IR/ConstantRangeTest.cpp +++ b/llvm/unittests/IR/ConstantRangeTest.cpp @@ -175,7 +175,7 @@ static void TestRange(const ConstantRange &CR, const SmallBitVector &Elems, } using UnaryRangeFn = llvm::function_ref<ConstantRange(const ConstantRange &)>; -using UnaryIntFn = llvm::function_ref<Optional<APInt>(const APInt &)>; +using UnaryIntFn = llvm::function_ref<std::optional<APInt>(const APInt &)>; static void TestUnaryOpExhaustive(UnaryRangeFn RangeFn, UnaryIntFn IntFn, PreferFn PreferenceFn = PreferSmallest) { @@ -183,7 +183,7 @@ static void TestUnaryOpExhaustive(UnaryRangeFn RangeFn, UnaryIntFn IntFn, EnumerateConstantRanges(Bits, [&](const ConstantRange &CR) { SmallBitVector Elems(1 << Bits); ForeachNumInConstantRange(CR, [&](const APInt &N) { - if (Optional<APInt> ResultN = IntFn(N)) + if (std::optional<APInt> ResultN = IntFn(N)) Elems.set(ResultN->getZExtValue()); }); TestRange(RangeFn(CR), Elems, PreferenceFn, {CR}); @@ -192,8 +192,8 @@ static void TestUnaryOpExhaustive(UnaryRangeFn RangeFn, UnaryIntFn IntFn, using BinaryRangeFn = llvm::function_ref<ConstantRange(const ConstantRange &, const ConstantRange &)>; -using BinaryIntFn = llvm::function_ref<Optional<APInt>(const APInt &, - const APInt &)>; +using BinaryIntFn = + llvm::function_ref<std::optional<APInt>(const APInt &, const APInt &)>; using BinaryCheckFn = llvm::function_ref<bool(const ConstantRange &, const ConstantRange &)>; @@ -233,7 +233,7 @@ static void TestBinaryOpExhaustive(BinaryRangeFn RangeFn, BinaryIntFn IntFn, SmallBitVector Elems(1 << Bits); ForeachNumInConstantRange(CR1, [&](const APInt &N1) { ForeachNumInConstantRange(CR2, [&](const APInt &N2) { - if (Optional<APInt> ResultN = IntFn(N1, N2)) + if (std::optional<APInt> ResultN = IntFn(N1, N2)) Elems.set(ResultN->getZExtValue()); }); }); @@ -773,15 +773,14 @@ TEST_F(ConstantRangeTest, AddWithNoWrap) { [](const ConstantRange &CR1, const ConstantRange &CR2) { return CR1.addWithNoWrap(CR2, OBO::NoSignedWrap); }, - [](const APInt &N1, const APInt &N2) -> Optional<APInt> { + [](const APInt &N1, const APInt &N2) -> std::optional<APInt> { bool IsOverflow; APInt Res = N1.sadd_ov(N2, IsOverflow); if (IsOverflow) return std::nullopt; return Res; }, - PreferSmallest, - CheckNonSignWrappedOnly); + PreferSmallest, CheckNonSignWrappedOnly); EXPECT_EQ(Empty.addWithNoWrap(Some, OBO::NoUnsignedWrap), Empty); EXPECT_EQ(Some.addWithNoWrap(Empty, OBO::NoUnsignedWrap), Empty); @@ -827,15 +826,14 @@ TEST_F(ConstantRangeTest, AddWithNoWrap) { [](const ConstantRange &CR1, const ConstantRange &CR2) { return CR1.addWithNoWrap(CR2, OBO::NoUnsignedWrap); }, - [](const APInt &N1, const APInt &N2) -> Optional<APInt> { + [](const APInt &N1, const APInt &N2) -> std::optional<APInt> { bool IsOverflow; APInt Res = N1.uadd_ov(N2, IsOverflow); if (IsOverflow) return std::nullopt; return Res; }, - PreferSmallest, - CheckNonWrappedOnly); + PreferSmallest, CheckNonWrappedOnly); EXPECT_EQ(ConstantRange(APInt(8, 50), APInt(8, 100)) .addWithNoWrap(ConstantRange(APInt(8, 20), APInt(8, 70)), @@ -867,7 +865,7 @@ TEST_F(ConstantRangeTest, AddWithNoWrap) { [](const ConstantRange &CR1, const ConstantRange &CR2) { return CR1.addWithNoWrap(CR2, OBO::NoUnsignedWrap | OBO::NoSignedWrap); }, - [](const APInt &N1, const APInt &N2) -> Optional<APInt> { + [](const APInt &N1, const APInt &N2) -> std::optional<APInt> { bool IsOverflow1, IsOverflow2; APInt Res1 = N1.uadd_ov(N2, IsOverflow1); APInt Res2 = N1.sadd_ov(N2, IsOverflow2); @@ -876,8 +874,7 @@ TEST_F(ConstantRangeTest, AddWithNoWrap) { assert(Res1 == Res2 && "Addition results differ?"); return Res1; }, - PreferSmallest, - CheckNonWrappedOrSignWrappedOnly); + PreferSmallest, CheckNonWrappedOrSignWrappedOnly); } TEST_F(ConstantRangeTest, Sub) { @@ -916,33 +913,31 @@ TEST_F(ConstantRangeTest, SubWithNoWrap) { [](const ConstantRange &CR1, const ConstantRange &CR2) { return CR1.subWithNoWrap(CR2, OBO::NoSignedWrap); }, - [](const APInt &N1, const APInt &N2) -> Optional<APInt> { + [](const APInt &N1, const APInt &N2) -> std::optional<APInt> { bool IsOverflow; APInt Res = N1.ssub_ov(N2, IsOverflow); if (IsOverflow) return std::nullopt; return Res; }, - PreferSmallest, - CheckNonSignWrappedOnly); + PreferSmallest, CheckNonSignWrappedOnly); TestBinaryOpExhaustive( [](const ConstantRange &CR1, const ConstantRange &CR2) { return CR1.subWithNoWrap(CR2, OBO::NoUnsignedWrap); }, - [](const APInt &N1, const APInt &N2) -> Optional<APInt> { + [](const APInt &N1, const APInt &N2) -> std::optional<APInt> { bool IsOverflow; APInt Res = N1.usub_ov(N2, IsOverflow); if (IsOverflow) return std::nullopt; return Res; }, - PreferSmallest, - CheckNonWrappedOnly); + PreferSmallest, CheckNonWrappedOnly); TestBinaryOpExhaustive( [](const ConstantRange &CR1, const ConstantRange &CR2) { return CR1.subWithNoWrap(CR2, OBO::NoUnsignedWrap | OBO::NoSignedWrap); }, - [](const APInt &N1, const APInt &N2) -> Optional<APInt> { + [](const APInt &N1, const APInt &N2) -> std::optional<APInt> { bool IsOverflow1, IsOverflow2; APInt Res1 = N1.usub_ov(N2, IsOverflow1); APInt Res2 = N1.ssub_ov(N2, IsOverflow2); @@ -951,8 +946,7 @@ TEST_F(ConstantRangeTest, SubWithNoWrap) { assert(Res1 == Res2 && "Subtraction results differ?"); return Res1; }, - PreferSmallest, - CheckNonWrappedOrSignWrappedOnly); + PreferSmallest, CheckNonWrappedOrSignWrappedOnly); } TEST_F(ConstantRangeTest, Multiply) { @@ -1246,13 +1240,12 @@ TEST_F(ConstantRangeTest, URem) { [](const ConstantRange &CR1, const ConstantRange &CR2) { return CR1.urem(CR2); }, - [](const APInt &N1, const APInt &N2) -> Optional<APInt> { + [](const APInt &N1, const APInt &N2) -> std::optional<APInt> { if (N2.isZero()) return std::nullopt; return N1.urem(N2); }, - PreferSmallest, - CheckSingleElementsOnly); + PreferSmallest, CheckSingleElementsOnly); } TEST_F(ConstantRangeTest, SRem) { @@ -1322,13 +1315,12 @@ TEST_F(ConstantRangeTest, SRem) { [](const ConstantRange &CR1, const ConstantRange &CR2) { return CR1.srem(CR2); }, - [](const APInt &N1, const APInt &N2) -> Optional<APInt> { + [](const APInt &N1, const APInt &N2) -> std::optional<APInt> { if (N2.isZero()) return std::nullopt; return N1.srem(N2); }, - PreferSmallest, - CheckSingleElementsOnly); + PreferSmallest, CheckSingleElementsOnly); } TEST_F(ConstantRangeTest, Shl) { @@ -1360,7 +1352,7 @@ TEST_F(ConstantRangeTest, Shl) { [](const ConstantRange &CR1, const ConstantRange &CR2) { return CR1.shl(CR2); }, - [](const APInt &N1, const APInt &N2) -> Optional<APInt> { + [](const APInt &N1, const APInt &N2) -> std::optional<APInt> { if (N2.uge(N2.getBitWidth())) return std::nullopt; return N1.shl(N2); @@ -2397,7 +2389,7 @@ TEST_F(ConstantRangeTest, Abs) { TestUnaryOpExhaustive( [](const ConstantRange &CR) { return CR.abs(/*IntMinIsPoison=*/true); }, - [](const APInt &N) -> Optional<APInt> { + [](const APInt &N) -> std::optional<APInt> { if (N.isMinSignedValue()) return std::nullopt; return N.abs(); diff --git a/llvm/unittests/IR/DominatorTreeTest.cpp b/llvm/unittests/IR/DominatorTreeTest.cpp index 21f11c8..6260ce2 100644 --- a/llvm/unittests/IR/DominatorTreeTest.cpp +++ b/llvm/unittests/IR/DominatorTreeTest.cpp @@ -722,7 +722,7 @@ TEST(DominatorTree, InsertReachable) { PostDominatorTree PDT(*Holder.F); EXPECT_TRUE(PDT.verify()); - Optional<CFGBuilder::Update> LastUpdate; + std::optional<CFGBuilder::Update> LastUpdate; while ((LastUpdate = B.applyUpdate())) { EXPECT_EQ(LastUpdate->Action, Insert); BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From); @@ -748,7 +748,7 @@ TEST(DominatorTree, InsertReachable2) { PostDominatorTree PDT(*Holder.F); EXPECT_TRUE(PDT.verify()); - Optional<CFGBuilder::Update> LastUpdate = B.applyUpdate(); + std::optional<CFGBuilder::Update> LastUpdate = B.applyUpdate(); EXPECT_TRUE(LastUpdate); EXPECT_EQ(LastUpdate->Action, Insert); @@ -776,7 +776,7 @@ TEST(DominatorTree, InsertUnreachable) { PostDominatorTree PDT(*Holder.F); EXPECT_TRUE(PDT.verify()); - Optional<CFGBuilder::Update> LastUpdate; + std::optional<CFGBuilder::Update> LastUpdate; while ((LastUpdate = B.applyUpdate())) { EXPECT_EQ(LastUpdate->Action, Insert); BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From); @@ -797,7 +797,7 @@ TEST(DominatorTree, InsertFromUnreachable) { PostDominatorTree PDT(*Holder.F); EXPECT_TRUE(PDT.verify()); - Optional<CFGBuilder::Update> LastUpdate = B.applyUpdate(); + std::optional<CFGBuilder::Update> LastUpdate = B.applyUpdate(); EXPECT_TRUE(LastUpdate); EXPECT_EQ(LastUpdate->Action, Insert); @@ -827,7 +827,7 @@ TEST(DominatorTree, InsertMixed) { PostDominatorTree PDT(*Holder.F); EXPECT_TRUE(PDT.verify()); - Optional<CFGBuilder::Update> LastUpdate; + std::optional<CFGBuilder::Update> LastUpdate; while ((LastUpdate = B.applyUpdate())) { EXPECT_EQ(LastUpdate->Action, Insert); BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From); @@ -857,7 +857,7 @@ TEST(DominatorTree, InsertPermut) { PostDominatorTree PDT(*Holder.F); EXPECT_TRUE(PDT.verify()); - Optional<CFGBuilder::Update> LastUpdate; + std::optional<CFGBuilder::Update> LastUpdate; while ((LastUpdate = B.applyUpdate())) { EXPECT_EQ(LastUpdate->Action, Insert); BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From); @@ -884,7 +884,7 @@ TEST(DominatorTree, DeleteReachable) { PostDominatorTree PDT(*Holder.F); EXPECT_TRUE(PDT.verify()); - Optional<CFGBuilder::Update> LastUpdate; + std::optional<CFGBuilder::Update> LastUpdate; while ((LastUpdate = B.applyUpdate())) { EXPECT_EQ(LastUpdate->Action, Delete); BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From); @@ -910,7 +910,7 @@ TEST(DominatorTree, DeleteUnreachable) { PostDominatorTree PDT(*Holder.F); EXPECT_TRUE(PDT.verify()); - Optional<CFGBuilder::Update> LastUpdate; + std::optional<CFGBuilder::Update> LastUpdate; while ((LastUpdate = B.applyUpdate())) { EXPECT_EQ(LastUpdate->Action, Delete); BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From); @@ -940,7 +940,7 @@ TEST(DominatorTree, InsertDelete) { PostDominatorTree PDT(*Holder.F); EXPECT_TRUE(PDT.verify()); - Optional<CFGBuilder::Update> LastUpdate; + std::optional<CFGBuilder::Update> LastUpdate; while ((LastUpdate = B.applyUpdate())) { BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From); BasicBlock *To = B.getOrAddBlock(LastUpdate->Edge.To); @@ -978,7 +978,7 @@ TEST(DominatorTree, InsertDeleteExhaustive) { PostDominatorTree PDT(*Holder.F); EXPECT_TRUE(PDT.verify()); - Optional<CFGBuilder::Update> LastUpdate; + std::optional<CFGBuilder::Update> LastUpdate; while ((LastUpdate = B.applyUpdate())) { BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From); BasicBlock *To = B.getOrAddBlock(LastUpdate->Edge.To); diff --git a/llvm/unittests/IR/VPIntrinsicTest.cpp b/llvm/unittests/IR/VPIntrinsicTest.cpp index 6ef9ccc..5abead9 100644 --- a/llvm/unittests/IR/VPIntrinsicTest.cpp +++ b/llvm/unittests/IR/VPIntrinsicTest.cpp @@ -163,7 +163,7 @@ protected: /// Check that the property scopes include/llvm/IR/VPIntrinsics.def are closed. TEST_F(VPIntrinsicTest, VPIntrinsicsDefScopes) { - Optional<Intrinsic::ID> ScopeVPID; + std::optional<Intrinsic::ID> ScopeVPID; #define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) \ ASSERT_FALSE(ScopeVPID.has_value()); \ ScopeVPID = Intrinsic::VPID; @@ -172,7 +172,7 @@ TEST_F(VPIntrinsicTest, VPIntrinsicsDefScopes) { ASSERT_EQ(*ScopeVPID, Intrinsic::VPID); \ ScopeVPID = std::nullopt; - Optional<ISD::NodeType> ScopeOPC; + std::optional<ISD::NodeType> ScopeOPC; #define BEGIN_REGISTER_VP_SDNODE(SDOPC, ...) \ ASSERT_FALSE(ScopeOPC.has_value()); \ ScopeOPC = ISD::SDOPC; diff --git a/llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp b/llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp index 6ad665b..fef1a93 100644 --- a/llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp +++ b/llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp @@ -24,8 +24,8 @@ using namespace llvm; static void check(remarks::Format SerializerFormat, remarks::SerializerMode Mode, ArrayRef<remarks::Remark> Rs, - StringRef ExpectedR, Optional<StringRef> ExpectedMeta, - Optional<remarks::StringTable> StrTab = std::nullopt) { + StringRef ExpectedR, std::optional<StringRef> ExpectedMeta, + std::optional<remarks::StringTable> StrTab = std::nullopt) { std::string Buf; raw_string_ostream OS(Buf); Expected<std::unique_ptr<remarks::RemarkSerializer>> MaybeS = [&] { @@ -53,7 +53,7 @@ static void check(remarks::Format SerializerFormat, static void check(remarks::Format SerializerFormat, const remarks::Remark &R, StringRef ExpectedR, StringRef ExpectedMeta, - Optional<remarks::StringTable> StrTab = std::nullopt) { + std::optional<remarks::StringTable> StrTab = std::nullopt) { return check(SerializerFormat, remarks::SerializerMode::Separate, makeArrayRef(&R, &R + 1), ExpectedR, ExpectedMeta, std::move(StrTab)); @@ -62,7 +62,7 @@ static void check(remarks::Format SerializerFormat, const remarks::Remark &R, static void checkStandalone(remarks::Format SerializerFormat, const remarks::Remark &R, StringRef ExpectedR, - Optional<remarks::StringTable> StrTab = std::nullopt) { + std::optional<remarks::StringTable> StrTab = std::nullopt) { return check(SerializerFormat, remarks::SerializerMode::Standalone, makeArrayRef(&R, &R + 1), ExpectedR, /*ExpectedMeta=*/std::nullopt, std::move(StrTab)); diff --git a/llvm/unittests/Support/TypeTraitsTest.cpp b/llvm/unittests/Support/TypeTraitsTest.cpp index 845c38d..85f985d 100644 --- a/llvm/unittests/Support/TypeTraitsTest.cpp +++ b/llvm/unittests/Support/TypeTraitsTest.cpp @@ -120,7 +120,7 @@ TEST(Triviality, ADT) { TrivialityTester<llvm::PointerIntPair<int *, 2>, true, true>(); #if defined(_LIBCPP_VERSION) || \ (defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 8) - TrivialityTester<llvm::Optional<int>, true, true>(); + TrivialityTester<std::optional<int>, true, true>(); #endif } diff --git a/llvm/unittests/Testing/Support/TempPathTest.cpp b/llvm/unittests/Testing/Support/TempPathTest.cpp index 11820b0..37186f5 100644 --- a/llvm/unittests/Testing/Support/TempPathTest.cpp +++ b/llvm/unittests/Testing/Support/TempPathTest.cpp @@ -19,7 +19,7 @@ using llvm::unittest::TempLink; namespace { TEST(TempPathTest, TempDir) { - Optional<TempDir> Dir1, Dir2; + std::optional<TempDir> Dir1, Dir2; StringRef Prefix = "temp-path-test"; Dir1.emplace(Prefix, /*Unique=*/true); EXPECT_EQ(Prefix, @@ -44,7 +44,7 @@ TEST(TempPathTest, TempFile) { TempDir D("temp-path-test", /*Unique=*/true); ASSERT_TRUE(sys::fs::exists(D.path())); - Optional<TempFile> File1, File2; + std::optional<TempFile> File1, File2; File1.emplace(D.path("file"), "suffix", "content"); EXPECT_EQ("file.suffix", sys::path::filename(File1->path())); { @@ -73,7 +73,7 @@ TEST(TempPathTest, TempLink) { ASSERT_TRUE(sys::fs::exists(D.path())); TempFile File(D.path("file"), "suffix", "content"); - Optional<TempLink> Link1, Link2; + std::optional<TempLink> Link1, Link2; Link1.emplace(File.path(), D.path("link")); EXPECT_EQ("link", sys::path::filename(Link1->path())); { diff --git a/llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp b/llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp index d74f81e..b19e034 100644 --- a/llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp +++ b/llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp @@ -327,7 +327,7 @@ private: std::vector<std::unique_ptr<Node>> Children; std::string Name; Node *Parent = nullptr; - llvm::Optional<char32_t> Value; + std::optional<char32_t> Value; }; std::unique_ptr<Node> Root = std::make_unique<Node>(""); |