summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2016-01-06 23:34:20 +0000
committerJohn McCall <rjmccall@apple.com>2016-01-06 23:34:20 +0000
commit8a43a0df683259b114235c1bbc5f8ce8d01f0e80 (patch)
treebc1ea855d76b0917e432b2f992406833c12c983a /clang
parentf1cbb93050f1f295af6a4e5bb53dd99d48b2d4ed (diff)
downloadbcm5719-llvm-8a43a0df683259b114235c1bbc5f8ce8d01f0e80.tar.gz
bcm5719-llvm-8a43a0df683259b114235c1bbc5f8ce8d01f0e80.zip
Properly bind up any cleanups in an ExprWithCleanups after
instantiating a default argument expression. This was previously just working implicitly by reinstantiating in the current context, but caching means that we weren't registering cleanups in subsequent uses. llvm-svn: 256996
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index f1b9987a2f0..8e50d5a103c 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -4313,17 +4313,16 @@ ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc,
if (Result.isInvalid())
return ExprError();
- Expr *Arg = Result.getAs<Expr>();
- CheckCompletedExpr(Arg, Param->getOuterLocStart());
+ Result = ActOnFinishFullExpr(Result.getAs<Expr>(),
+ Param->getOuterLocStart());
+ if (Result.isInvalid())
+ return ExprError();
// Remember the instantiated default argument.
- Param->setDefaultArg(Arg);
+ Param->setDefaultArg(Result.getAs<Expr>());
if (ASTMutationListener *L = getASTMutationListener()) {
L->DefaultArgumentInstantiated(Param);
}
-
- // Build the default argument expression.
- return CXXDefaultArgExpr::Create(Context, CallLoc, Param);
}
// If the default expression creates temporaries, we need to
OpenPOWER on IntegriCloud