<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On May 23, 2014, at 5:41 , 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 Thu, May 22, 2014 at 5:23 AM, 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="">================<br>
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:54-56<br>
@@ -53,1 +53,5 @@<br>
<br>
+REGISTER_TRAIT_WITH_PROGRAMSTATE(<br>
+    InitializedTemporariesSet,<br>
+    llvm::ImmutableSet<const CXXBindTemporaryExpr *>);<br>
+<br>
----------------<br>
</div><div class="">Manuel Klimek wrote:<br>
> Jordan Rose wrote:<br>
> > This needs to include the current StackFrameContext as well (for recursive functions). You can get that from the current LocationContext.<br>
> Can you elaborate on how I would put that into a datastructure? Just use a std::pair? (doesn't seem to work with ImmutableSet though)<br>
><br>
> Also, I seem unable to write a test that breaks because of this - any hints would be highly welcome.<br>
</div>We'd have to write a specialization of ImutProfileInfo for std::pair, but that's probably not a bad idea anyway. Please feel free to add one to ImmutableSet.h.<br>
<br>
I would guess the test case would look something like this:<br>
<br>
  static bool test(bool isInner) {<br>
    if (isInner || NoReturnDtor() || test(true)) {<br></blockquote><div><br></div><div>Putting the recursive call into the condition, of course :)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

      *(volatile int *)0 = 1; // should warn<br></blockquote><div><br></div><div>The analyzer now presents a puzzle:</div><div>Your test works (does not warn currently, warns when I add the stack-frame info).</div><div>The problem is that when I replace that line with:</div>
<div>clang_analyzer_eval(true); // expected-warning{{TRUE}}</div><div>I do not get that warning.</div><div><br></div><div>What's the difference?</div></div></div></div></blockquote><br></div><div>clang_analyzer_eval doesn't fire on inlined functions, because a condition that's normally UNKNOWN may be provably true for a particular invocation of the function. clang_analyzer_warnIfReached will fire no matter what path it took to get there. clang_analyzer_checkInlined will <i>only</i> fire within an inlined call.</div><div><br></div><div>Jordan</div><br></body></html>