]> granicus.if.org Git - clang/commit
[analyzer] Teach constraint managers about unsigned comparisons.
authorJordan Rose <jordan_rose@apple.com>
Sat, 23 Mar 2013 01:21:33 +0000 (01:21 +0000)
committerJordan Rose <jordan_rose@apple.com>
Sat, 23 Mar 2013 01:21:33 +0000 (01:21 +0000)
commit4708b3dde86b06f40927ae9cf30a2de83949a8f2
treee26d5cafc1dd4c77dc3273653db8b0cbe60faa50
parenta339cd66be6202c6e86916f52a347d0289bf2eea
[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)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177806 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h
lib/StaticAnalyzer/Core/APSIntType.cpp
lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
test/Analysis/additive-folding-range-constraints.c
test/Analysis/additive-folding.cpp