[Support] Use std::optional in InstructionCost.h (NFC)
authorKazu Hirata <kazu@google.com>
Sun, 27 Nov 2022 22:16:09 +0000 (14:16 -0800)
committerKazu Hirata <kazu@google.com>
Sun, 27 Nov 2022 22:16:09 +0000 (14:16 -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

llvm/include/llvm/Support/InstructionCost.h

index aa8825e..8427235 100644 (file)
@@ -21,6 +21,7 @@
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/MathExtras.h"
 #include <limits>
+#include <optional>
 
 namespace llvm {
 
@@ -84,7 +85,7 @@ public:
   /// This function is intended to be used as sparingly as possible, since the
   /// class provides the full range of operator support required for arithmetic
   /// and comparisons.
-  Optional<CostType> getValue() const {
+  std::optional<CostType> getValue() const {
     if (isValid())
       return Value;
     return None;