<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jan 3, 2015 at 1:46 PM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class=""><blockquote type="cite"><div>On Jan 2, 2015, at 7:10 AM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>> wrote:</div><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Dec 16, 2014 at 12:01 AM, Alexey Bataev <span dir="ltr"><<a href="mailto:a.bataev@hotmail.com" target="_blank">a.bataev@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: abataev<br>
Date: Tue Dec 16 02:01:48 2014<br>
New Revision: 224329<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=224329&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=224329&view=rev</a><br>
Log:<br>
Renamed RefersToEnclosingLocal bitfield to RefersToCapturedVariable.<br>
Bitfield RefersToEnclosingLocal of Stmt::DeclRefExprBitfields renamed to RefersToCapturedVariable to reflect latest changes introduced in commit 224323. Also renamed method Expr::refersToEnclosingLocal() to Expr::refersToCapturedVariable() and comments for constant arguments.<br>
No functional changes.<br></blockquote><div><br></div><div>This seems like a bad idea for me. It's incorrect: for a lambda, the flag means that the DeclRefExpr refers to an enclosing local, and does *not* imply that the variable is necessarily captured. This confusion has already led to a bug (fixed in <span style="font-size:13px">r225060).</span></div></div></div></div></div></blockquote><div><br></div></span>If that’s actually a useful property to track, I have no complaint about tracking the two things separately.  I don’t think DRE is short of bits.</div></div></blockquote><div><br></div><div>The problem is that we can't reasonably track whether a DRE refers to a captured variable, because that is not a local property of the DRE; it depends on non-trivial properties of the context in which the DRE is used (and more generally it depends on how else that same variable is used elsewhere in the lambda, but we can largely ignore that).</div><div><br></div><div>I'd be fine having separate flags for 'refers to enclosing local' and 'refers to captured global' (if the latter is the point of this change), but we should not claim a DRE refers to a capture when it does not.</div></div></div></div>