From 9889652dbc10060cd604861ed2e5bc6719f845b0 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78355 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'lib/CodeGen/CodeGenFunction.cpp') diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 22c099f8dc..0f155ec648 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/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-18-g5258