Factor common code it Linker::init.

The TypeFinder was not being used in one of the constructors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222172 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-11-17 20:51:01 +00:00
parent dfeee31cac
commit c4fe4e9681
4 changed files with 35 additions and 6 deletions

View File

@@ -1594,18 +1594,25 @@ bool ModuleLinker::run() {
return false;
}
Linker::Linker(Module *M, DiagnosticHandlerFunction DiagnosticHandler)
: Composite(M), DiagnosticHandler(DiagnosticHandler) {}
void Linker::init(Module *M, DiagnosticHandlerFunction DiagnosticHandler) {
this->Composite = M;
this->DiagnosticHandler = DiagnosticHandler;
Linker::Linker(Module *M)
: Composite(M), DiagnosticHandler([this](const DiagnosticInfo &DI) {
Composite->getContext().diagnose(DI);
}) {
TypeFinder StructTypes;
StructTypes.run(*M, true);
IdentifiedStructTypes.insert(StructTypes.begin(), StructTypes.end());
}
Linker::Linker(Module *M, DiagnosticHandlerFunction DiagnosticHandler) {
init(M, DiagnosticHandler);
}
Linker::Linker(Module *M) {
init(M, [this](const DiagnosticInfo &DI) {
Composite->getContext().diagnose(DI);
});
}
Linker::~Linker() {
}