[lld] [llvm] [readobj][Arm][AArch64] Refactor Build Attributes parsing under ELFAtributeParser and add support for AArch64 Build Attributes (PR #128727)

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 5 06:01:53 PST 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 d21b2e619a5e23fd2f4cb05f5929990ee517d164 11dcb95cb7a79e53e10d8b4220723c036114c3d4 --extensions cpp,h -- llvm/include/llvm/Support/AArch64AttributeParser.h llvm/include/llvm/Support/ELFAttrParserCompact.h llvm/include/llvm/Support/ELFAttrParserExtended.h llvm/lib/Support/AArch64AttributeParser.cpp llvm/lib/Support/ELFAttrParserExtended.cpp llvm/include/llvm/Object/ELFObjectFile.h llvm/include/llvm/Support/AArch64BuildAttributes.h llvm/include/llvm/Support/ARMAttributeParser.h llvm/include/llvm/Support/CSKYAttributeParser.h llvm/include/llvm/Support/ELFAttributeParser.h llvm/include/llvm/Support/ELFAttributes.h llvm/include/llvm/Support/HexagonAttributeParser.h llvm/include/llvm/Support/MSP430AttributeParser.h llvm/include/llvm/Support/RISCVAttributeParser.h llvm/lib/Support/AArch64BuildAttributes.cpp llvm/lib/Support/CSKYAttributeParser.cpp llvm/lib/Support/HexagonAttributeParser.cpp llvm/lib/Support/RISCVAttributeParser.cpp llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h llvm/tools/llvm-readobj/ELFDumper.cpp llvm/unittests/Support/ARMAttributeParser.cpp llvm/unittests/Support/CSKYAttributeParserTest.cpp llvm/unittests/Support/ELFAttributeParserTest.cpp llvm/unittests/Support/RISCVAttributeParserTest.cpp llvm/lib/Support/ELFAttrParserCompact.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/include/llvm/Support/AArch64AttributeParser.h b/llvm/include/llvm/Support/AArch64AttributeParser.h
index ea918d7505..823ae180a5 100644
--- a/llvm/include/llvm/Support/AArch64AttributeParser.h
+++ b/llvm/include/llvm/Support/AArch64AttributeParser.h
@@ -15,7 +15,7 @@
 namespace llvm {
 
 class AArch64AttributeParser : public ELFExtendedAttrParser {
-  static std::vector<SubsectionAndTagToTagName>& returnTagsNamesMap();
+  static std::vector<SubsectionAndTagToTagName> &returnTagsNamesMap();
 
 public:
   AArch64AttributeParser(ScopedPrinter *Sw)
diff --git a/llvm/include/llvm/Support/ELFAttrParserExtended.h b/llvm/include/llvm/Support/ELFAttrParserExtended.h
index 31e88fe9aa..c122a13e9b 100644
--- a/llvm/include/llvm/Support/ELFAttrParserExtended.h
+++ b/llvm/include/llvm/Support/ELFAttrParserExtended.h
@@ -42,10 +42,12 @@ public:
   std::optional<StringRef> getAttributeString(StringRef BuildAttrSubsectionName,
                                               unsigned Tag) const override;
 
-  ELFExtendedAttrParser(ScopedPrinter *Sw,
-                        const std::vector<SubsectionAndTagToTagName> TagsNamesMap)
+  ELFExtendedAttrParser(
+      ScopedPrinter *Sw,
+      const std::vector<SubsectionAndTagToTagName> TagsNamesMap)
       : Sw(Sw), TagsNamesMap(TagsNamesMap) {}
-  ELFExtendedAttrParser(const std::vector<SubsectionAndTagToTagName> TagsNamesMap)
+  ELFExtendedAttrParser(
+      const std::vector<SubsectionAndTagToTagName> TagsNamesMap)
       : Sw(nullptr), TagsNamesMap(TagsNamesMap) {}
 };
 } // namespace llvm
diff --git a/llvm/lib/Support/AArch64AttributeParser.cpp b/llvm/lib/Support/AArch64AttributeParser.cpp
index 989a62de38..c675ef2a3b 100644
--- a/llvm/lib/Support/AArch64AttributeParser.cpp
+++ b/llvm/lib/Support/AArch64AttributeParser.cpp
@@ -9,13 +9,13 @@
 
 #include "llvm/Support/AArch64AttributeParser.h"
 
-std::vector<llvm::SubsectionAndTagToTagName>&
+std::vector<llvm::SubsectionAndTagToTagName> &
 llvm::AArch64AttributeParser::returnTagsNamesMap() {
   static std::vector<SubsectionAndTagToTagName> TagsNamesMap = {
-    {"aeabi_pauthabi", 1, "Tag_PAuth_Platform"},
-    {"aeabi_pauthabi", 2, "Tag_PAuth_Schema"},
-    {"aeabi_feature_and_bits", 0, "Tag_Feature_BTI"},
-    {"aeabi_feature_and_bits", 1, "Tag_Feature_PAC"},
-    {"aeabi_feature_and_bits", 2, "Tag_Feature_GCS"}};
-return TagsNamesMap;
+      {"aeabi_pauthabi", 1, "Tag_PAuth_Platform"},
+      {"aeabi_pauthabi", 2, "Tag_PAuth_Schema"},
+      {"aeabi_feature_and_bits", 0, "Tag_Feature_BTI"},
+      {"aeabi_feature_and_bits", 1, "Tag_Feature_PAC"},
+      {"aeabi_feature_and_bits", 2, "Tag_Feature_GCS"}};
+  return TagsNamesMap;
 }

``````````

</details>


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


More information about the llvm-commits mailing list