[llvm] fc07a54 - [AsmParser] Use std::optional in AArch64AsmParser.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 22:14:50 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T22:14:44-08:00
New Revision: fc07a54ef674365a934a1c880f24c2e5145b25cb

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

LOG: [AsmParser] Use std::optional in AArch64AsmParser.cpp (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/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
index 9cf92e7171204..895748e9d83cc 100644
--- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -55,6 +55,7 @@
 #include <cctype>
 #include <cstdint>
 #include <cstdio>
+#include <optional>
 #include <string>
 #include <tuple>
 #include <utility>
@@ -938,7 +939,7 @@ class AArch64Operand : public MCParsedAsmOperand {
   /// 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);


        


More information about the llvm-commits mailing list