forked from OSchip/llvm-project
Tidy up CGCXXABI creation
'create' functions conventionally return a pointer, not a reference. Also use an OwningPtr to get replace the delete of a reference member. No functional change. llvm-svn: 198126
This commit is contained in:
parent
3ca67d6404
commit
82862258e3
|
@ -55,15 +55,15 @@ using namespace CodeGen;
|
||||||
|
|
||||||
static const char AnnotationSection[] = "llvm.metadata";
|
static const char AnnotationSection[] = "llvm.metadata";
|
||||||
|
|
||||||
static CGCXXABI &createCXXABI(CodeGenModule &CGM) {
|
static CGCXXABI *createCXXABI(CodeGenModule &CGM) {
|
||||||
switch (CGM.getTarget().getCXXABI().getKind()) {
|
switch (CGM.getTarget().getCXXABI().getKind()) {
|
||||||
case TargetCXXABI::GenericAArch64:
|
case TargetCXXABI::GenericAArch64:
|
||||||
case TargetCXXABI::GenericARM:
|
case TargetCXXABI::GenericARM:
|
||||||
case TargetCXXABI::iOS:
|
case TargetCXXABI::iOS:
|
||||||
case TargetCXXABI::GenericItanium:
|
case TargetCXXABI::GenericItanium:
|
||||||
return *CreateItaniumCXXABI(CGM);
|
return CreateItaniumCXXABI(CGM);
|
||||||
case TargetCXXABI::Microsoft:
|
case TargetCXXABI::Microsoft:
|
||||||
return *CreateMicrosoftCXXABI(CGM);
|
return CreateMicrosoftCXXABI(CGM);
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm_unreachable("invalid C++ ABI kind");
|
llvm_unreachable("invalid C++ ABI kind");
|
||||||
|
@ -117,7 +117,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
|
||||||
if (SanOpts.Thread ||
|
if (SanOpts.Thread ||
|
||||||
(!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0))
|
(!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0))
|
||||||
TBAA = new CodeGenTBAA(Context, VMContext, CodeGenOpts, getLangOpts(),
|
TBAA = new CodeGenTBAA(Context, VMContext, CodeGenOpts, getLangOpts(),
|
||||||
ABI.getMangleContext());
|
getCXXABI().getMangleContext());
|
||||||
|
|
||||||
// If debug info or coverage generation is enabled, create the CGDebugInfo
|
// If debug info or coverage generation is enabled, create the CGDebugInfo
|
||||||
// object.
|
// object.
|
||||||
|
@ -138,7 +138,6 @@ CodeGenModule::~CodeGenModule() {
|
||||||
delete OpenCLRuntime;
|
delete OpenCLRuntime;
|
||||||
delete CUDARuntime;
|
delete CUDARuntime;
|
||||||
delete TheTargetCodeGenInfo;
|
delete TheTargetCodeGenInfo;
|
||||||
delete &ABI;
|
|
||||||
delete TBAA;
|
delete TBAA;
|
||||||
delete DebugInfo;
|
delete DebugInfo;
|
||||||
delete ARCData;
|
delete ARCData;
|
||||||
|
|
|
@ -236,7 +236,7 @@ class CodeGenModule : public CodeGenTypeCache {
|
||||||
DiagnosticsEngine &Diags;
|
DiagnosticsEngine &Diags;
|
||||||
const llvm::DataLayout &TheDataLayout;
|
const llvm::DataLayout &TheDataLayout;
|
||||||
const TargetInfo &Target;
|
const TargetInfo &Target;
|
||||||
CGCXXABI &ABI;
|
llvm::OwningPtr<CGCXXABI> ABI;
|
||||||
llvm::LLVMContext &VMContext;
|
llvm::LLVMContext &VMContext;
|
||||||
|
|
||||||
CodeGenTBAA *TBAA;
|
CodeGenTBAA *TBAA;
|
||||||
|
@ -535,7 +535,7 @@ public:
|
||||||
DiagnosticsEngine &getDiags() const { return Diags; }
|
DiagnosticsEngine &getDiags() const { return Diags; }
|
||||||
const llvm::DataLayout &getDataLayout() const { return TheDataLayout; }
|
const llvm::DataLayout &getDataLayout() const { return TheDataLayout; }
|
||||||
const TargetInfo &getTarget() const { return Target; }
|
const TargetInfo &getTarget() const { return Target; }
|
||||||
CGCXXABI &getCXXABI() { return ABI; }
|
CGCXXABI &getCXXABI() const { return *ABI; }
|
||||||
llvm::LLVMContext &getLLVMContext() { return VMContext; }
|
llvm::LLVMContext &getLLVMContext() { return VMContext; }
|
||||||
|
|
||||||
bool shouldUseTBAA() const { return TBAA != 0; }
|
bool shouldUseTBAA() const { return TBAA != 0; }
|
||||||
|
|
Loading…
Reference in New Issue