[lld] [lld][COFF] Fix: Merge `.drectve` sections in ObjFile::readSections (PR #86380)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 22:57:36 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 65058a8d732c3c41664a4dad1a1ae2a504d5c98e bfaa3553a649d097ac48a46284c102bdf72a2ba2 -- lld/COFF/Driver.cpp lld/COFF/InputFiles.cpp lld/COFF/InputFiles.h
``````````

</details>

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

``````````diff
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 2336acd2eb..f26e355119 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -453,13 +453,13 @@ void LinkerDriver::parseDirectives(InputFile *file) {
         break;
       case OPT_stack:
         parseNumbers(arg->getValue(), &ctx.config.stackReserve,
-                    &ctx.config.stackCommit);
+                     &ctx.config.stackCommit);
         break;
       case OPT_subsystem: {
         bool gotVersion = false;
         parseSubsystem(arg->getValue(), &ctx.config.subsystem,
-                      &ctx.config.majorSubsystemVersion,
-                      &ctx.config.minorSubsystemVersion, &gotVersion);
+                       &ctx.config.majorSubsystemVersion,
+                       &ctx.config.minorSubsystemVersion, &gotVersion);
         if (gotVersion) {
           ctx.config.majorOSVersion = ctx.config.majorSubsystemVersion;
           ctx.config.minorOSVersion = ctx.config.minorSubsystemVersion;
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index ab63de2a5c..27112eede6 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -213,7 +213,8 @@ SectionChunk *ObjFile::readSection(uint32_t sectionNumber,
     ArrayRef<uint8_t> data;
     cantFail(coffObj->getSectionContents(sec, data));
     // MS link accumulates the directive sections in order of appearance
-    directives.push_back(StringRef(reinterpret_cast<const char*>(data.data()), data.size()));
+    directives.push_back(
+        StringRef(reinterpret_cast<const char *>(data.data()), data.size()));
     return nullptr;
   }
 
@@ -1087,7 +1088,7 @@ void BitcodeFile::parse() {
     if (objSym.isUsed())
       ctx.config.gcroot.push_back(sym);
   }
-//  directives.push_back(saver.save(obj->getCOFFLinkerOpts()).str());
+  //  directives.push_back(saver.save(obj->getCOFFLinkerOpts()).str());
   directives.push_back(obj->getCOFFLinkerOpts());
 }
 

``````````

</details>


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


More information about the llvm-commits mailing list