summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp44
1 files changed, 13 insertions, 31 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index e4ae5bb109f..64fe3652a9d 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -87,17 +87,8 @@ CodeGenModule::CodeGenModule(ASTContext &C, const HeaderSearchOptions &HSO,
: Context(C), LangOpts(C.getLangOpts()), HeaderSearchOpts(HSO),
PreprocessorOpts(PPO), CodeGenOpts(CGO), TheModule(M), Diags(diags),
Target(C.getTargetInfo()), ABI(createCXXABI(*this)),
- VMContext(M.getContext()), TBAA(nullptr), TheTargetCodeGenInfo(nullptr),
- Types(*this), VTables(*this), ObjCRuntime(nullptr),
- OpenCLRuntime(nullptr), OpenMPRuntime(nullptr), CUDARuntime(nullptr),
- DebugInfo(nullptr), ObjCData(nullptr),
- NoObjCARCExceptionsMetadata(nullptr), PGOReader(nullptr),
- CFConstantStringClassRef(nullptr), ConstantStringClassRef(nullptr),
- NSConstantStringType(nullptr), NSConcreteGlobalBlock(nullptr),
- NSConcreteStackBlock(nullptr), BlockObjectAssign(nullptr),
- BlockObjectDispose(nullptr), BlockDescriptorType(nullptr),
- GenericBlockLiteralType(nullptr), LifetimeStartFn(nullptr),
- LifetimeEndFn(nullptr), SanitizerMD(new SanitizerMetadata(*this)),
+ VMContext(M.getContext()), Types(*this), VTables(*this),
+ SanitizerMD(new SanitizerMetadata(*this)),
WholeProgramVTablesBlacklist(CGO.WholeProgramVTablesBlacklistFiles,
C.getSourceManager()) {
@@ -135,19 +126,19 @@ CodeGenModule::CodeGenModule(ASTContext &C, const HeaderSearchOptions &HSO,
// Enable TBAA unless it's suppressed. ThreadSanitizer needs TBAA even at O0.
if (LangOpts.Sanitize.has(SanitizerKind::Thread) ||
(!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0))
- TBAA = new CodeGenTBAA(Context, VMContext, CodeGenOpts, getLangOpts(),
- getCXXABI().getMangleContext());
+ TBAA.reset(new CodeGenTBAA(Context, VMContext, CodeGenOpts, getLangOpts(),
+ getCXXABI().getMangleContext()));
// If debug info or coverage generation is enabled, create the CGDebugInfo
// object.
if (CodeGenOpts.getDebugInfo() != codegenoptions::NoDebugInfo ||
CodeGenOpts.EmitGcovArcs || CodeGenOpts.EmitGcovNotes)
- DebugInfo = new CGDebugInfo(*this);
+ DebugInfo.reset(new CGDebugInfo(*this));
Block.GlobalUniqueCount = 0;
if (C.getLangOpts().ObjC1)
- ObjCData = new ObjCEntrypoints();
+ ObjCData.reset(new ObjCEntrypoints());
if (CodeGenOpts.hasProfileClangUse()) {
auto ReaderOrErr = llvm::IndexedInstrProfReader::create(
@@ -167,16 +158,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const HeaderSearchOptions &HSO,
CoverageMapping.reset(new CoverageMappingModuleGen(*this, *CoverageInfo));
}
-CodeGenModule::~CodeGenModule() {
- delete ObjCRuntime;
- delete OpenCLRuntime;
- delete OpenMPRuntime;
- delete CUDARuntime;
- delete TheTargetCodeGenInfo;
- delete TBAA;
- delete DebugInfo;
- delete ObjCData;
-}
+CodeGenModule::~CodeGenModule() {}
void CodeGenModule::createObjCRuntime() {
// This is just isGNUFamily(), but we want to force implementors of
@@ -185,21 +167,21 @@ void CodeGenModule::createObjCRuntime() {
case ObjCRuntime::GNUstep:
case ObjCRuntime::GCC:
case ObjCRuntime::ObjFW:
- ObjCRuntime = CreateGNUObjCRuntime(*this);
+ ObjCRuntime.reset(CreateGNUObjCRuntime(*this));
return;
case ObjCRuntime::FragileMacOSX:
case ObjCRuntime::MacOSX:
case ObjCRuntime::iOS:
case ObjCRuntime::WatchOS:
- ObjCRuntime = CreateMacObjCRuntime(*this);
+ ObjCRuntime.reset(CreateMacObjCRuntime(*this));
return;
}
llvm_unreachable("bad runtime kind");
}
void CodeGenModule::createOpenCLRuntime() {
- OpenCLRuntime = new CGOpenCLRuntime(*this);
+ OpenCLRuntime.reset(new CGOpenCLRuntime(*this));
}
void CodeGenModule::createOpenMPRuntime() {
@@ -211,16 +193,16 @@ void CodeGenModule::createOpenMPRuntime() {
case llvm::Triple::nvptx64:
assert(getLangOpts().OpenMPIsDevice &&
"OpenMP NVPTX is only prepared to deal with device code.");
- OpenMPRuntime = new CGOpenMPRuntimeNVPTX(*this);
+ OpenMPRuntime.reset(new CGOpenMPRuntimeNVPTX(*this));
break;
default:
- OpenMPRuntime = new CGOpenMPRuntime(*this);
+ OpenMPRuntime.reset(new CGOpenMPRuntime(*this));
break;
}
}
void CodeGenModule::createCUDARuntime() {
- CUDARuntime = CreateNVCUDARuntime(*this);
+ CUDARuntime.reset(CreateNVCUDARuntime(*this));
}
void CodeGenModule::addReplacement(StringRef Name, llvm::Constant *C) {
OpenPOWER on IntegriCloud