[llvm] [ARM] FIX: change `pkhtb` custom parsing produce NoMatch rather than Error (PR #85765)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 04:50:57 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 953c13b5c90bed1e24fe95e90137c4e226ac2d09 b33f00d515b75185a4e3043844dd5bdd2e9ca1bf -- llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp llvm/lib/Target/ARM/MCTargetDesc/ARMAddressingModes.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index a9bebc8465..f2e710f06c 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -649,7 +649,8 @@ class ARMAsmParser : public MCTargetAsmParser {
   ParseStatus parseProcIFlagsOperand(OperandVector &);
   ParseStatus parseMSRMaskOperand(OperandVector &);
   ParseStatus parseBankedRegOperand(OperandVector &);
-  ParseStatus parsePKHImm(OperandVector &O, ARM_AM::ShiftOpc, int Low, int High);
+  ParseStatus parsePKHImm(OperandVector &O, ARM_AM::ShiftOpc, int Low,
+                          int High);
   ParseStatus parsePKHLSLImm(OperandVector &O) {
     return parsePKHImm(O, ARM_AM::lsl, 0, 31);
   }
@@ -4235,7 +4236,7 @@ std::optional<ARM_AM::ShiftOpc> ARMAsmParser::tryParseShiftToken() {
   const AsmToken &Tok = Parser.getTok();
   if (Tok.isNot(AsmToken::Identifier))
     return std::nullopt;
-  
+
   std::string lowerCase = Tok.getString().lower();
   return StringSwitch<std::optional<ARM_AM::ShiftOpc>>(lowerCase)
       .Case("asl", ARM_AM::lsl)
@@ -4326,7 +4327,6 @@ int ARMAsmParser::tryParseShiftRegister(OperandVector &Operands) {
     }
   }
 
-
   if (ShiftReg && ShiftTy != ARM_AM::rrx)
     Operands.push_back(ARMOperand::CreateShiftedRegister(ShiftTy, SrcReg,
                                                          ShiftReg, Imm,
@@ -5296,8 +5296,8 @@ ParseStatus ARMAsmParser::parseBankedRegOperand(OperandVector &Operands) {
 // FIXME: Unify the different methods for handling shift operators
 // and use TableGen matching mechanisms to do the validation rather than
 // separate parsing paths.
-ParseStatus ARMAsmParser::parsePKHImm(OperandVector &Operands, ARM_AM::ShiftOpc Op,
-                                      int Low, int High) {
+ParseStatus ARMAsmParser::parsePKHImm(OperandVector &Operands,
+                                      ARM_AM::ShiftOpc Op, int Low, int High) {
   MCAsmParser &Parser = getParser();
   auto ShiftCodeOpt = tryParseShiftToken();
 
@@ -5305,9 +5305,11 @@ ParseStatus ARMAsmParser::parsePKHImm(OperandVector &Operands, ARM_AM::ShiftOpc
     return ParseStatus::NoMatch;
   auto ShiftCode = ShiftCodeOpt.value();
 
-  // The wrong shift code has been provided. Can error here as has matched the correct operand in this case.
+  // The wrong shift code has been provided. Can error here as has matched the
+  // correct operand in this case.
   if (ShiftCode != Op)
-    return Error(Parser.getTok().getLoc(),  ARM_AM::getShiftOpcStr(Op) + " operand expected.");
+    return Error(Parser.getTok().getLoc(),
+                 ARM_AM::getShiftOpcStr(Op) + " operand expected.");
 
   Parser.Lex(); // Eat shift type token.
 
@@ -6330,7 +6332,7 @@ bool ARMAsmParser::parseOperand(OperandVector &Operands, StringRef Mnemonic) {
       E = SMLoc::getFromPointer(Parser.getTok().getLoc().getPointer() - 1);
       Operands.push_back(ARMOperand::CreateImm(ImmVal, S, E));
 
-      // There can be a trailing '!' on operands that we want as a 
+      // There can be a trailing '!' on operands that we want as a
       // '!' Token operand. Handle that here. For example, the compatibility
       // alias for 'srsdb sp!, #imm' is 'srsdb #imm!'.
       if (Parser.getTok().is(AsmToken::Exclaim)) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/85765


More information about the llvm-commits mailing list