[llvm] 541ef3d - Include <optional> instead of "llvm/ADT/Optional.h"

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 18 00:29:00 PST 2022


Author: Kazu Hirata
Date: 2022-12-18T00:28:54-08:00
New Revision: 541ef3d61e9341cd38420c0dbca9250c4d0ea04c

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

LOG: Include <optional> instead of "llvm/ADT/Optional.h"

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: 
    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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/Config.h b/clang-tools-extra/clangd/Config.h
index 7123a900f4175..cbc9c79a66249 100644
--- a/clang-tools-extra/clangd/Config.h
+++ b/clang-tools-extra/clangd/Config.h
@@ -26,10 +26,10 @@
 
 #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>
 

diff  --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h
index ab3e12216d984..c1e5c6d2853bd 100644
--- a/llvm/include/llvm/Support/Allocator.h
+++ b/llvm/include/llvm/Support/Allocator.h
@@ -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 {

diff  --git a/llvm/include/llvm/Support/FormatProviders.h b/llvm/include/llvm/Support/FormatProviders.h
index 3fcd1b38a9675..44da741b456e9 100644
--- a/llvm/include/llvm/Support/FormatProviders.h
+++ b/llvm/include/llvm/Support/FormatProviders.h
@@ -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 {

diff  --git a/llvm/include/llvm/Support/NativeFormatting.h b/llvm/include/llvm/Support/NativeFormatting.h
index 6fc1ee8d190ef..ab85ae20161c2 100644
--- a/llvm/include/llvm/Support/NativeFormatting.h
+++ b/llvm/include/llvm/Support/NativeFormatting.h
@@ -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;

diff  --git a/llvm/include/llvm/Support/VersionTuple.h b/llvm/include/llvm/Support/VersionTuple.h
index 1483252f4f7da..1118754f7fd46 100644
--- a/llvm/include/llvm/Support/VersionTuple.h
+++ b/llvm/include/llvm/Support/VersionTuple.h
@@ -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>
 

diff  --git a/llvm/include/llvm/Support/VirtualFileSystem.h b/llvm/include/llvm/Support/VirtualFileSystem.h
index 71dbc80edf9a5..3ef17a7de379d 100644
--- a/llvm/include/llvm/Support/VirtualFileSystem.h
+++ b/llvm/include/llvm/Support/VirtualFileSystem.h
@@ -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>

diff  --git a/llvm/lib/Support/OptimizedStructLayout.cpp b/llvm/lib/Support/OptimizedStructLayout.cpp
index c64eff60c0b12..7b21f927a3462 100644
--- a/llvm/lib/Support/OptimizedStructLayout.cpp
+++ b/llvm/lib/Support/OptimizedStructLayout.cpp
@@ -11,7 +11,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/OptimizedStructLayout.h"
-#include "llvm/ADT/Optional.h"
+#include <optional>
 
 using namespace llvm;
 

diff  --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
index f4e3331a4b9b1..923935bbca103 100644
--- a/llvm/lib/Support/Threading.cpp
+++ b/llvm/lib/Support/Threading.cpp
@@ -12,12 +12,12 @@
 //===----------------------------------------------------------------------===//
 
 #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>
 


        


More information about the llvm-commits mailing list