[lld] [LLD] Add CLASS syntax to SECTIONS (PR #95323)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 15:51:07 PDT 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 c9d580033f29196223cd56a0fa238c3ba51d23e4 8435cd14c9a1977becc263df4bd2470d5f3ec334 -- lld/ELF/InputSection.cpp lld/ELF/InputSection.h lld/ELF/LinkerScript.cpp lld/ELF/LinkerScript.h lld/ELF/MapFile.cpp lld/ELF/OutputSections.h lld/ELF/ScriptParser.cpp
``````````

</details>

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

``````````diff
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 9b1066cf4b..02dadc1e0d 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -559,8 +559,8 @@ LinkerScript::computeInputSections(const InputSectionDescription *cmd,
           if (outCmd.name == "/DISCARD/")
             continue;
 
-          // Skip if the section was already matched by a different input section
-          // description within this output section or class.
+          // Skip if the section was already matched by a different input
+          // section description within this output section or class.
           if (sec->parent == &outCmd)
             continue;
 
@@ -579,7 +579,8 @@ LinkerScript::computeInputSections(const InputSectionDescription *cmd,
       // --sort-section, input order), where SORT* (if present) is most
       // significant.
       //
-      // Matched sections between the previous SORT* and this SORT* are sorted by
+      // Matched sections between the previous SORT* and this SORT* are sorted
+      // by
       // (--sort-alignment, input order).
       sortByPositionThenCommandLine(sizeAfterPrevSort, sizeBeforeCurrPat);
       // Matched sections by this SORT* pattern are sorted using all 3 keys.
diff --git a/lld/ELF/LinkerScript.h b/lld/ELF/LinkerScript.h
index e96cdc2043..a6bbc10197 100644
--- a/lld/ELF/LinkerScript.h
+++ b/lld/ELF/LinkerScript.h
@@ -80,7 +80,7 @@ enum SectionsCommandKind {
   AssignmentKind, // . = expr or <sym> = expr
   OutputSectionKind,
   InputSectionKind,
-  ByteKind,   // BYTE(expr), SHORT(expr), LONG(expr) or QUAD(expr)
+  ByteKind, // BYTE(expr), SHORT(expr), LONG(expr) or QUAD(expr)
   ClassKind,
 };
 
@@ -298,8 +298,7 @@ class LinkerScript final {
 
   SmallVector<InputSectionBase *, 0>
   computeInputSections(const InputSectionDescription *,
-                       ArrayRef<InputSectionBase *>,
-                       const SectionBase &outCmd);
+                       ArrayRef<InputSectionBase *>, const SectionBase &outCmd);
 
   SmallVector<InputSectionBase *, 0> createInputSectionList(OutputSection &cmd);
 
@@ -427,7 +426,7 @@ public:
   // Named lists of input sections that can be collectively referenced in output
   // section descriptions. Multiple references allow for sections to spill from
   // one output section to another.
-  llvm::StringMap<SectionClassDesc*> sectionClasses;
+  llvm::StringMap<SectionClassDesc *> sectionClasses;
 };
 
 struct ScriptWrapper {
diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h
index e77f774556..c5f03cb8d8 100644
--- a/lld/ELF/OutputSections.h
+++ b/lld/ELF/OutputSections.h
@@ -153,9 +153,7 @@ struct SectionClassDesc : SectionCommand {
 
   SectionClassDesc(StringRef name) : SectionCommand(ClassKind), sc(name) {}
 
-  static bool classof(const SectionCommand *c) {
-    return c->kind == ClassKind;
-  }
+  static bool classof(const SectionCommand *c) { return c->kind == ClassKind; }
 };
 
 int getPriority(StringRef s);

``````````

</details>


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


More information about the llvm-commits mailing list