summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.h
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-04-13 23:37:17 +0000
committerReid Kleckner <rnk@google.com>2016-04-13 23:37:17 +0000
commit9305fd1f8617a92dd0157b6b068f899cd1688af3 (patch)
treedfd8b7568ae232351f9eed433300fb764b278e70 /clang/lib/CodeGen/CodeGenModule.h
parentcae581d13fc75ed22b83b0684d6a0a874f1929d5 (diff)
downloadbcm5719-llvm-9305fd1f8617a92dd0157b6b068f899cd1688af3.tar.gz
bcm5719-llvm-9305fd1f8617a92dd0157b6b068f899cd1688af3.zip
[CodeGen] Avoid ctor/dtor boilerplate with some C++11
Non-owning pointers that cache LLVM types and constants can use 'nullptr' default member initializers so that we don't need to mention them in the constructor initializer list. Owning pointers should use std::unique_ptr so that we don't need to manually delete them in the destructor. They also don't need to be mentioned in the constructor at that point. NFC llvm-svn: 266263
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index e1b4ef9aee8..34d1111889a 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -273,9 +273,9 @@ private:
std::unique_ptr<CGCXXABI> ABI;
llvm::LLVMContext &VMContext;
- CodeGenTBAA *TBAA;
+ std::unique_ptr<CodeGenTBAA> TBAA;
- mutable const TargetCodeGenInfo *TheTargetCodeGenInfo;
+ mutable std::unique_ptr<TargetCodeGenInfo> TheTargetCodeGenInfo;
// This should not be moved earlier, since its initialization depends on some
// of the previous reference members being already initialized and also checks
@@ -285,13 +285,13 @@ private:
/// Holds information about C++ vtables.
CodeGenVTables VTables;
- CGObjCRuntime* ObjCRuntime;
- CGOpenCLRuntime* OpenCLRuntime;
- CGOpenMPRuntime* OpenMPRuntime;
- CGCUDARuntime* CUDARuntime;
- CGDebugInfo* DebugInfo;
- ObjCEntrypoints *ObjCData;
- llvm::MDNode *NoObjCARCExceptionsMetadata;
+ std::unique_ptr<CGObjCRuntime> ObjCRuntime;
+ std::unique_ptr<CGOpenCLRuntime> OpenCLRuntime;
+ std::unique_ptr<CGOpenMPRuntime> OpenMPRuntime;
+ std::unique_ptr<CGCUDARuntime> CUDARuntime;
+ std::unique_ptr<CGDebugInfo> DebugInfo;
+ std::unique_ptr<ObjCEntrypoints> ObjCData;
+ llvm::MDNode *NoObjCARCExceptionsMetadata = nullptr;
std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader;
InstrProfStats PGOStats;
std::unique_ptr<llvm::SanitizerStatReport> SanStats;
@@ -435,8 +435,8 @@ private:
llvm::WeakVH ConstantStringClassRef;
/// \brief The LLVM type corresponding to NSConstantString.
- llvm::StructType *NSConstantStringType;
-
+ llvm::StructType *NSConstantStringType = nullptr;
+
/// \brief The type used to describe the state of a fast enumeration in
/// Objective-C's for..in loop.
QualType ObjCFastEnumerationStateType;
@@ -456,24 +456,24 @@ private:
/// @name Cache for Blocks Runtime Globals
/// @{
- llvm::Constant *NSConcreteGlobalBlock;
- llvm::Constant *NSConcreteStackBlock;
+ llvm::Constant *NSConcreteGlobalBlock = nullptr;
+ llvm::Constant *NSConcreteStackBlock = nullptr;
- llvm::Constant *BlockObjectAssign;
- llvm::Constant *BlockObjectDispose;
+ llvm::Constant *BlockObjectAssign = nullptr;
+ llvm::Constant *BlockObjectDispose = nullptr;
- llvm::Type *BlockDescriptorType;
- llvm::Type *GenericBlockLiteralType;
+ llvm::Type *BlockDescriptorType = nullptr;
+ llvm::Type *GenericBlockLiteralType = nullptr;
struct {
int GlobalUniqueCount;
} Block;
/// void @llvm.lifetime.start(i64 %size, i8* nocapture <ptr>)
- llvm::Constant *LifetimeStartFn;
+ llvm::Constant *LifetimeStartFn = nullptr;
/// void @llvm.lifetime.end(i64 %size, i8* nocapture <ptr>)
- llvm::Constant *LifetimeEndFn;
+ llvm::Constant *LifetimeEndFn = nullptr;
GlobalDecl initializedGlobalDecl;
@@ -591,7 +591,7 @@ public:
TypeDescriptorMap[Ty] = C;
}
- CGDebugInfo *getModuleDebugInfo() { return DebugInfo; }
+ CGDebugInfo *getModuleDebugInfo() { return DebugInfo.get(); }
llvm::MDNode *getNoObjCARCExceptionsMetadata() {
if (!NoObjCARCExceptionsMetadata)
OpenPOWER on IntegriCloud