[llvm] ffba7ee - [IPO] Use std::optional in Attributor.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 23:35:11 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T23:35:05-08:00
New Revision: ffba7ee77831e70c2269be5cd8e79c8f275c1040

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

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 2935127dcbc4..269985265cc0 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -54,6 +54,7 @@
 #endif
 
 #include <cassert>
+#include <optional>
 #include <string>
 
 using namespace llvm;
@@ -737,7 +738,7 @@ Argument *IRPosition::getAssociatedArgument() const {
   // values and the ones in callbacks. If a callback was found that makes use
   // of the underlying call site operand, we want the corresponding callback
   // callee argument and not the direct callee argument.
-  Optional<Argument *> CBCandidateArg;
+  std::optional<Argument *> CBCandidateArg;
   SmallVector<const Use *, 4> CallbackUses;
   const auto &CB = cast<CallBase>(getAnchorValue());
   AbstractCallSite::getCallbackUses(CB, CallbackUses);


        


More information about the llvm-commits mailing list