diff options
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm-c/Linker.h | 22 | ||||
-rw-r--r-- | llvm/include/llvm/Linker/Linker.h | 13 |
2 files changed, 24 insertions, 11 deletions
diff --git a/llvm/include/llvm-c/Linker.h b/llvm/include/llvm-c/Linker.h index 9f98a3342d0..94b65886d35 100644 --- a/llvm/include/llvm-c/Linker.h +++ b/llvm/include/llvm-c/Linker.h @@ -27,17 +27,27 @@ typedef enum { should not be used. */ } LLVMLinkerMode; -/* Links the source module into the destination module, taking ownership - * of the source module away from the caller. Optionally returns a - * human-readable description of any errors that occurred in linking. - * OutMessage must be disposed with LLVMDisposeMessage. The return value - * is true if an error occurred, false otherwise. +/* Links the source module into the destination module. The source module is + * damaged. The only thing that can be done is destroy it. Optionally returns a + * human-readable description of any errors that occurred in linking. OutMessage + * must be disposed with LLVMDisposeMessage. The return value is true if an + * error occurred, false otherwise. * * Note that the linker mode parameter \p Unused is no longer used, and has - * no effect. */ + * no effect. + * + * This function is deprecated. Use LLVMLinkModules2 instead. + */ LLVMBool LLVMLinkModules(LLVMModuleRef Dest, LLVMModuleRef Src, LLVMLinkerMode Unused, char **OutMessage); +/* Links the source module into the destination module. The source module is + * destroyed. + * The return value is true if an error occurred, false otherwise. + * Use the diagnostic handler to get any diagnostic message. +*/ +LLVMBool LLVMLinkModules2(LLVMModuleRef Dest, LLVMModuleRef Src); + #ifdef __cplusplus } #endif diff --git a/llvm/include/llvm/Linker/Linker.h b/llvm/include/llvm/Linker/Linker.h index 26c27c3aae8..eca0e9321a1 100644 --- a/llvm/include/llvm/Linker/Linker.h +++ b/llvm/include/llvm/Linker/Linker.h @@ -35,7 +35,7 @@ public: Linker(Module &M); - /// \brief Link \p Src into the composite. The source is destroyed. + /// \brief Link \p Src into the composite. /// /// Passing OverrideSymbols as true will have symbols from Src /// shadow those in the Dest. @@ -44,18 +44,21 @@ public: /// are part of the set will be imported from the source module. /// /// Returns true on error. - bool linkInModule(Module &Src, unsigned Flags = Flags::None, + bool linkInModule(std::unique_ptr<Module> Src, unsigned Flags = Flags::None, const FunctionInfoIndex *Index = nullptr, DenseSet<const GlobalValue *> *FunctionsToImport = nullptr); - static bool linkModules(Module &Dest, Module &Src, - unsigned Flags = Flags::None); + /// This exists to implement the deprecated LLVMLinkModules C api. Don't use + /// for anything else. + bool linkInModuleForCAPI(Module &Src); + static bool linkModules(Module &Dest, std::unique_ptr<Module> Src, + unsigned Flags = Flags::None); }; /// Create a new module with exported local functions renamed and promoted /// for ThinLTO. -std::unique_ptr<Module> renameModuleForThinLTO(std::unique_ptr<Module> &M, +std::unique_ptr<Module> renameModuleForThinLTO(std::unique_ptr<Module> M, const FunctionInfoIndex *Index); } // End llvm namespace |