diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-05-04 04:08:02 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-05-04 04:08:02 +0000 |
commit | 2e013028f2dd99527044d50808a44ae89d6ba537 (patch) | |
tree | 9e3d766197ee52b31ad1c26ba5ad60825fed1cd0 /lib/Linker | |
parent | c7c35a9b8692ca7ac7a6b4b3f46ddb234ae159c7 (diff) | |
download | external_llvm-2e013028f2dd99527044d50808a44ae89d6ba537.zip external_llvm-2e013028f2dd99527044d50808a44ae89d6ba537.tar.gz external_llvm-2e013028f2dd99527044d50808a44ae89d6ba537.tar.bz2 |
Implement Linker::LinkModules with Linker::linkInModule.
Flipping which one is the implementation will let us optimize linkInModule.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181102 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 161c269..9801966 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -1287,7 +1287,13 @@ Linker::~Linker() { } bool Linker::linkInModule(Module *Src, unsigned Mode, std::string *ErrorMsg) { - return LinkModules(Composite, Src, Linker::DestroySource, ErrorMsg); + ModuleLinker TheLinker(Composite, Src, Mode); + if (TheLinker.run()) { + if (ErrorMsg) + *ErrorMsg = TheLinker.ErrorMsg; + return true; + } + return false; } //===----------------------------------------------------------------------===// @@ -1301,13 +1307,8 @@ bool Linker::linkInModule(Module *Src, unsigned Mode, std::string *ErrorMsg) { /// and shouldn't be relied on to be consistent. bool Linker::LinkModules(Module *Dest, Module *Src, unsigned Mode, std::string *ErrorMsg) { - ModuleLinker TheLinker(Dest, Src, Mode); - if (TheLinker.run()) { - if (ErrorMsg) *ErrorMsg = TheLinker.ErrorMsg; - return true; - } - - return false; + Linker L(Dest); + return L.linkInModule(Src, Mode, ErrorMsg); } //===----------------------------------------------------------------------===// |