[Utils] Use std::optional in CloneFunction.cpp (NFC)
authorKazu Hirata <kazu@google.com>
Sun, 27 Nov 2022 01:44:44 +0000 (17:44 -0800)
committerKazu Hirata <kazu@google.com>
Sun, 27 Nov 2022 01:44:44 +0000 (17:44 -0800)
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

llvm/lib/Transforms/Utils/CloneFunction.cpp

index 78c27db..250528b 100644 (file)
@@ -33,6 +33,7 @@
 #include "llvm/Transforms/Utils/Local.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
 #include <map>
+#include <optional>
 using namespace llvm;
 
 #define DEBUG_TYPE "clone-function"
@@ -136,7 +137,7 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
   // duplicate instructions and then freeze them in the MD map. We also record
   // information about dbg.value and dbg.declare to avoid duplicating the
   // types.
-  Optional<DebugInfoFinder> DIFinder;
+  std::optional<DebugInfoFinder> DIFinder;
 
   // Track the subprogram attachment that needs to be cloned to fine-tune the
   // mapping within the same module.