[llvm] 6a9ef0d - [AsmPrinter] Use std::optional in AsmPrinter.cpp (NFC)

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


Author: Kazu Hirata
Date: 2022-11-26T14:11:17-08:00
New Revision: 6a9ef0dd4e3689c9c982a8303b0d2d545760b28d

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

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 75c3075b5544a..5238030a48775 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -119,6 +119,7 @@
 #include <cstdint>
 #include <iterator>
 #include <memory>
+#include <optional>
 #include <string>
 #include <utility>
 #include <vector>
@@ -1191,7 +1192,7 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
     case MachineOperand::MO_Register:
     case MachineOperand::MO_FrameIndex: {
       Register Reg;
-      Optional<StackOffset> Offset;
+      std::optional<StackOffset> Offset;
       if (Op.isReg()) {
         Reg = Op.getReg();
       } else {
@@ -2045,7 +2046,7 @@ void AsmPrinter::emitRemarksSection(remarks::RemarkStreamer &RS) {
 
   remarks::RemarkSerializer &RemarkSerializer = RS.getSerializer();
 
-  Optional<SmallString<128>> Filename;
+  std::optional<SmallString<128>> Filename;
   if (Optional<StringRef> FilenameRef = RS.getFilename()) {
     Filename = *FilenameRef;
     sys::fs::make_absolute(*Filename);


        


More information about the llvm-commits mailing list