forked from OSchip/llvm-project
Implement Linker::LinkModules with Linker::linkInModule.
Flipping which one is the implementation will let us optimize linkInModule. llvm-svn: 181102
This commit is contained in:
parent
17fbf6edc2
commit
287f18b4b8
|
@ -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);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue