diff options
author | Tanya Lattner <tonic@nondot.org> | 2011-10-11 00:24:54 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2011-10-11 00:24:54 +0000 |
commit | f1f1a4f16128ffa2910f0b1d5c7052b3697f9fcd (patch) | |
tree | 8cff133c6dd3061600643273205cae6d25b9ace9 /include | |
parent | fad138dd79d025229433c9de90108df4eb81f4af (diff) |
Make it possible to use the linker without destroying the source module. This is so the source module can be linked to multiple other destination modules. For all that used LinkModules() before, they will continue to destroy the source module as before.
This line, and those below, will be ignored--
M include/llvm/Linker.h
M tools/bugpoint/Miscompilation.cpp
M tools/bugpoint/BugDriver.cpp
M tools/llvm-link/llvm-link.cpp
M lib/Linker/LinkModules.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141606 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Linker.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/llvm/Linker.h b/include/llvm/Linker.h index b402a6090e..88908fbd72 100644 --- a/include/llvm/Linker.h +++ b/include/llvm/Linker.h @@ -57,7 +57,12 @@ class Linker { QuietWarnings = 2, ///< Don't print warnings to stderr. QuietErrors = 4 ///< Don't print errors to stderr. }; - + + enum LinkerMode { + DestroySource = 0, // Allow source module to be destroyed. + PreserveSource = 1 // Preserve the source module. + }; + /// @} /// @name Constructors /// @{ @@ -245,7 +250,7 @@ class Linker { Module* Src, ///< Module linked into \p Dest std::string* ErrorMsg = 0 /// Error/diagnostic string ) { - return LinkModules(Composite, Src, ErrorMsg ); + return LinkModules(Composite, Src, Linker::DestroySource, ErrorMsg ); } /// This is the heart of the linker. This method will take unconditional @@ -259,7 +264,8 @@ class Linker { /// error. /// @returns True if an error occurs, false otherwise. /// @brief Generically link two modules together. - static bool LinkModules(Module* Dest, Module* Src, std::string* ErrorMsg); + static bool LinkModules(Module* Dest, Module* Src, unsigned Mode, + std::string* ErrorMsg); /// This function looks through the Linker's LibPaths to find a library with /// the name \p Filename. If the library cannot be found, the returned path |