summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/LTOCodeGenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/LTO/LTOCodeGenerator.cpp')
-rw-r--r--llvm/lib/LTO/LTOCodeGenerator.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp
index fdf3f3a2b89..6203000c2ec 100644
--- a/llvm/lib/LTO/LTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -86,9 +86,6 @@ void LTOCodeGenerator::destroyMergedModule() {
LTOCodeGenerator::~LTOCodeGenerator() {
destroyMergedModule();
-
- delete TargetMach;
- TargetMach = nullptr;
}
// Initialize LTO passes. Please keep this funciton in sync with
@@ -352,9 +349,9 @@ bool LTOCodeGenerator::determineTarget(std::string &errMsg) {
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;
}
OpenPOWER on IntegriCloud