[llvm] [MC] Add parseSymbol() helper (NFC) (PR #158106)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 11 09:19:29 PDT 2025


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 origin/main HEAD --extensions h,cpp -- llvm/include/llvm/MC/MCParser/MCAsmParser.h llvm/lib/MC/MCParser/AsmParser.cpp llvm/lib/MC/MCParser/COFFAsmParser.cpp llvm/lib/MC/MCParser/COFFMasmParser.cpp llvm/lib/MC/MCParser/DarwinAsmParser.cpp llvm/lib/MC/MCParser/ELFAsmParser.cpp llvm/lib/MC/MCParser/MCAsmParser.cpp llvm/lib/MC/MCParser/MasmParser.cpp llvm/lib/MC/MCParser/WasmAsmParser.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index cec2afea9..5fa153979 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3880,11 +3880,9 @@ bool AsmParser::parseDirectiveCVLinetable() {
   SMLoc Loc = getTok().getLoc();
   if (parseCVFunctionId(FunctionId, ".cv_linetable") || parseComma() ||
       parseTokenLoc(Loc) ||
-      check(parseSymbol(FnStartSym), Loc,
-            "expected identifier in directive") ||
+      check(parseSymbol(FnStartSym), Loc, "expected identifier in directive") ||
       parseComma() || parseTokenLoc(Loc) ||
-      check(parseSymbol(FnEndSym), Loc,
-            "expected identifier in directive"))
+      check(parseSymbol(FnEndSym), Loc, "expected identifier in directive"))
     return true;
 
   getStreamer().emitCVLinetableDirective(FunctionId, FnStartSym, FnEndSym);
@@ -4306,8 +4304,7 @@ bool AsmParser::parseDirectiveCFIPersonalityOrLsda(bool IsPersonality) {
   MCSymbol *Sym;
   if (check(!isValidEncoding(Encoding), "unsupported encoding.") ||
       parseComma() ||
-      check(parseSymbol(Sym), "expected identifier in directive") ||
-      parseEOL())
+      check(parseSymbol(Sym), "expected identifier in directive") || parseEOL())
     return true;
 
   if (IsPersonality)
diff --git a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
index 189f8070d..fceb718d0 100644
--- a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
@@ -563,7 +563,8 @@ bool DarwinAsmParser::parseDirectiveIndirectSymbol(StringRef, SMLoc Loc) {
     return TokError("non-local symbol required in directive");
 
   if (!getStreamer().emitSymbolAttribute(Sym, MCSA_IndirectSymbol))
-    return TokError("unable to emit indirect symbol attribute for: " + Sym->getName());
+    return TokError("unable to emit indirect symbol attribute for: " +
+                    Sym->getName());
 
   if (getLexer().isNot(AsmToken::EndOfStatement))
     return TokError("unexpected token in '.indirect_symbol' directive");

``````````

</details>


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


More information about the llvm-commits mailing list