[llvm] c0c5ffa - [ADT] Use std::optional in TypeSwitch.h (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 27 11:49:17 PST 2022


Author: Kazu Hirata
Date: 2022-11-27T11:48:57-08:00
New Revision: c0c5ffad4344c9b611b4166313b574c8ca9e20b4

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

LOG: [ADT] Use std::optional in TypeSwitch.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/TypeSwitch.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/TypeSwitch.h b/llvm/include/llvm/ADT/TypeSwitch.h
index cf58808eb485..044b2432b824 100644
--- a/llvm/include/llvm/ADT/TypeSwitch.h
+++ b/llvm/include/llvm/ADT/TypeSwitch.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Casting.h"
+#include <optional>
 
 namespace llvm {
 namespace detail {
@@ -145,7 +146,7 @@ class TypeSwitch : public detail::TypeSwitchBase<TypeSwitch<T, ResultT>, T> {
 private:
   /// The pointer to the result of this switch statement, once known,
   /// null before that.
-  Optional<ResultT> result;
+  std::optional<ResultT> result;
 };
 
 /// Specialization of TypeSwitch for void returning callables.


        


More information about the llvm-commits mailing list