[AsmParser] Use std::optional in AArch64AsmParser.cpp (NFC)
authorKazu Hirata <kazu@google.com>
Sat, 26 Nov 2022 06:14:44 +0000 (22:14 -0800)
committerKazu Hirata <kazu@google.com>
Sat, 26 Nov 2022 06:14:44 +0000 (22:14 -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/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp

index 9cf92e7..895748e 100644 (file)
@@ -55,6 +55,7 @@
 #include <cctype>
 #include <cstdint>
 #include <cstdio>
+#include <optional>
 #include <string>
 #include <tuple>
 #include <utility>
@@ -938,7 +939,7 @@ public:
   /// a shifted immediate by value 'Shift' or '0', or if it is an unshifted
   /// immediate that can be shifted by 'Shift'.
   template <unsigned Width>
-  Optional<std::pair<int64_t, unsigned> > getShiftedVal() const {
+  std::optional<std::pair<int64_t, unsigned>> getShiftedVal() const {
     if (isShiftedImm() && Width == getShiftedImmShift())
       if (auto *CE = dyn_cast<MCConstantExpr>(getShiftedImmVal()))
         return std::make_pair(CE->getValue(), Width);