diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-07-06 22:04:06 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-07-06 22:04:06 +0000 |
| commit | bca01b46850f867b2f4137f25c882022b58f8471 (patch) | |
| tree | 5de9b1e8664ced5008c6cab6a59bf1f96f5841bf /lib/Sema/TreeTransform.h | |
| parent | a26b2e5ab6ceac8035d31131906b4979b7e315bd (diff) | |
Properly implement the scope restriction on the NRVO for
throw-expressions, such that we don't consider the NRVO when the
non-volatile automatic object comes from outside the innermost try
scope (C++0x [class.copymove]p13). In C++98/03, our ASTs were
incorrect but it didn't matter because IR generation doesn't actually
apply the NRVO here. In C++0x, however, we were moving from an object
when in fact we should have copied from it. Fixes PR10142 /
<rdar://problem/9714312>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134548 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/TreeTransform.h')
| -rw-r--r-- | lib/Sema/TreeTransform.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 66ea7df4ee..040ba9ee12 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -1866,8 +1866,9 @@ public: /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - ExprResult RebuildCXXThrowExpr(SourceLocation ThrowLoc, Expr *Sub) { - return getSema().ActOnCXXThrow(ThrowLoc, Sub); + ExprResult RebuildCXXThrowExpr(SourceLocation ThrowLoc, Expr *Sub, + bool IsThrownVariableInScope) { + return getSema().BuildCXXThrow(ThrowLoc, Sub, IsThrownVariableInScope); } /// \brief Build a new C++ default-argument expression. @@ -6793,7 +6794,8 @@ TreeTransform<Derived>::TransformCXXThrowExpr(CXXThrowExpr *E) { SubExpr.get() == E->getSubExpr()) return SemaRef.Owned(E); - return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get()); + return getDerived().RebuildCXXThrowExpr(E->getThrowLoc(), SubExpr.get(), + E->isThrownVariableInScope()); } template<typename Derived> |
