[llvm] dd436d3 - [ADT] Use std::optional in StringSwitch.h (NFC)

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


Author: Kazu Hirata
Date: 2022-11-27T11:48:55-08:00
New Revision: dd436d3cff53db0c64cc4ef5a671b7985917130e

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

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/StringSwitch.h b/llvm/include/llvm/ADT/StringSwitch.h
index 6ba75eba9b2e0..199b155087a72 100644
--- a/llvm/include/llvm/ADT/StringSwitch.h
+++ b/llvm/include/llvm/ADT/StringSwitch.h
@@ -18,6 +18,7 @@
 #include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <cstring>
+#include <optional>
 
 namespace llvm {
 
@@ -47,7 +48,7 @@ class StringSwitch {
 
   /// The pointer to the result of this switch statement, once known,
   /// null before that.
-  Optional<T> Result;
+  std::optional<T> Result;
 
 public:
   explicit StringSwitch(StringRef S)


        


More information about the llvm-commits mailing list