[lld] [llvm] [DTLTO][ELF][COFF] Add archive support for DTLTO. (PR #157043)
Konstantin Belochapka via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 9 20:59:46 PST 2025
================
@@ -0,0 +1,41 @@
+//===- DTLTO.h - Distributed ThinLTO functions and classes ----*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===---------------------------------------------------------------------===//
+
+#ifndef LLVM_DTLTO_H
+#define LLVM_DTLTO_H
+
+#include "llvm/LTO/LTO.h"
+#include "llvm/Support/MemoryBuffer.h"
+
+namespace llvm {
+namespace lto {
+
+class DTLTO : public LTO {
+public:
+ // Inherit contructors from LTO base class.
+ using LTO::LTO;
+ ~DTLTO() { removeTempFiles(); }
+
+ BumpPtrAllocator PtrAlloc;
+ StringSaver Saver{PtrAlloc};
+
+ // Remove temporary files.
+ LLVM_ABI void removeTempFiles();
+
+ // Array of input bitcode files for LTO.
+ std::vector<std::shared_ptr<lto::InputFile>> InputFiles;
+
+ LLVM_ABI virtual Expected<std::shared_ptr<lto::InputFile>>
+ addInput(std::unique_ptr<lto::InputFile> InputPtr) override;
+
+ LLVM_ABI virtual llvm::Error dtlto_process() override;
----------------
kbelochapka wrote:
Thanks, this will make the code cleaner. I have implemented all your suggestions in a last commit.
https://github.com/llvm/llvm-project/pull/157043
More information about the llvm-commits
mailing list