summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-08-21 04:45:57 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-08-21 04:45:57 +0000
commitec43d0f35680cf8ba10f59e104b0906cb9f08852 (patch)
tree7400fe90924ee0e40dadbbc873461c37cdd30ab4
parent2257512f87c12b42c053ec760c84f73e905264d9 (diff)
downloadbcm5719-llvm-ec43d0f35680cf8ba10f59e104b0906cb9f08852.tar.gz
bcm5719-llvm-ec43d0f35680cf8ba10f59e104b0906cb9f08852.zip
LTO: Simplify ownership of LTOCodeGenerator::TargetMach.
llvm-svn: 245671
-rw-r--r--llvm/include/llvm/LTO/LTOCodeGenerator.h2
-rw-r--r--llvm/lib/LTO/LTOCodeGenerator.cpp9
2 files changed, 4 insertions, 7 deletions
diff --git a/llvm/include/llvm/LTO/LTOCodeGenerator.h b/llvm/include/llvm/LTO/LTOCodeGenerator.h
index 695de5aa994..a7ccbceda41 100644
--- a/llvm/include/llvm/LTO/LTOCodeGenerator.h
+++ b/llvm/include/llvm/LTO/LTOCodeGenerator.h
@@ -159,7 +159,7 @@ private:
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;
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