<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">On Jan 6, 2016, at 3:54 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" class="">richard@metafoo.co.uk</a>> wrote:</div><div class=""><div dir="ltr" class=""><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" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rjmccall<br class="">
Date: Wed Jan 6 17:34:20 2016<br class="">
New Revision: 256996<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=256996&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=256996&view=rev</a><br class="">
Log:<br class="">
Properly bind up any cleanups in an ExprWithCleanups after<br class="">
instantiating a default argument expression.<br class="">
<br class="">
This was previously just working implicitly by reinstantiating<br class="">
in the current context, but caching means that we weren't<br class="">
registering cleanups in subsequent uses.<br class=""></blockquote><div class=""><br class=""></div><div class="">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></div></div></blockquote><div><br class=""></div>Yes. The difference is that Param->getInit() will now be wrapped in an</div><div>ExprWithCleanups (assuming it does contain cleanups). This means that on</div><div>subsequent calls, the standard logic beneath this will now flag the existence</div><div>of those cleanups, ultimately causing the containing full-expression to also</div><div>get wrapped. That’s what wasn’t happening before, causing cleanups to</div><div>escape into the surrounding context, which apparently was only checked</div><div>by some OpenMP tests.</div><div><br class=""></div><div>(CXXDefaultArgExpr::getExpr() looks through the ExprWithCleanups, and</div><div>that’s what’s used by CodeGen and other clients.)</div><div><br class=""></div><div>John.</div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Modified:<br class="">
cfe/trunk/lib/Sema/SemaExpr.cpp<br class="">
<br class="">
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp<br class="">
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" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=256996&r1=256995&r2=256996&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)<br class="">
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Jan 6 17:34:20 2016<br class="">
@@ -4313,17 +4313,16 @@ ExprResult Sema::BuildCXXDefaultArgExpr(<br class="">
if (Result.isInvalid())<br class="">
return ExprError();<br class="">
<br class="">
- Expr *Arg = Result.getAs<Expr>();<br class="">
- CheckCompletedExpr(Arg, Param->getOuterLocStart());<br class="">
+ Result = ActOnFinishFullExpr(Result.getAs<Expr>(),<br class="">
+ Param->getOuterLocStart());<br class="">
+ if (Result.isInvalid())<br class="">
+ return ExprError();<br class="">
<br class="">
// Remember the instantiated default argument.<br class="">
- Param->setDefaultArg(Arg);<br class="">
+ Param->setDefaultArg(Result.getAs<Expr>());<br class="">
if (ASTMutationListener *L = getASTMutationListener()) {<br class="">
L->DefaultArgumentInstantiated(Param);<br class="">
}<br class="">
-<br class="">
- // Build the default argument expression.<br class="">
- return CXXDefaultArgExpr::Create(Context, CallLoc, Param);<br class="">
}<br class="">
<br class="">
// If the default expression creates temporaries, we need to<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
cfe-commits mailing list<br class="">
<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br class="">
</blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>