Commit Graph

34 Commits

Author SHA1 Message Date
Zhongxing Xu 1f275ba1b4 Add comments to test case.
llvm-svn: 72165
2009-05-20 09:03:10 +00:00
Zhongxing Xu a7907608fb * API change: we need to pass GRState to GRExprEngine::EvalBinOp() because
RegionStore needs to know the type of alloca region. 
* RegionStoreManager::EvalBinOp() now converts the alloca region to its first
  element region, as what is done to symbolic region.

llvm-svn: 72164
2009-05-20 09:00:16 +00:00
Zhongxing Xu 08a2ede018 Add logic for invalidating array region to CFRefCount.cpp. When invalidating
array region, set its default value to conjured symbol. When retrieving its
element, create new region value symbol for the element.

Also fix some 80 columns violations.

llvm-svn: 71548
2009-05-12 10:10:00 +00:00
Ted Kremenek 02e508960c Per conversations with Zhongxing, add an 'element type' to
ElementRegion.  I also removed 'ElementRegion::getArrayRegion',
although we may need to add this back.

This breaks a few test cases with RegionStore:
- 'array-struct.c' triggers an infinite recursion in RegionStoreManager.  Need to investigate.
- misc-ps.m triggers a failure with RegionStoreManager as we now get the diagnostic:
  'Line 159: Uninitialized or undefined return value returned to caller.'
  
There were a bunch of places that needed to be edit
RegionStoreManager, and we may not be passing all the correct 'element
types' down from GRExprEngine.

Zhongxing: When you get a chance, could you review this?  I could have
easily screwed up something basic in RegionStoreManager.

llvm-svn: 70830
2009-05-04 06:18:28 +00:00
Zhongxing Xu 3e3e69bbe7 region store: make Retrieve() can retrieve embedded array correctly. Also
simplify the retrieve logic.

llvm-svn: 70651
2009-05-03 00:27:40 +00:00
Daniel Dunbar a45cf5b6b0 Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602
2009-03-24 02:24:46 +00:00
Zhongxing Xu e40de828fc add test case.
llvm-svn: 67154
2009-03-18 02:07:30 +00:00
Zhongxing Xu 5b9223fcf2 add test case.
llvm-svn: 65036
2009-02-19 08:42:43 +00:00
Ted Kremenek 51189468ea Update several tests to explicitly use BasicConstraintManager as well as to use RangeConstraintManager with RegionStoreManager.
llvm-svn: 64854
2009-02-17 23:32:18 +00:00
Ted Kremenek b535181199 Static Analyzer driver/options (partial) cleanup:
- Move all analyzer options logic to AnalysisConsumer.cpp.
- Unified specification of stores/constraints/output to be:
   -analyzer-output=...
   -analyzer-store=...
   -analyzer-constraints=...
  instead of -analyzer-range-constraints, -analyzer-store-basic, etc.
- Updated drivers (ccc-analyzer, scan-builds, new ccc) to obey this new
  interface
- Updated test cases to conform to new driver options

llvm-svn: 64737
2009-02-17 04:27:41 +00:00
Zhongxing Xu e37f9afb2e Implement retrieval of the default value of element and field regions.
llvm-svn: 62847
2009-01-23 11:22:12 +00:00
Zhongxing Xu b8365bd890 Add a test case for init expr of array and struct type.
llvm-svn: 62845
2009-01-23 10:23:13 +00:00
Ted Kremenek 92d48a71f5 Fix RegionStore::getLValueElement() to handle the case when the base region is not an ElementRegion (also do some cleanups of its core logic).
This gets array-struct.c to work with RegionStore.

llvm-svn: 62781
2009-01-22 20:27:48 +00:00
Daniel Dunbar 34fc92fdc2 Add -analyze action to run static analyzer, instead of inferring from
individual checker options.

llvm-svn: 62634
2009-01-20 23:17:32 +00:00
Zhongxing Xu cff637a568 Add KillStruct to region store.
- put the killed region in the kill set.
 - set its default value to unknown.
 - removes all bindings for its subregions.  

llvm-svn: 62138
2009-01-13 01:49:57 +00:00
Ted Kremenek b5670fd555 MemRegion:
- Overhauled the notion of "types" for TypedRegions.  We now distinguish between the "lvalue" of a region (via getLValueRegion()) and the "rvalue" of a region (va getRValueRegion()).  Since a region represents a chunk of memory it has both, but we were conflating these concepts in some cases, leading to some insidious bugs.
- Removed AnonPointeeType, partially because it is unused and because it doesn't have a clear notion of lvalue vs rvalue type.  We can add it back once there is a need for it and we can resolve its role with these concepts.

StoreManager:
- Overhauled StoreManager::CastRegion.  It expects an *lvalue* type for a region.  This is actually what motivated the overhaul to the MemRegion type mechanism.  It also no longer returns an SVal; we can just return a MemRegion*.
- BasicStoreManager::CastRegion now overlays an "AnonTypedRegion" for pointer-pointer casts.  This matches with the MemRegion changes.
- Similar changes to RegionStore, except I've added a bunch of FIXMEs where it wasn't 100% clear where we should use TypedRegion::getRValueRegion() or TypedRegion::getLValueRegion().

AuditCFNumberCreate check:
- Now blasts through AnonTypedRegions that may layer the original memory region, thus checking if the actually memory block is of the appropriate type.  This change was needed to work with the changes to StoreManager::CastRegion.

GRExprEngine::VisitCast:
- Conform to the new interface of StoreManager::CastRegion.

Tests:
- None of the analysis tests fail now for using the "basic store".
- Disabled the tests 'array-struct.c' and 'rdar-6442306-1.m' pending further testing and bug fixing.

llvm-svn: 60995
2008-12-13 21:49:13 +00:00
Zhongxing Xu 9cc7cba848 remove a test case that causes compiler warning.
llvm-svn: 60282
2008-11-30 05:59:27 +00:00
Zhongxing Xu 5c75919093 Add test for initializing array with string literal.
llvm-svn: 60281
2008-11-30 05:51:19 +00:00
Zhongxing Xu f39268ae8c Add documentation for test.
llvm-svn: 60002
2008-11-25 01:45:11 +00:00
Zhongxing Xu 2939a50b67 Add no-warning to test case.
llvm-svn: 59995
2008-11-24 23:45:56 +00:00
Zhongxing Xu 60d6cd1940 Improve test case.
llvm-svn: 59902
2008-11-23 05:50:21 +00:00
Zhongxing Xu 19cad71552 Add test cast for struct array.
llvm-svn: 59522
2008-11-18 13:30:46 +00:00
Zhongxing Xu a3b2ef6fa9 Re-enable array-struct test.
llvm-svn: 59396
2008-11-16 04:47:39 +00:00
Ted Kremenek 7d5389e4b3 - Revert r59229 and r59232: AllocRegion should be immutable.
- Temporarily disabled test Analysis/array-struct.c for region store.

llvm-svn: 59245
2008-11-13 15:42:31 +00:00
Zhongxing Xu e9857ddcc0 Add test for unsigned array index.
llvm-svn: 59239
2008-11-13 09:20:05 +00:00
Zhongxing Xu b9ec8f555f Add test for incomplete struct pointer.
llvm-svn: 59236
2008-11-13 08:44:52 +00:00
Zhongxing Xu 06a04bd1ae Add a test case for alloca().
llvm-svn: 59233
2008-11-13 07:59:15 +00:00
Argyrios Kyrtzidis a848ced426 Append the test runs with '&&'.
llvm-svn: 58851
2008-11-07 14:28:18 +00:00
Zhongxing Xu de297f8198 Add function side-effect test cast.
llvm-svn: 58565
2008-11-02 13:17:44 +00:00
Zhongxing Xu 87bfa4340c Add test code for array initialization.
llvm-svn: 58502
2008-10-31 10:23:14 +00:00
Zhongxing Xu 7a2ce566bc Add test for SCA region store.
llvm-svn: 58234
2008-10-27 09:19:25 +00:00
Zhongxing Xu 80422b07c5 Add StringLiteral test code.
llvm-svn: 58136
2008-10-25 14:11:23 +00:00
Zhongxing Xu d2f0c7b37b Add random array and struct test code for SCA.
llvm-svn: 58085
2008-10-24 08:51:58 +00:00
Zhongxing Xu 0dd213f8f5 Add test case for array and struct variable lvalue evaluation.
llvm-svn: 57670
2008-10-17 05:19:52 +00:00