From 9301b24c0a4ed6eb320c9bbd9bc547e11d57622e Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Thu, 6 Aug 2009 23:38:16 +0000 Subject: Patch toward synthesizing copy constructors. Work in progress. llvm-svn: 78355 --- clang/lib/CodeGen/CodeGenFunction.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp') diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 22c099f8dcd..0f155ec648b 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -240,13 +240,22 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD, } else if (const CXXConstructorDecl *CD = dyn_cast(FD)) { - assert( - !cast(CD->getDeclContext())-> - hasUserDeclaredConstructor() && - "bogus constructor is being synthesize"); - StartFunction(FD, FD->getResultType(), Fn, Args, SourceLocation()); - EmitCtorPrologue(CD); - FinishFunction(); + const CXXRecordDecl *ClassDecl = + cast(CD->getDeclContext()); + (void) ClassDecl; + if (CD->isCopyConstructor(getContext())) { + assert(!ClassDecl->hasUserDeclaredCopyConstructor() && + "bogus constructor is being synthesize"); + StartFunction(FD, FD->getResultType(), Fn, Args, SourceLocation()); + FinishFunction(); + } + else { + assert(!ClassDecl->hasUserDeclaredConstructor() && + "bogus constructor is being synthesize"); + StartFunction(FD, FD->getResultType(), Fn, Args, SourceLocation()); + EmitCtorPrologue(CD); + FinishFunction(); + } } // Destroy the 'this' declaration. -- cgit v1.2.3