Include <optional> instead of "llvm/ADT/Optional.h"
authorKazu Hirata <kazu@google.com>
Sun, 18 Dec 2022 08:28:54 +0000 (00:28 -0800)
committerKazu Hirata <kazu@google.com>
Sun, 18 Dec 2022 08:28:54 +0000 (00:28 -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

clang-tools-extra/clangd/Config.h
llvm/include/llvm/Support/Allocator.h
llvm/include/llvm/Support/FormatProviders.h
llvm/include/llvm/Support/NativeFormatting.h
llvm/include/llvm/Support/VersionTuple.h
llvm/include/llvm/Support/VirtualFileSystem.h
llvm/lib/Support/OptimizedStructLayout.cpp
llvm/lib/Support/Threading.cpp

index 7123a90..cbc9c79 100644 (file)
 
 #include "support/Context.h"
 #include "llvm/ADT/FunctionExtras.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringSet.h"
 #include <functional>
+#include <optional>
 #include <string>
 #include <vector>
 
index ab3e122..c1e5c6d 100644 (file)
@@ -17,7 +17,6 @@
 #ifndef LLVM_SUPPORT_ALLOCATOR_H
 #define LLVM_SUPPORT_ALLOCATOR_H
 
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Alignment.h"
 #include "llvm/Support/AllocatorBase.h"
@@ -28,6 +27,7 @@
 #include <cstddef>
 #include <cstdint>
 #include <iterator>
+#include <optional>
 #include <utility>
 
 namespace llvm {
index 3fcd1b3..44da741 100644 (file)
@@ -14,7 +14,6 @@
 #ifndef LLVM_SUPPORT_FORMATPROVIDERS_H
 #define LLVM_SUPPORT_FORMATPROVIDERS_H
 
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/ADT/Twine.h"
@@ -22,6 +21,7 @@
 #include "llvm/Support/NativeFormatting.h"
 
 #include <array>
+#include <optional>
 #include <type_traits>
 
 namespace llvm {
index 6fc1ee8..ab85ae2 100644 (file)
@@ -9,8 +9,8 @@
 #ifndef LLVM_SUPPORT_NATIVEFORMATTING_H
 #define LLVM_SUPPORT_NATIVEFORMATTING_H
 
-#include "llvm/ADT/Optional.h"
 #include <cstdint>
+#include <optional>
 
 namespace llvm {
 class raw_ostream;
index 1483252..1118754 100644 (file)
@@ -16,8 +16,8 @@
 
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/Hashing.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/Support/Endian.h"
+#include <optional>
 #include <string>
 #include <tuple>
 
index 71dbc80..3ef17a7 100644 (file)
@@ -15,7 +15,6 @@
 #define LLVM_SUPPORT_VIRTUALFILESYSTEM_H
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
@@ -29,6 +28,7 @@
 #include <cstdint>
 #include <ctime>
 #include <memory>
+#include <optional>
 #include <stack>
 #include <string>
 #include <system_error>
index c64eff6..7b21f92 100644 (file)
@@ -11,7 +11,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/OptimizedStructLayout.h"
-#include "llvm/ADT/Optional.h"
+#include <optional>
 
 using namespace llvm;
 
index f4e3331..923935b 100644 (file)
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/Threading.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/Config/config.h"
 #include "llvm/Config/llvm-config.h"
 
 #include <cassert>
 #include <errno.h>
+#include <optional>
 #include <stdlib.h>
 #include <string.h>