aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-08-22 21:01:12 +0000
committerJohn McCall <rjmccall@apple.com>2010-08-22 21:01:12 +0000
commitf16aa103d3afd42fbca2ab346f191bf745cec092 (patch)
treeaf2fd36fb705f0d900afe40561c89341546459b6 /lib/CodeGen/CodeGenModule.cpp
parentb76495673a381d209410d78af9d969bb3ae0a95a (diff)
Go back to asking CodeGenTypes whether a type is zero-initializable.
Make CGT defer to the ABI on all member pointer types. This requires giving CGT a handle to the ABI. It's way easier to make that work if we avoid lazily creating the ABI. Make it so. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111786 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp36
1 files changed, 15 insertions, 21 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 2d9d57393e..f26fa3c610 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -41,6 +41,17 @@
using namespace clang;
using namespace CodeGen;
+static CGCXXABI &createCXXABI(CodeGenModule &CGM) {
+ switch (CGM.getContext().Target.getCXXABI()) {
+ case CXXABI_ARM: return *CreateARMCXXABI(CGM);
+ case CXXABI_Itanium: return *CreateItaniumCXXABI(CGM);
+ case CXXABI_Microsoft: return *CreateMicrosoftCXXABI(CGM);
+ }
+
+ llvm_unreachable("invalid C++ ABI kind");
+ return *CreateItaniumCXXABI(CGM);
+}
+
CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
llvm::Module &M, const llvm::TargetData &TD,
@@ -48,8 +59,9 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
: BlockModule(C, M, TD, Types, *this), Context(C),
Features(C.getLangOptions()), CodeGenOpts(CGO), TheModule(M),
TheTargetData(TD), TheTargetCodeGenInfo(0), Diags(diags),
- Types(C, M, TD, getTargetCodeGenInfo().getABIInfo()),
- VTables(*this), Runtime(0), ABI(0),
+ ABI(createCXXABI(*this)),
+ Types(C, M, TD, getTargetCodeGenInfo().getABIInfo(), ABI),
+ VTables(*this), Runtime(0),
CFConstantStringClassRef(0), NSConstantStringClassRef(0),
VMContext(M.getContext()),
NSConcreteGlobalBlockDecl(0), NSConcreteStackBlockDecl(0),
@@ -66,17 +78,13 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
else
Runtime = CreateMacObjCRuntime(*this);
- if (!Features.CPlusPlus)
- ABI = 0;
- else createCXXABI();
-
// If debug info generation is enabled, create the CGDebugInfo object.
DebugInfo = CodeGenOpts.DebugInfo ? new CGDebugInfo(*this) : 0;
}
CodeGenModule::~CodeGenModule() {
delete Runtime;
- delete ABI;
+ delete &ABI;
delete DebugInfo;
}
@@ -89,20 +97,6 @@ void CodeGenModule::createObjCRuntime() {
Runtime = CreateMacObjCRuntime(*this);
}
-void CodeGenModule::createCXXABI() {
- switch (Context.Target.getCXXABI()) {
- case CXXABI_ARM:
- ABI = CreateARMCXXABI(*this);
- break;
- case CXXABI_Itanium:
- ABI = CreateItaniumCXXABI(*this);
- break;
- case CXXABI_Microsoft:
- ABI = CreateMicrosoftCXXABI(*this);
- break;
- }
-}
-
void CodeGenModule::Release() {
EmitDeferred();
EmitCXXGlobalInitFunc();