[llvm] [MC][ARM] Fix crash when assembling Thumb 'movs r0, #foo'. (PR #115026)

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 07:29:34 PST 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 a256e89fd1b9f42d3f29df42d4f21ea823476ff3 bd0cf26632efee6505ade6b9bffdbbeb439e1e5f --extensions cpp -- llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
``````````

</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 448a6a92e7..0dc637fc08 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -10724,8 +10724,9 @@ bool ARMAsmParser::processInstruction(MCInst &Inst,
       if ((unsigned)Inst.getOperand(2).getImm() > 255)
         break; // large immediate that tADDi8 can't contain
     } else {
-      int i = (Operands[MnemonicOpsEndInd + 1]->isImm()) ? MnemonicOpsEndInd + 1
-        : MnemonicOpsEndInd + 2;
+      int i = (Operands[MnemonicOpsEndInd + 1]->isImm())
+                  ? MnemonicOpsEndInd + 1
+                  : MnemonicOpsEndInd + 2;
       MCParsedAsmOperand &Op = *Operands[i];
       if (isARMMCExpr(Op) && !isThumbI8Relocation(Op))
         break; // a type of non-immediate that tADDi8 can't represent

``````````

</details>


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


More information about the llvm-commits mailing list