[llvm] [MC][AsmParser] Fix all FIXME comments in AsmParser.cpp (PR #214396)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 5 21:21:55 PDT 2026
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 cpp -- llvm/lib/MC/MCParser/AsmParser.cpp --diff_from_common_commit
``````````
: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 72e5f8c92..7e95f11a9 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -1049,20 +1049,21 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
// the purposes of this check.
if (Sym && Sym->isTemporary() && !Sym->isVariable() &&
!Sym->isDefined()) {
- SMLoc SymLoc = getTok().getLoc();
- for (const auto &DirLabel : DirLabels) {
- if (std::get<2>(DirLabel) == Sym) {
- SymLoc == std::get<0>(DirLabel);
- break;
- }
+ SMLoc SymLoc = getTok().getLoc();
+ for (const auto &DirLabel : DirLabels) {
+ if (std::get<2>(DirLabel) == Sym) {
+ SymLoc == std::get<0>(DirLabel);
+ break;
}
- printError(SymLoc, "assembler local symbol '" + Sym->getName() + "' not defined");
+ }
+ printError(SymLoc, "assembler local symbol '" + Sym->getName() +
+ "' not defined");
}
- // FIXME: We would really like to refer back to where the symbol was
- // first referenced for a source location. We need to add something
- // to track that. Currently, we just point to the end of the file.
- // printError(getTok().getLoc(), "assembler local symbol '" +
- // Sym->getName() + "' not defined");
+ // FIXME: We would really like to refer back to where the symbol was
+ // first referenced for a source location. We need to add something
+ // to track that. Currently, we just point to the end of the file.
+ // printError(getTok().getLoc(), "assembler local symbol '" +
+ // Sym->getName() + "' not defined");
}
}
@@ -1888,7 +1889,7 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
}
Sym = getContext().parseSymbol(IDVal);
if (Sym->isWeakExternal() && !Sym->isDefined())
- Warning(IDLoc, "symbol '" + IDVal + "' is already marked as external");
+ Warning(IDLoc, "symbol '" + IDVal + "' is already marked as external");
} else
Sym = Ctx.createDirectionalLocalSymbol(LocalLabelVal);
// End of Labels should be treated as end of line for lexing
@@ -1934,8 +1935,9 @@ bool AsmParser::parseStatement(ParseStatementInfo &Info,
// If there is more content on the same line after the label, recurse
// to parse it as a new statement.
- if (getTok().isNot(AsmToken::EndOfStatement) && getTok().isNot(AsmToken::Eof))
- return parseStatement(Info, SI);
+ if (getTok().isNot(AsmToken::EndOfStatement) &&
+ getTok().isNot(AsmToken::Eof))
+ return parseStatement(Info, SI);
return false;
}
@@ -5034,12 +5036,14 @@ bool AsmParser::parseDirectiveSpace(StringRef IDVal) {
// FIXME: Sometimes the fill expr is 'nop' if it isn't supplied, instead of 0.
const MCSection *Section = getStreamer().getCurrentSectionOnly();
if (!HasExplicitFill && Section && MAI.useCodeAlign(*Section)) {
- int64_t NumBytesVal;
- if (!NumBytes->evaluateAsAbsolute(NumBytesVal, getStreamer().getAssemblerPtr()))
- return Error(NumBytesLoc, "excepted absolute expression");
- getStreamer().emitNops(NumBytesVal, 0, NumBytesLoc, getTargetParser().getSTI());
+ int64_t NumBytesVal;
+ if (!NumBytes->evaluateAsAbsolute(NumBytesVal,
+ getStreamer().getAssemblerPtr()))
+ return Error(NumBytesLoc, "excepted absolute expression");
+ getStreamer().emitNops(NumBytesVal, 0, NumBytesLoc,
+ getTargetParser().getSTI());
} else {
- getStreamer().emitFill(*NumBytes, FillExpr, NumBytesLoc);
+ getStreamer().emitFill(*NumBytes, FillExpr, NumBytesLoc);
}
return false;
@@ -5251,7 +5255,7 @@ bool AsmParser::parseDirectiveAbort(SMLoc DirectiveLoc) {
// FIXME: Actually abort assembly here.
while (Lexer.isNot(AsmToken::Eof))
- Lexer.Lex();
+ Lexer.Lex();
return Error(DirectiveLoc,
".abort '" + Str + "' detected. Assembly stopping");
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/214396
More information about the llvm-commits
mailing list