[llvm] Use std::optional instead of llvm::Optional (NFC)
authorKazu Hirata <kazu@google.com>
Tue, 3 Jan 2023 05:17:15 +0000 (21:17 -0800)
committerKazu Hirata <kazu@google.com>
Tue, 3 Jan 2023 05:17:15 +0000 (21:17 -0800)
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

llvm/include/llvm/ADT/BreadthFirstIterator.h
llvm/include/llvm/ADT/DepthFirstIterator.h
llvm/lib/Target/BPF/BTFDebug.cpp

index 41f3d8e..c1a236b 100644 (file)
 #define LLVM_ADT_BREADTHFIRSTITERATOR_H
 
 #include "llvm/ADT/GraphTraits.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/iterator_range.h"
 #include <iterator>
+#include <optional>
 #include <queue>
 #include <utility>
 
index 4105a95..29ea2d5 100644 (file)
 #define LLVM_ADT_DEPTHFIRSTITERATOR_H
 
 #include "llvm/ADT/GraphTraits.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/iterator_range.h"
 #include <iterator>
+#include <optional>
 #include <utility>
 #include <vector>
 
index db9dceb..f2bf256 100644 (file)
@@ -24,6 +24,7 @@
 #include "llvm/Support/LineIterator.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
+#include <optional>
 
 using namespace llvm;
 
@@ -1369,7 +1370,7 @@ void BTFDebug::processGlobals(bool ProcessingMapDef) {
   for (const GlobalVariable &Global : M->globals()) {
     // Decide the section name.
     StringRef SecName;
-    Optional<SectionKind> GVKind;
+    std::optional<SectionKind> GVKind;
 
     if (!Global.isDeclarationForLinker())
       GVKind = TargetLoweringObjectFile::getKindForGlobal(&Global, Asm->TM);