<div class="gmail_quote">On Thu, Jan 6, 2011 at 7:19 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com">chandlerc@google.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="gmail_quote">Sorry to dig up an old thread...</div><div class="im"><div class="gmail_quote"><br></div><div class="gmail_quote">On Fri, Aug 27, 2010 at 5:19 PM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com" target="_blank">kremenek@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Update test case, with comment to later investigate the correct behavior.  Now the behavior is at least consistent.</blockquote>

</div><br></div><div>Can you explain what's going on here? As mentioned in the PR that this was committed with a partial fix for, these shouldn't warn. I had added some code to prevent the first case from warning, and left a FIXME in the code for the second case. I'm trying to track down what caused the first one to start warning again, it's causing major problems for us.</div>

</blockquote></div><br><div>I think I figured this out. The change was your previous commit which started handling ExprWithCleanups by visiting the sub-expression in the CFGBuilder. Before that, we were able to see the ExprWithCleanups in the CFG and AnalysisBasedWarnings.cpp had a bit of a hack to go through all of its temporaries looking for no-return destructors. Now, we see the subexpression in the CFG, which doesn't give us the nice iterable set of temporaries.</div>
<div><br></div><div>This causes quite a bit of trouble because we have a very large amount of code that uses temporary objects with no-return destuctors in an analogous way to llvm_unreachable. They are used in actual expressions, and so having the list of temporaries was actually important. A contrived be representative example is:</div>
<div><br></div><div><div>struct DeathLog {</div><div>  ~DeathLog() __attribute__((noreturn));</div><div>  DeathLog& operator <<(const char* msg) {</div><div>    (void)msg;  // Print this out...</div><div>    return *this;</div>
<div>  }</div><div>};</div><div><br></div><div>int f() {</div><div>  DeathLog() << "We died!!!";</div><div>}</div></div><div><br></div><div>Do you have ideas about how to at least let the noreturn attribute propagate?</div>
<div><br></div><div>I tried just turning on the implicit dtor support in the CFGBuilder, since we actually have at least some support for it now, and indeed that made all of the warnings in this file go away, but it did very very bad things to the unreachable code warning test, so I fear the explosion in CFG size is just too much.</div>