diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-07-30 23:22:00 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-07-30 23:22:00 +0000 |
commit | c7ff8e19081c2e974f05f66c4fa9b40750fc655f (patch) | |
tree | 49195cd331e71c0ab6ae6cf2ad245e1f180846d4 /lib/CodeGen/CodeGenModule.cpp | |
parent | b197572cf1cd70a817a1f546478cb2cb9112c48e (diff) |
Synthesize the default constructor which has not
been declared as needed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77641 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 2cc0aab22a..bc3bd0bfa9 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/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 |