From 60be607e5d71627bf3dab8f51c3fdca74267c692 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Tue, 22 Mar 2011 21:21:24 +0000 Subject: [PATCH] Simplify Mac runtime selection - it's the factory function's job to select which class to produce, not CodeGenModule's. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128109 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGObjCMac.cpp | 7 ++----- lib/CodeGen/CGObjCRuntime.h | 1 - lib/CodeGen/CodeGenModule.cpp | 12 ++---------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 1900a85bc3..607df6d0b8 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -6293,10 +6293,7 @@ CGObjCNonFragileABIMac::GetInterfaceEHType(const ObjCInterfaceDecl *ID, CodeGen::CGObjCRuntime * CodeGen::CreateMacObjCRuntime(CodeGen::CodeGenModule &CGM) { + if (CGM.getLangOptions().ObjCNonFragileABI) + return new CGObjCNonFragileABIMac(CGM); return new CGObjCMac(CGM); } - -CodeGen::CGObjCRuntime * -CodeGen::CreateMacNonFragileABIObjCRuntime(CodeGen::CodeGenModule &CGM) { - return new CGObjCNonFragileABIMac(CGM); -} diff --git a/lib/CodeGen/CGObjCRuntime.h b/lib/CodeGen/CGObjCRuntime.h index 5ad3a50adc..e6869adbc6 100644 --- a/lib/CodeGen/CGObjCRuntime.h +++ b/lib/CodeGen/CGObjCRuntime.h @@ -230,7 +230,6 @@ public: //TODO: This should include some way of selecting which runtime to target. CGObjCRuntime *CreateGNUObjCRuntime(CodeGenModule &CGM); CGObjCRuntime *CreateMacObjCRuntime(CodeGenModule &CGM); -CGObjCRuntime *CreateMacNonFragileABIObjCRuntime(CodeGenModule &CGM); } } #endif diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index a528d2ede7..7eee83c928 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -72,14 +72,8 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO, BlockObjectAssignDecl(0), BlockObjectDisposeDecl(0), BlockObjectAssign(0), BlockObjectDispose(0), BlockDescriptorType(0), GenericBlockLiteralType(0) { - if (!Features.ObjC1) - Runtime = 0; - else if (!Features.NeXTRuntime) - Runtime = CreateGNUObjCRuntime(*this); - else if (Features.ObjCNonFragileABI) - Runtime = CreateMacNonFragileABIObjCRuntime(*this); - else - Runtime = CreateMacObjCRuntime(*this); + if (Features.ObjC1) + createObjCRuntime(); // Enable TBAA unless it's suppressed. if (!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0) @@ -115,8 +109,6 @@ CodeGenModule::~CodeGenModule() { void CodeGenModule::createObjCRuntime() { if (!Features.NeXTRuntime) Runtime = CreateGNUObjCRuntime(*this); - else if (Features.ObjCNonFragileABI) - Runtime = CreateMacNonFragileABIObjCRuntime(*this); else Runtime = CreateMacObjCRuntime(*this); } -- 2.40.0