[llvm] 8a45032 - [CodeGen] Use std::optional in MachineOperand.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 26 14:55:13 PST 2022


Author: Kazu Hirata
Date: 2022-11-26T14:55:08-08:00
New Revision: 8a45032e5c3ad8581fd925b1ec670c82df38f8fe

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

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp
index 797b3ded8b27..bc3a49115871 100644
--- a/llvm/lib/CodeGen/MachineOperand.cpp
+++ b/llvm/lib/CodeGen/MachineOperand.cpp
@@ -29,6 +29,7 @@
 #include "llvm/MC/MCDwarf.h"
 #include "llvm/Target/TargetIntrinsicInfo.h"
 #include "llvm/Target/TargetMachine.h"
+#include <optional>
 
 using namespace llvm;
 
@@ -470,7 +471,7 @@ static void printIRBlockReference(raw_ostream &OS, const BasicBlock &BB,
     printLLVMNameWithoutPrefix(OS, BB.getName());
     return;
   }
-  Optional<int> Slot;
+  std::optional<int> Slot;
   if (const Function *F = BB.getParent()) {
     if (F == MST.getCurrentFunction()) {
       Slot = MST.getLocalSlot(&BB);


        


More information about the llvm-commits mailing list