[llvm] da6642a - [llvm] Include <optional> instead of "llvm/ADT/Optional.h" (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 14 15:09:06 PST 2023
Author: Kazu Hirata
Date: 2023-01-14T15:09:00-08:00
New Revision: da6642a1c81bb5ff68153bcdc138e75e6ecdce43
URL: https://github.com/llvm/llvm-project/commit/da6642a1c81bb5ff68153bcdc138e75e6ecdce43
DIFF: https://github.com/llvm/llvm-project/commit/da6642a1c81bb5ff68153bcdc138e75e6ecdce43.diff
LOG: [llvm] Include <optional> instead of "llvm/ADT/Optional.h" (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/STLForwardCompat.h
llvm/include/llvm/BinaryFormat/Wasm.h
llvm/include/llvm/Debuginfod/Debuginfod.h
llvm/include/llvm/FuzzMutate/IRMutator.h
llvm/include/llvm/LineEditor/LineEditor.h
llvm/include/llvm/Support/raw_ostream.h
llvm/include/llvm/Testing/Support/SupportHelpers.h
llvm/include/llvm/XRay/InstrumentationMap.h
llvm/lib/FuzzMutate/IRMutator.cpp
llvm/lib/Support/VirtualFileSystem.cpp
llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
llvm/unittests/IR/CFGBuilder.h
llvm/unittests/Support/TypeTraitsTest.cpp
llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/STLForwardCompat.h b/llvm/include/llvm/ADT/STLForwardCompat.h
index b2fe9bc753f63..97d0bff9aaedb 100644
--- a/llvm/include/llvm/ADT/STLForwardCompat.h
+++ b/llvm/include/llvm/ADT/STLForwardCompat.h
@@ -17,7 +17,6 @@
#ifndef LLVM_ADT_STLFORWARDCOMPAT_H
#define LLVM_ADT_STLFORWARDCOMPAT_H
-#include "llvm/ADT/Optional.h"
#include <optional>
#include <type_traits>
diff --git a/llvm/include/llvm/BinaryFormat/Wasm.h b/llvm/include/llvm/BinaryFormat/Wasm.h
index d18551605aadb..48195af7def30 100644
--- a/llvm/include/llvm/BinaryFormat/Wasm.h
+++ b/llvm/include/llvm/BinaryFormat/Wasm.h
@@ -15,7 +15,6 @@
#define LLVM_BINARYFORMAT_WASM_H
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include <optional>
diff --git a/llvm/include/llvm/Debuginfod/Debuginfod.h b/llvm/include/llvm/Debuginfod/Debuginfod.h
index cd9cc3b8f9356..caece0e6fc194 100644
--- a/llvm/include/llvm/Debuginfod/Debuginfod.h
+++ b/llvm/include/llvm/Debuginfod/Debuginfod.h
@@ -22,7 +22,6 @@
#include "HTTPServer.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Object/BuildID.h"
@@ -34,6 +33,7 @@
#include <chrono>
#include <condition_variable>
+#include <optional>
#include <queue>
namespace llvm {
diff --git a/llvm/include/llvm/FuzzMutate/IRMutator.h b/llvm/include/llvm/FuzzMutate/IRMutator.h
index d0708c7376861..38f8f7ba16237 100644
--- a/llvm/include/llvm/FuzzMutate/IRMutator.h
+++ b/llvm/include/llvm/FuzzMutate/IRMutator.h
@@ -18,9 +18,9 @@
#ifndef LLVM_FUZZMUTATE_IRMUTATOR_H
#define LLVM_FUZZMUTATE_IRMUTATOR_H
-#include "llvm/ADT/Optional.h"
#include "llvm/FuzzMutate/OpDescriptor.h"
#include "llvm/Support/ErrorHandling.h"
+#include <optional>
namespace llvm {
class BasicBlock;
diff --git a/llvm/include/llvm/LineEditor/LineEditor.h b/llvm/include/llvm/LineEditor/LineEditor.h
index e8c77635e9b94..29fdf9f85c6fa 100644
--- a/llvm/include/llvm/LineEditor/LineEditor.h
+++ b/llvm/include/llvm/LineEditor/LineEditor.h
@@ -9,10 +9,10 @@
#ifndef LLVM_LINEEDITOR_LINEEDITOR_H
#define LLVM_LINEEDITOR_LINEEDITOR_H
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringRef.h"
#include <cstdio>
#include <memory>
+#include <optional>
#include <string>
#include <utility>
#include <vector>
diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h
index 74e34fc4c7464..7c42f355fd431 100644
--- a/llvm/include/llvm/Support/raw_ostream.h
+++ b/llvm/include/llvm/Support/raw_ostream.h
@@ -13,7 +13,6 @@
#ifndef LLVM_SUPPORT_RAW_OSTREAM_H
#define LLVM_SUPPORT_RAW_OSTREAM_H
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/DataTypes.h"
diff --git a/llvm/include/llvm/Testing/Support/SupportHelpers.h b/llvm/include/llvm/Testing/Support/SupportHelpers.h
index f9aa136f7a0ac..95c2765027ba0 100644
--- a/llvm/include/llvm/Testing/Support/SupportHelpers.h
+++ b/llvm/include/llvm/Testing/Support/SupportHelpers.h
@@ -9,7 +9,6 @@
#ifndef LLVM_TESTING_SUPPORT_SUPPORTHELPERS_H
#define LLVM_TESTING_SUPPORT_SUPPORTHELPERS_H
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
@@ -18,6 +17,7 @@
#include "gmock/gmock-matchers.h"
#include "gtest/gtest-printers.h"
+#include <optional>
#include <string>
namespace llvm {
diff --git a/llvm/include/llvm/XRay/InstrumentationMap.h b/llvm/include/llvm/XRay/InstrumentationMap.h
index 211f3282bffca..1979108ff4133 100644
--- a/llvm/include/llvm/XRay/InstrumentationMap.h
+++ b/llvm/include/llvm/XRay/InstrumentationMap.h
@@ -14,11 +14,11 @@
#ifndef LLVM_XRAY_INSTRUMENTATIONMAP_H
#define LLVM_XRAY_INSTRUMENTATIONMAP_H
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/YAMLTraits.h"
#include <cstdint>
+#include <optional>
#include <unordered_map>
#include <vector>
diff --git a/llvm/lib/FuzzMutate/IRMutator.cpp b/llvm/lib/FuzzMutate/IRMutator.cpp
index 219db27faca66..1e07acb5ae4d5 100644
--- a/llvm/lib/FuzzMutate/IRMutator.cpp
+++ b/llvm/lib/FuzzMutate/IRMutator.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "llvm/FuzzMutate/IRMutator.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
@@ -28,6 +27,7 @@
#include "llvm/Support/SourceMgr.h"
#include "llvm/Transforms/Scalar/DCE.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
+#include <optional>
using namespace llvm;
diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp
index efb5faa8e1437..a167e0a76795a 100644
--- a/llvm/lib/Support/VirtualFileSystem.cpp
+++ b/llvm/lib/Support/VirtualFileSystem.cpp
@@ -14,7 +14,6 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
diff --git a/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp b/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
index 7d8bf2b7e396e..d4b9c4b5f92bc 100644
--- a/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
+++ b/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
@@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//
#include "llvm/ToolDrivers/llvm-dlltool/DlltoolDriver.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/COFFImportFile.h"
@@ -22,6 +21,7 @@
#include "llvm/Support/Host.h"
#include "llvm/Support/Path.h"
+#include <optional>
#include <vector>
using namespace llvm;
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index c03887558c723..34c61f83ad306 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -13,7 +13,6 @@
#include "llvm/Transforms/Instrumentation/HWAddressSanitizer.h"
#include "llvm/ADT/MapVector.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
@@ -56,6 +55,7 @@
#include "llvm/Transforms/Utils/MemoryTaggingSupport.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
#include "llvm/Transforms/Utils/PromoteMemToReg.h"
+#include <optional>
using namespace llvm;
diff --git a/llvm/unittests/IR/CFGBuilder.h b/llvm/unittests/IR/CFGBuilder.h
index 6fb03ee57cc22..721034d5720bf 100644
--- a/llvm/unittests/IR/CFGBuilder.h
+++ b/llvm/unittests/IR/CFGBuilder.h
@@ -15,12 +15,12 @@
#define LLVM_UNITTESTS_CFG_BUILDER_H
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Debug.h"
#include <memory>
+#include <optional>
#include <set>
#include <tuple>
#include <vector>
diff --git a/llvm/unittests/Support/TypeTraitsTest.cpp b/llvm/unittests/Support/TypeTraitsTest.cpp
index 85f985da35975..229626c778818 100644
--- a/llvm/unittests/Support/TypeTraitsTest.cpp
+++ b/llvm/unittests/Support/TypeTraitsTest.cpp
@@ -8,13 +8,13 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/FunctionExtras.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/type_traits.h"
#include "gtest/gtest.h"
+#include <optional>
namespace {
diff --git a/llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp b/llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp
index b19e0345f9097..83770e845d408 100644
--- a/llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp
+++ b/llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp
@@ -11,7 +11,6 @@
// https://unicode.org/Public/15.0.0/ucd/
//===----------------------------------------------------------------------===//
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
@@ -20,6 +19,7 @@
#include <deque>
#include <fstream>
#include <memory>
+#include <optional>
#include <set>
#include <string>
#include <unordered_map>
More information about the llvm-commits
mailing list