[llvm] 0b5ba08 - [Orc] Use std::optional in MachOPlatform.cpp (NFC)

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


Author: Kazu Hirata
Date: 2022-11-26T15:22:05-08:00
New Revision: 0b5ba08013a1f412f50ae9ea449d304bb0a1c512

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

LOG: [Orc] Use std::optional in MachOPlatform.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/Orc/MachOPlatform.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
index 29bf864dcd95..fb458c288c1b 100644
--- a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
@@ -15,6 +15,7 @@
 #include "llvm/ExecutionEngine/Orc/LookupAndRecordAddrs.h"
 #include "llvm/Support/BinaryByteStream.h"
 #include "llvm/Support/Debug.h"
+#include <optional>
 
 #define DEBUG_TYPE "orc"
 
@@ -820,7 +821,7 @@ Error MachOPlatform::MachOPlatformPlugin::fixTLVSectionsAndEdges(
 
   // Store key in __thread_vars struct fields.
   if (auto *ThreadDataSec = G.findSectionByName(ThreadVarsSectionName)) {
-    Optional<uint64_t> Key;
+    std::optional<uint64_t> Key;
     {
       std::lock_guard<std::mutex> Lock(MP.PlatformMutex);
       auto I = MP.JITDylibToPThreadKey.find(&JD);
@@ -945,7 +946,7 @@ Error MachOPlatform::MachOPlatformPlugin::registerObjectPlatformSections(
   }
 
   if (!MachOPlatformSecs.empty()) {
-    Optional<ExecutorAddr> HeaderAddr;
+    std::optional<ExecutorAddr> HeaderAddr;
     {
       std::lock_guard<std::mutex> Lock(MP.PlatformMutex);
       auto I = MP.JITDylibToHeaderAddr.find(&JD);


        


More information about the llvm-commits mailing list