<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On Apr 17, 2014, at 8:25 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br><div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="font-family: HelveticaNeue; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">But I don't know anything about the static analyzers to actually say</span><br style="font-family: HelveticaNeue; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: HelveticaNeue; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">whether there's a good way to implement such a check.</span></blockquote><br></div><div>There is not.  We’ve wanted this “lifetime” or “scope” information for a while to find bugs like these.  It’s an infrastructure issue.  One thing that just occurred to me is that we could probably add this information as an enhancement to the CFG.  We’re already inserting destructors for C++ objects; similarly lifetime “markers” could be added to the CFG for ordinary local variables.  These markers would not be needed by all clients of the CFG (e.g., the frontend), but they would precisely model this problem very nicely for the static analyzer and similar clients.  Adding this enhancement to the CFG probably wouldn’t be that hard at this point either, since the destructor support in the CFG has prepped much of the needed plumbing.</div></body></html>