aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExprCXX.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-03-02 21:28:26 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-03-02 21:28:26 +0000
commit7b9a5aa7c0d76f577699d25ce6afe21ecccb60b7 (patch)
tree8070e7af00c3aba3ee672785c5e8110998a7324f /lib/Sema/SemaExprCXX.cpp
parent0268181bf8e1e561e2a51474ffad9f46b1c3f85d (diff)
During codegen assert that any copy assignment, destructor or constructor that
we need to synthesize has been marked as used by Sema. Change Sema to avoid these asserts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97589 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r--lib/Sema/SemaExprCXX.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 23d52adf91..5f4601961c 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -426,6 +426,18 @@ bool Sema::CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&E) {
: diag::err_throw_incomplete)
<< E->getSourceRange()))
return true;
+
+ // FIXME: This is just a hack to mark the copy constructor referenced.
+ // This should go away when the next FIXME is fixed.
+ const RecordType *RT = Ty->getAs<RecordType>();
+ if (!RT)
+ return false;
+
+ const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
+ if (RD->hasTrivialCopyConstructor())
+ return false;
+ CXXConstructorDecl *CopyCtor = RD->getCopyConstructor(Context, 0);
+ MarkDeclarationReferenced(ThrowLoc, CopyCtor);
}
// FIXME: Construct a temporary here.