On May 23, 2014, at 5:41 , Manuel Klimek <[email protected]> wrote: > On Thu, May 22, 2014 at 5:23 AM, Jordan Rose <[email protected]> wrote: > ================ > Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:54-56 > @@ -53,1 +53,5 @@ > > +REGISTER_TRAIT_WITH_PROGRAMSTATE( > + InitializedTemporariesSet, > + llvm::ImmutableSet<const CXXBindTemporaryExpr *>); > + > ---------------- > Manuel Klimek wrote: > > Jordan Rose wrote: > > > This needs to include the current StackFrameContext as well (for > > > recursive functions). You can get that from the current LocationContext. > > 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) > > > > Also, I seem unable to write a test that breaks because of this - any hints > > would be highly welcome. > 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. > > I would guess the test case would look something like this: > > static bool test(bool isInner) { > if (isInner || NoReturnDtor() || test(true)) { > > Putting the recursive call into the condition, of course :) > > *(volatile int *)0 = 1; // should warn > > The analyzer now presents a puzzle: > Your test works (does not warn currently, warns when I add the stack-frame > info). > The problem is that when I replace that line with: > clang_analyzer_eval(true); // expected-warning{{TRUE}} > I do not get that warning. > > What's the difference?
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 only fire within an inlined call. Jordan
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
