Commit Graph

11 Commits

Author SHA1 Message Date
Jordan Rose 8828d356fb [analyzer] Teach constraint managers about unsigned comparisons.
In C, comparisons between signed and unsigned numbers are always done in
unsigned-space. Thus, we should know that "i >= 0U" is always true, even
if 'i' is signed. Similarly, "u >= 0" is also always true, even though '0'
is signed.

Part of <rdar://problem/13239003> (false positives related to std::vector)

llvm-svn: 177806
2013-03-23 01:21:33 +00:00
Jordy Rose 6d5a8caac3 [analyzer] Convert many existing tests to use clang_analyzer_eval.
llvm-svn: 156920
2012-05-16 16:01:10 +00:00
Jordy Rose 728be7f6ac [analyzer] Rework both constraint managers to handle mixed-type comparisons.
This involves keeping track of three separate types: the symbol type, the
adjustment type, and the comparison type. For example, in "$x + 5 > 0ULL",
if the type of $x is 'signed char', the adjustment type is 'int' and the
comparison type is 'unsigned long long'. Most of the time these three types
will be the same, but we should still do the right thing when the
comparison value is out of range, and wraparound should be calculated in
the adjustment type.

This also re-disables an out-of-bounds test; we were extracting the symbol
from non-additive SymIntExprs, but then throwing away the integer.

Sorry for the large patch; both the basic and range constraint managers needed
to be updated together, since they share code in SimpleConstraintManager.

llvm-svn: 156361
2012-05-08 03:27:16 +00:00
Jordy Rose cac46e87e9 [analyzer] Fix RUN line and general cleanup for additive folding tests.
llvm-svn: 156061
2012-05-03 07:33:56 +00:00
Ted Kremenek 3f955e6d89 [analyzer] rename all experimental checker packages to have 'experimental' be the common root package.
llvm-svn: 136835
2011-08-03 23:14:55 +00:00
Argyrios Kyrtzidis 9eb02dfa89 [analyzer] Remove '-analyzer-check-objc-mem' flag, the nominee for best misnomer award.
llvm-svn: 126676
2011-02-28 19:49:42 +00:00
Argyrios Kyrtzidis 21c9423ef4 [analyzer] Remove '-analyzer-experimental-checks' flag.
llvm-svn: 126607
2011-02-28 01:26:43 +00:00
Benjamin Kramer 322ab26387 Don't depend on system headers in clang -cc1 tests.
The constant was copied from clang's limits.h.

llvm-svn: 106732
2010-06-24 11:06:12 +00:00
Daniel Dunbar b016d6c3d8 Revert "Tweak tests to hopefully fix include of limits.h on win32.", tweak fails on linux.
llvm-svn: 106661
2010-06-23 18:31:33 +00:00
Daniel Dunbar 08748457b9 Tweak tests to hopefully fix include of limits.h on win32.
llvm-svn: 106639
2010-06-23 18:06:20 +00:00
Jordy Rose c0fe8429f2 Fold additive constants, and support comparsions of the form $sym+const1 <> const2
llvm-svn: 106339
2010-06-18 22:49:11 +00:00