[llvm] [LLVM][AArch64] Build attributes: Support switching to a defined subsection by name only (PR #154159)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 19 07:51:07 PDT 2025
================
@@ -7925,7 +7927,25 @@ bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) {
return true;
}
Parser.Lex();
- // consume a comma
+
+ // Check whether only the subsection name was provided.
----------------
smithp35 wrote:
I think you can simplify the change by moving the call to SubsectionExists here. This can supply the parameters for `emitAttributesSubsection` so you wouldn't need to change anything in the `AArch64TargetStreamer`.
```
std::unique_ptr<MCELFStreamer::AttributeSubSection> SubsectionExists =
getTargetStreamer().getAttributesSubsectionByName(SubsectionName);
if (Parser.getTok().is(llvm::AsmToken::EndOfStatement)) {
if (SubsectionExists) {
getTargetStreamer().emitAttributesSubsection(SubsectionName, SubsectionExists->IsOptional, SubsectionExists->Type);
return false;
}
else {
Error(Parser.getTok().getLoc(),
"Could not switch to subsection '" + SubsectionName +
"' using subsection name, subsection has not been defined");
return true;
}
}
// Otherwise, expecting 2 more parameters: consume a comma
```
https://github.com/llvm/llvm-project/pull/154159
More information about the llvm-commits
mailing list