Commit Graph

28 Commits

Author SHA1 Message Date
Ted Kremenek 561370c23e Add 'expected-warning' to make test case pass.
llvm-svn: 60548
2008-12-04 19:44:23 +00:00
Ted Kremenek d58e74182e Add another static analyzer test case involving attribute(nonnull).
llvm-svn: 60547
2008-12-04 19:39:12 +00:00
Ted Kremenek 3f0e5c88d9 Add another test case for attribute(nonnull) checking.
llvm-svn: 60544
2008-12-04 18:35:53 +00:00
Ted Kremenek fff9f4aaaf BasicConstraintManager:
- Fix nonsensical logic in AssumeSymGE. When comparing 'sym >= constant' and the
  constant is the maximum integer value, add the constraint that 'sym ==
  constant' when the path is deemed feasible.  All other cases are feasible.
- Improve AssumeSymGT. When comparing 'sym > constant' and constant is the
  maximum integer value we know the path is infeasible.
- Add test case for this enhancement to AssumeSymGT.

llvm-svn: 60490
2008-12-03 19:06:30 +00:00
Ted Kremenek f935cfe277 BasicConstraintManager:
- Fix nonsensical logic in AssumeSymLE. When comparing 'sym <= constant' and the
  constant is the minimum integer value, add the constraint that 'sym ==
  constant' when the path is deemed feasible.  All other cases are feasible.
- Improve AssumeSymLT to address <rdar://problem/6407949>.  When comparing
  'sym < constant' and constant is the minimum integer value we know the
  path is infeasible.
- Add test case for <rdar://problem/6407949>.

llvm-svn: 60489
2008-12-03 18:56:12 +00:00
Ted Kremenek 3ebd7dea7e Add a test case for compound assignments that lazily symbolicate the value of the LHS when the computation type is an integer of more bits.
llvm-svn: 59352
2008-11-15 04:44:13 +00:00
Zhongxing Xu f8b84b0def Add && to test command.
llvm-svn: 59014
2008-11-11 01:25:18 +00:00
Zhongxing Xu 7be05ed6b8 Add region store model to path-sensitive testing.
llvm-svn: 58983
2008-11-10 09:43:12 +00:00
Ted Kremenek 0b09ea54ba This test now passes again.
llvm-svn: 57742
2008-10-17 22:53:09 +00:00
Ted Kremenek 7ff153c9cb Mark these tests XFAIL. We need to add back assumption logic when doing array and field accesses.
llvm-svn: 57658
2008-10-17 00:51:39 +00:00
Ted Kremenek 1f58ec6475 Updated test case.
llvm-svn: 56548
2008-09-24 06:40:03 +00:00
Ted Kremenek 34bfd8a490 Fixed logic error in BasicConstraintManager pointed out by Zhongxing Xu.
For checking if a symbol >= value, we need to check if symbol == value || symbol
> value. When checking symbol > value and we know that symbol != value, the path
is infeasible only if value == maximum integer.

For checking if a symbol <= value, we need to check if symbol == value || symbol
< value. When checking symbol < value and we know that symbol != value, the path
is infeasible only if value == minimum integer.

Updated test case exercising this logic: we only prune paths if the values are
unsigned.

llvm-svn: 56354
2008-09-19 18:00:36 +00:00
Ted Kremenek 24bef31597 Add path-sensitivity test case.
llvm-svn: 56294
2008-09-17 22:24:13 +00:00
Ted Kremenek 025f83534c Fix copy-paste error in test case.
llvm-svn: 56261
2008-09-16 23:25:28 +00:00
Ted Kremenek 8782716c4a Minor pass-sensitivity improvement:
if we know that 'len != 0' and know that 'i == 0' then we know that
  'i < len' must evaluate to true and cannot evaluate to false

llvm-svn: 56260
2008-09-16 23:24:45 +00:00
Ted Kremenek c4f6d90ba1 Tidy up sema processing of attribute "nonull":
- warn about nonnull being applied to functions with no pointer arguments
- continue processing argument list in the attribute when we encounter a non-pointer parameter being marked as nonnull
- when no argument list is specified, only mark pointers as nonnull.  This fixes PR 2732 and radar 6188814.

llvm-svn: 55610
2008-09-01 19:57:52 +00:00
Ted Kremenek 3b977558ce Enhance null-dereference checker test.
llvm-svn: 54834
2008-08-16 00:45:40 +00:00
Daniel Dunbar 81f7f2904c Add EXTWARN Diagnostic class.
- Like EXTENSION but always generates a warning (even without
   -pedantic).
 - Updated ptr -> int, int -> ptr, and incompatible cast warnings to
   be EXTWARN.
 - Other EXTENSION level diagnostics should be audited for upgrade.
 - Updated several test cases to fix code which produced unanticipated
   warnings.

llvm-svn: 54335
2008-08-05 00:07:51 +00:00
Ted Kremenek a7045d663d Enhanced path-sensitive return-of-stack-address check to print out the name of the variable whose address was returned.
llvm-svn: 54253
2008-07-31 20:31:27 +00:00
Ted Kremenek 98f6e582f2 Added path-sensitive checking for null pointer values passed to function arguments marked nonnull.
This implements <rdar://problem/6069935>

llvm-svn: 53891
2008-07-22 00:46:16 +00:00
Ted Kremenek 10bad41159 Added test case to test null dereference checking with lval::ArrayOffset.
llvm-svn: 50454
2008-04-29 23:25:09 +00:00
Ted Kremenek c79c0591d6 Added lval type (and tracking) for StringLiterals.
llvm-svn: 50109
2008-04-22 21:39:21 +00:00
Ted Kremenek eccf3e5821 Added "nonlval::LValAsInteger" to represent abstract LVals casted to integers, allowing us to track lvals when they are casted back to pointers.
llvm-svn: 50108
2008-04-22 21:10:18 +00:00
Ted Kremenek 6fdd3b35dc Added null dereference test involving arrays.
llvm-svn: 50084
2008-04-22 04:56:55 +00:00
Ted Kremenek efa92f1dfc Added missing expected-warning.
llvm-svn: 50073
2008-04-21 23:45:26 +00:00
Ted Kremenek 503924bb9c Added null dereference test case looking for null dereferences involving MemberExpr.
llvm-svn: 50072
2008-04-21 23:44:17 +00:00
Ted Kremenek 4a78c3ae11 Refactored all logic to run the GRSimpleVals and CFRef checker into a common
code path in the clang driver.

Renamed options --grsimple to -checker-simple and -check-cfref to -checker-cfref.

llvm-svn: 49500
2008-04-10 22:16:52 +00:00
Ted Kremenek 018ba60f8e Added path-sensitive null dereference test case.
llvm-svn: 49095
2008-04-02 16:54:39 +00:00