[llvm] e80118e - [JITLink] Use std::optional in MachOLinkGraphBuilder.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 26 15:15:23 PST 2022


Author: Kazu Hirata
Date: 2022-11-26T15:15:18-08:00
New Revision: e80118eed6d90bbc8d294a4f09307244e8b534aa

URL: https://github.com/llvm/llvm-project/commit/e80118eed6d90bbc8d294a4f09307244e8b534aa
DIFF: https://github.com/llvm/llvm-project/commit/e80118eed6d90bbc8d294a4f09307244e8b534aa.diff

LOG: [JITLink] Use std::optional in MachOLinkGraphBuilder.cpp (NFC)

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

Added: 
    

Modified: 
    llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp b/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
index d16259bc31cd6..9876899933979 100644
--- a/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp
@@ -11,6 +11,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "MachOLinkGraphBuilder.h"
+#include <optional>
 
 #define DEBUG_TYPE "jitlink"
 
@@ -260,7 +261,7 @@ Error MachOLinkGraphBuilder::createNormalizedSymbols() {
     if (Type & MachO::N_STAB)
       continue;
 
-    Optional<StringRef> Name;
+    std::optional<StringRef> Name;
     if (NStrX) {
       if (auto NameOrErr = SymRef.getName())
         Name = *NameOrErr;
@@ -537,7 +538,7 @@ Error MachOLinkGraphBuilder::graphifyRegularSymbols() {
                                        BlockStart, NSec.Alignment,
                                        BlockStart % NSec.Alignment);
 
-      Optional<orc::ExecutorAddr> LastCanonicalAddr;
+      std::optional<orc::ExecutorAddr> LastCanonicalAddr;
       auto SymEnd = BlockEnd;
       while (!BlockSyms.empty()) {
         auto &NSym = *BlockSyms.back();


        


More information about the llvm-commits mailing list