Use a forwarding constructor instead of an init method.

llvm-svn: 254435
This commit is contained in:
Rafael Espindola 2015-12-01 18:46:19 +00:00
parent 4808c6d064
commit 4dbdceb6fc
2 changed files with 5 additions and 11 deletions

View File

@ -93,7 +93,6 @@ public:
unsigned Flags = Flags::None);
private:
void init(Module *M, DiagnosticHandlerFunction DiagnosticHandler);
Module *Composite;
IdentifiedStructTypeSet IdentifiedStructTypes;

View File

@ -2032,7 +2032,7 @@ bool Linker::IdentifiedStructTypeSet::hasType(StructType *Ty) {
return *I == Ty;
}
void Linker::init(Module *M, DiagnosticHandlerFunction DiagnosticHandler) {
Linker::Linker(Module *M, DiagnosticHandlerFunction DiagnosticHandler) {
this->Composite = M;
this->DiagnosticHandler = DiagnosticHandler;
@ -2046,15 +2046,10 @@ void Linker::init(Module *M, DiagnosticHandlerFunction DiagnosticHandler) {
}
}
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(Module *M)
: Linker(M, [this](const DiagnosticInfo &DI) {
Composite->getContext().diagnose(DI);
}) {}
void Linker::deleteModule() {
delete Composite;