std::unique_ptr<LLVMContext> OwnedContext;
LLVMContext &Context;
Linker IRLinker;
- TargetMachine *TargetMach = nullptr;
+ std::unique_ptr<TargetMachine> TargetMach;
bool EmitDwarfDebugInfo = false;
bool ScopeRestrictionsDone = false;
lto_codegen_model CodeModel = LTO_CODEGEN_PIC_MODEL_DEFAULT;
LTOCodeGenerator::~LTOCodeGenerator() {
destroyMergedModule();
-
- delete TargetMach;
- TargetMach = nullptr;
}
// Initialize LTO passes. Please keep this funciton in sync with
break;
}
- TargetMach = march->createTargetMachine(TripleStr, MCpu, FeatureStr, Options,
- RelocModel, CodeModel::Default,
- CGOptLevel);
+ TargetMach.reset(march->createTargetMachine(TripleStr, MCpu, FeatureStr,
+ Options, RelocModel,
+ CodeModel::Default, CGOptLevel));
return true;
}