<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;"><br><div><div>On Jun 20, 2014, at 13:25 , Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jun 20, 2014 at 7:17 PM, Jordan Rose <span dir="ltr"><<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@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 class="HOEnZb"><div class="h5"><br>
On Jun 18, 2014, at 9:08 , Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:<br>
<br>
> Hi Jordan,<br>
><br>
> I've started to look into inlining temporary destructors, but I'm hitting a wall.<br>
> Specifically, I think I fail at finding the right MemRegion in ProcessTemporaryDtor (there is a comment in there, that says we need the region for the VisitCXXDestructor call).<br>
><br>
> Any help / pointers / brain-dumps on how to do it would be highly appreciated.<br>
<br>
</div></div>Hm. I haven't thought about it enough to give you a fool-proof plan, but one possibility could be to store the MemRegion in the state at the point of the CXXBindTemporaryExpr, rather than just a boolean flag. I don't quite know what the ramifications of that would be, though.<br>

<br>
(By the time we get to the destructor, the value of the CXXBindTemporaryExpr is almost certainly no longer in the Environment.)<br></blockquote><div><br></div><div>Are there other cases in which we store the MemRegion so we make sure it doesn't get expunged from the Environment, so I can take a look at similar code?</div>
</div></div></div></blockquote><br></div><div>It's not a "so it doesn't get purged from the Environment"—it's most likely leaving the Environment no matter what. Instead, you just keep a reference to the MemRegion. CStringChecker does something a bit like this.</div><div><br></div><div>...but wait, we need the contents of the region to not be cleaned out of the state either. So maybe there's a better way to go: change the LiveVariables analysis to not consider the CXXBindTemporaryExpr dead until the end of the whole full-expression. (And then do, uh, something about lifetime extension, which isn't quite handled correctly right now anyway.)</div><div><br></div><div>Jordan</div><br></body></html>