[lld] [llvm] [DTLTO][ELF][COFF][MachO] Add archive support for DTLTO. (PR #157043)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 5 01:16:16 PDT 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 origin/main HEAD --extensions h,cpp -- llvm/include/llvm/DTLTO/Dtlto.h llvm/lib/DTLTO/Dtlto.cpp lld/COFF/InputFiles.cpp lld/ELF/InputFiles.cpp lld/ELF/LTO.cpp lld/MachO/InputFiles.cpp llvm/include/llvm/Bitcode/BitcodeReader.h llvm/include/llvm/LTO/LTO.h llvm/lib/LTO/LTO.cpp
``````````

: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/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp
index 13e9c6349..5a8f9395b 100644
--- a/lld/ELF/LTO.cpp
+++ b/lld/ELF/LTO.cpp
@@ -202,8 +202,8 @@ BitcodeCompiler::BitcodeCompiler(Ctx &ctx) : ctx(ctx) {
                                       ctx.arg.ltoPartitions,
                                       ltoModes[ctx.arg.ltoKind]);
 
-  if(!ctx.arg.dtltoDistributor.empty())
-      ltoObj->Dtlto = true;
+  if (!ctx.arg.dtltoDistributor.empty())
+    ltoObj->Dtlto = true;
 
   // Initialize usedStartStop.
   if (ctx.bitcodeFiles.empty())
diff --git a/llvm/include/llvm/DTLTO/Dtlto.h b/llvm/include/llvm/DTLTO/Dtlto.h
index aa6af7d0c..b908abf83 100644
--- a/llvm/include/llvm/DTLTO/Dtlto.h
+++ b/llvm/include/llvm/DTLTO/Dtlto.h
@@ -14,8 +14,8 @@
 
 namespace dtlto {
 
-llvm::Expected<llvm::lto::InputFile*> addInput(llvm::lto::LTO *LtoObj,
-                               std::unique_ptr<llvm::lto::InputFile> Input);
+llvm::Expected<llvm::lto::InputFile *>
+addInput(llvm::lto::LTO *LtoObj, std::unique_ptr<llvm::lto::InputFile> Input);
 
 llvm::Error process(llvm::lto::LTO &LtoObj);
 } // namespace dtlto
diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h
index 7183a4429..195e9cc76 100644
--- a/llvm/include/llvm/LTO/LTO.h
+++ b/llvm/include/llvm/LTO/LTO.h
@@ -227,9 +227,12 @@ public:
   bool isThinLTO() const { return IsThinLTO; }
 
   // Store an archive path and a member name.
-  void setArchivePathAndName(StringRef Path, StringRef Name) { ArchivePath = Path; MemberName = Name; }
-  StringRef getArchivePath() const  { return ArchivePath; }
-  StringRef getMemberName() const  { return MemberName; }
+  void setArchivePathAndName(StringRef Path, StringRef Name) {
+    ArchivePath = Path;
+    MemberName = Name;
+  }
+  StringRef getArchivePath() const { return ArchivePath; }
+  StringRef getMemberName() const { return MemberName; }
 
 private:
   ArrayRef<Symbol> module_symbols(unsigned I) const {
diff --git a/llvm/lib/DTLTO/Dtlto.cpp b/llvm/lib/DTLTO/Dtlto.cpp
index 356f30188..b236d47ae 100644
--- a/llvm/lib/DTLTO/Dtlto.cpp
+++ b/llvm/lib/DTLTO/Dtlto.cpp
@@ -196,7 +196,7 @@ Error saveInputArchiveMember(lto::LTO &LtoObj, lto::InputFile *Input) {
 
 // Iterates through all ThinLTO-enabled input files and saves their content
 // to separate files if they are regular archive members.
-Error saveInputArchiveMembers(lto::LTO& LtoObj) {
+Error saveInputArchiveMembers(lto::LTO &LtoObj) {
   for (auto &Input : LtoObj.InputFiles) {
     if (!Input->isThinLTO())
       continue;

``````````

</details>


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


More information about the llvm-commits mailing list