Patch toward synthesizing copy constructors.

Work in progress.

llvm-svn: 78355
This commit is contained in:
Fariborz Jahanian
2009-08-06 23:38:16 +00:00
parent 88fae6f9c9
commit 9301b24c0a
2 changed files with 21 additions and 8 deletions

View File

@@ -240,13 +240,22 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD,
}
else
if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(FD)) {
assert(
!cast<CXXRecordDecl>(CD->getDeclContext())->
hasUserDeclaredConstructor() &&
"bogus constructor is being synthesize");
StartFunction(FD, FD->getResultType(), Fn, Args, SourceLocation());
EmitCtorPrologue(CD);
FinishFunction();
const CXXRecordDecl *ClassDecl =
cast<CXXRecordDecl>(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.