<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 19, 2014 at 6:30 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">I think the algorithm makes sense. I'm not sure it's different, though, than just passing up the first (or last) CXXBindTemporaryExpr visited for a given expression, which would look like this:<br>

<br>
    // For a logical expression...<br>
    VisitForTemporaryDtors(E->getLHS(), false, &LastBTE);<br>
    const CXXBindTemporaryExpr *InnerBTE = nullptr;<br>
    VisitForTemporaryDtors(E->getRHS(), false, &InnerBTE);<br>
    InsertTempDtorDecisionBlock(InnerBTE);<br>
<br>
Are there any cases that wouldn't cover?<br></blockquote><div><br></div><div>Well, the problem is what to do if we don't have a BTE yet; if we only wanted to pass one pointer, the semantics on function exit would need to be:</div>
<div>if (BTE) { we have already found a BTE, no need to insert a new block when we encounter the next }</div><div>else { we have not yet found a BTE, so we need to insert a new block when we find one }</div><div><br></div>
<div>The "unconditional" branch would only fit with the first part, so we would need to somehow conjure non-null BTE for all unconditional entries, and then afterwards know that this is a special value, because since we didn't add an extra block (as we were running an unconditional case), we don't need a decision block.</div>
<div>I'd say that's a pretty strong argument that we at least need to pass the CXXBindTemporaryExpr* and a bool IsConditional.</div><div><br></div><div>Now it's right that we don't need to remember the Succ when we hit the conditional, and instead we could just always store the Succ when we enter a recursive visitation for a conditional branch (we need to store the Succ because we can have nested conditionals), but that seems to me like it would distribute the logic through even more places, and thus undesirable.</div>
<div><br></div><div>Cheers,</div><div>/Manuel </div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<a href="http://reviews.llvm.org/D3627" target="_blank">http://reviews.llvm.org/D3627</a><br>
<br>
<br>
</blockquote></div><br></div></div>