<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 6, 2016 at 3:34 PM, John McCall via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rjmccall<br>
Date: Wed Jan 6 17:34:20 2016<br>
New Revision: 256996<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=256996&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=256996&view=rev</a><br>
Log:<br>
Properly bind up any cleanups in an ExprWithCleanups after<br>
instantiating a default argument expression.<br>
<br>
This was previously just working implicitly by reinstantiating<br>
in the current context, but caching means that we weren't<br>
registering cleanups in subsequent uses.<br></blockquote><div><br></div><div>Isn't the code you changed below only reached the first time anyway, now that we only instantiate the default argument once?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Modified:<br>
cfe/trunk/lib/Sema/SemaExpr.cpp<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=256996&r1=256995&r2=256996&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=256996&r1=256995&r2=256996&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Jan 6 17:34:20 2016<br>
@@ -4313,17 +4313,16 @@ ExprResult Sema::BuildCXXDefaultArgExpr(<br>
if (Result.isInvalid())<br>
return ExprError();<br>
<br>
- Expr *Arg = Result.getAs<Expr>();<br>
- CheckCompletedExpr(Arg, Param->getOuterLocStart());<br>
+ Result = ActOnFinishFullExpr(Result.getAs<Expr>(),<br>
+ Param->getOuterLocStart());<br>
+ if (Result.isInvalid())<br>
+ return ExprError();<br>
<br>
// Remember the instantiated default argument.<br>
- Param->setDefaultArg(Arg);<br>
+ Param->setDefaultArg(Result.getAs<Expr>());<br>
if (ASTMutationListener *L = getASTMutationListener()) {<br>
L->DefaultArgumentInstantiated(Param);<br>
}<br>
-<br>
- // Build the default argument expression.<br>
- return CXXDefaultArgExpr::Create(Context, CallLoc, Param);<br>
}<br>
<br>
// If the default expression creates temporaries, we need to<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>