dcoughlin added a comment.

In https://reviews.llvm.org/D25326#569061, @danielmarjamaki wrote:

> > You could also try to add a canary with clang analyzer eval after the if 
> > statement to force the test to fail if we do add this symbolic reasoning.
>
> sounds good. sorry but I don't see how to do it.


The trick is to not first store the UnknownVal into a local (the analyzer will 
automatically create a symbol for that when read).

Instead you can do something like:

  if (table[i] != 0) { }
  clang_analyzer_eval((table[i] != 0)) // expected-warning {{UNKNOWN}}

This way if the analyzer ever starts generating symbols for a read from 
table[i] then the case split will change the eval to emit TRUE on one path and 
FALSE on the other.


Repository:
  rL LLVM

https://reviews.llvm.org/D25326



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to