summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-07-30 23:22:00 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-07-30 23:22:00 +0000
commit6f14c73087ba24f0f48ba07afb3cc6466d468acc (patch)
treee571b08b49070b339b49c15ddd1de8a438ed235f /clang/lib/CodeGen/CodeGenModule.cpp
parent16f58557d234c0f6ac2abf66216006060a1c501f (diff)
downloadbcm5719-llvm-6f14c73087ba24f0f48ba07afb3cc6466d468acc.tar.gz
bcm5719-llvm-6f14c73087ba24f0f48ba07afb3cc6466d468acc.zip
Synthesize the default constructor which has not
been declared as needed. llvm-svn: 77641
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 2cc0aab22ab..bc3bd0bfa95 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -640,6 +640,14 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction(const char *MangledName,
// top-level declarations.
if (FD->isThisDeclarationADefinition() && MayDeferGeneration(FD))
DeferredDeclsToEmit.push_back(D);
+ // A called constructor which has no definition or declaration need be
+ // synthesized.
+ else if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(FD)) {
+ const CXXRecordDecl *ClassDecl =
+ cast<CXXRecordDecl>(CD->getDeclContext());
+ if (!ClassDecl->hasUserDeclaredConstructor())
+ DeferredDeclsToEmit.push_back(D);
+ }
}
// This function doesn't have a complete type (for example, the return
OpenPOWER on IntegriCloud