[llvm] 12c80ef - [Utils] Use std::optional in CloneFunction.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 26 17:44:49 PST 2022


Author: Kazu Hirata
Date: 2022-11-26T17:44:44-08:00
New Revision: 12c80ef3f5c1ff7eacea23525829bbbdd86631de

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

LOG: [Utils] Use std::optional in CloneFunction.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/Transforms/Utils/CloneFunction.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 78c27db35e6f3..250528bb91b7f 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -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.


        


More information about the llvm-commits mailing list