[llvm] r181102 - Implement Linker::LinkModules with Linker::linkInModule.
Rafael Espindola
rafael.espindola at gmail.com
Fri May 3 21:08:02 PDT 2013
Author: rafael
Date: Fri May 3 23:08:02 2013
New Revision: 181102
URL: http://llvm.org/viewvc/llvm-project?rev=181102&view=rev
Log:
Implement Linker::LinkModules with Linker::linkInModule.
Flipping which one is the implementation will let us optimize linkInModule.
Modified:
llvm/trunk/lib/Linker/LinkModules.cpp
Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=181102&r1=181101&r2=181102&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Fri May 3 23:08:02 2013
@@ -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, u
/// 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);
}
//===----------------------------------------------------------------------===//
More information about the llvm-commits
mailing list