[llvm] 6fd5c0b - [IR] Use std::optional in InstrTypes.h (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 27 14:40:17 PST 2022


Author: Kazu Hirata
Date: 2022-11-27T14:40:05-08:00
New Revision: 6fd5c0b76a0c4e0ae189ac3064d1e279b66fd86c

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

LOG: [IR] Use std::optional in InstrTypes.h (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/include/llvm/IR/InstrTypes.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index da081d0c40711..fe63344b7e2cb 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -36,6 +36,7 @@
 #include <cstddef>
 #include <cstdint>
 #include <iterator>
+#include <optional>
 #include <string>
 #include <vector>
 
@@ -2014,7 +2015,7 @@ class CallBase : public Instruction {
   ///
   /// It is an error to call this for operand bundle types that may have
   /// multiple instances of them on the same instruction.
-  Optional<OperandBundleUse> getOperandBundle(StringRef Name) const {
+  std::optional<OperandBundleUse> getOperandBundle(StringRef Name) const {
     assert(countOperandBundlesOfType(Name) < 2 && "Precondition violated!");
 
     for (unsigned i = 0, e = getNumOperandBundles(); i != e; ++i) {


        


More information about the llvm-commits mailing list