[llvm] f4db916 - [IR] Use std::optional in AsmWriter.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 12:01:18 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T12:01:12-08:00
New Revision: f4db9168efab39adf950719934d5184cd22fda5b

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

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 2f4ebcf26e6e8..6122c3fd81354 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -82,6 +82,7 @@
 #include <cstdint>
 #include <iterator>
 #include <memory>
+#include <optional>
 #include <string>
 #include <tuple>
 #include <utility>
@@ -4607,7 +4608,7 @@ void NamedMDNode::print(raw_ostream &ROS, bool IsForDebug) const {
 
 void NamedMDNode::print(raw_ostream &ROS, ModuleSlotTracker &MST,
                         bool IsForDebug) const {
-  Optional<SlotTracker> LocalST;
+  std::optional<SlotTracker> LocalST;
   SlotTracker *SlotTable;
   if (auto *ST = MST.getMachine())
     SlotTable = ST;


        


More information about the llvm-commits mailing list