[llvm] r245671 - LTO: Simplify ownership of LTOCodeGenerator::TargetMach.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 20 21:45:58 PDT 2015
Author: pcc
Date: Thu Aug 20 23:45:57 2015
New Revision: 245671
URL: http://llvm.org/viewvc/llvm-project?rev=245671&view=rev
Log:
LTO: Simplify ownership of LTOCodeGenerator::TargetMach.
Modified:
llvm/trunk/include/llvm/LTO/LTOCodeGenerator.h
llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
Modified: llvm/trunk/include/llvm/LTO/LTOCodeGenerator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LTO/LTOCodeGenerator.h?rev=245671&r1=245670&r2=245671&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LTO/LTOCodeGenerator.h (original)
+++ llvm/trunk/include/llvm/LTO/LTOCodeGenerator.h Thu Aug 20 23:45:57 2015
@@ -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;
Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=245671&r1=245670&r2=245671&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Thu Aug 20 23:45:57 2015
@@ -86,9 +86,6 @@ void LTOCodeGenerator::destroyMergedModu
LTOCodeGenerator::~LTOCodeGenerator() {
destroyMergedModule();
-
- delete TargetMach;
- TargetMach = nullptr;
}
// Initialize LTO passes. Please keep this funciton in sync with
@@ -352,9 +349,9 @@ bool LTOCodeGenerator::determineTarget(s
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;
}
More information about the llvm-commits
mailing list