summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-08-06 23:38:16 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-08-06 23:38:16 +0000
commit9301b24c0a4ed6eb320c9bbd9bc547e11d57622e (patch)
tree688ba4e46fd294e8c3155fffb0035824e8420968 /clang/lib/CodeGen/CodeGenFunction.cpp
parent88fae6f9c966353ca94a66708fcb16bd0ab22b68 (diff)
downloadbcm5719-llvm-9301b24c0a4ed6eb320c9bbd9bc547e11d57622e.tar.gz
bcm5719-llvm-9301b24c0a4ed6eb320c9bbd9bc547e11d57622e.zip
Patch toward synthesizing copy constructors.
Work in progress. llvm-svn: 78355
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp23
1 files changed, 16 insertions, 7 deletions
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<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.
OpenPOWER on IntegriCloud