[llvm] 7df1da0 - [llvm] Use std::optional instead of llvm::Optional (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 2 21:17:21 PST 2023
Author: Kazu Hirata
Date: 2023-01-02T21:17:15-08:00
New Revision: 7df1da08ff9229c12884b408b0f614b8f20d6d5a
URL: https://github.com/llvm/llvm-project/commit/7df1da08ff9229c12884b408b0f614b8f20d6d5a
DIFF: https://github.com/llvm/llvm-project/commit/7df1da08ff9229c12884b408b0f614b8f20d6d5a.diff
LOG: [llvm] Use std::optional instead of llvm::Optional (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/ADT/BreadthFirstIterator.h
llvm/include/llvm/ADT/DepthFirstIterator.h
llvm/lib/Target/BPF/BTFDebug.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/BreadthFirstIterator.h b/llvm/include/llvm/ADT/BreadthFirstIterator.h
index 41f3d8e2a5309..c1a236bf56923 100644
--- a/llvm/include/llvm/ADT/BreadthFirstIterator.h
+++ b/llvm/include/llvm/ADT/BreadthFirstIterator.h
@@ -19,10 +19,10 @@
#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>
diff --git a/llvm/include/llvm/ADT/DepthFirstIterator.h b/llvm/include/llvm/ADT/DepthFirstIterator.h
index 4105a95338339..29ea2d541d9f3 100644
--- a/llvm/include/llvm/ADT/DepthFirstIterator.h
+++ b/llvm/include/llvm/ADT/DepthFirstIterator.h
@@ -35,10 +35,10 @@
#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>
diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp
index db9dceb4dc2a6..f2bf256459b14 100644
--- a/llvm/lib/Target/BPF/BTFDebug.cpp
+++ b/llvm/lib/Target/BPF/BTFDebug.cpp
@@ -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);
More information about the llvm-commits
mailing list