Commit Graph

25 Commits

Author SHA1 Message Date
Zhongxing Xu ce71638c0d Implement BindStruct and fix a bug in RetriveStruct.
llvm-svn: 58496
2008-10-31 08:10:01 +00:00
Zhongxing Xu 6c0d588942 Implement load from struct region. Instead of returning an UnknownVal(), we create a CompoundVal by loading from each field of the struct.
llvm-svn: 58494
2008-10-31 07:16:08 +00:00
Zhongxing Xu 628ae879ea Rename: AddDecl => BindDecl
BindDecl better describes what the function does:
  - Bind the VarDecl to its memory region
  - Bind the memory region to some initial value.

llvm-svn: 58359
2008-10-29 02:34:02 +00:00
Ted Kremenek bf26368255 Added preliminary support for CompoundLiterals in the static analyzer:
- GRExprEngine::VisitCompoundLiteral...
   (1) visits the initializer list (generating ExplodedNodes)
   (2) creates a CompoundMemRegion for the literal
   (3) creates a new state with the bound literal values using
       GRStateManager::BindCompoundLiteral

- GRStateManager::BindCompoundLiteral simply calls 
  StoreManager::BindCompoundLiteral to get a new store and returns a persistent
  GRState with that store.

- BasicStore::BindCompoundLiteral simply returns the same store, as it
  doesn't handle field sensitivity
  
- RegionStore::BindCompoundLiteral currently fires an assert (pending discussion
  of how to best implement mappings for CompoundLiteralRegion).

llvm-svn: 58277
2008-10-27 21:54:31 +00:00
Zhongxing Xu 144d7554c4 Use ASTContext::getCanonicalType() to get TypedRegion's type.
llvm-svn: 58247
2008-10-27 13:35:03 +00:00
Zhongxing Xu 36d4ade4be We cannot get precise lvalue for symbolic base array region.
llvm-svn: 58243
2008-10-27 12:23:17 +00:00
Zhongxing Xu bb18b57f53 Get the canonical type for struct initialization. The original code would crash on TypedefType.
llvm-svn: 58236
2008-10-27 09:24:07 +00:00
Zhongxing Xu 60de6c6c63 Remove loc::StringLiteralVal. Now we allocate regions for string literals in the Store.
llvm-svn: 58182
2008-10-26 02:27:21 +00:00
Zhongxing Xu bf47dc85fe Simplify ArrayToPointer conversion. Actually the only thing we need to do is to get the first element region. It is not necessary to care about the kind of the base array region.
llvm-svn: 58181
2008-10-26 02:23:57 +00:00
Zhongxing Xu 0d2706f6b8 Add code for get the lvalue for string literals. Now we return a StringRegion
for StringLiteral lvalue evaluation, instead of directly returning a
loc::StringLiteralVal by the Environment.

llvm-svn: 58138
2008-10-25 14:18:57 +00:00
Ted Kremenek f3be44f191 Added method "getSelfRegion" to Store. This method returns the region associated with the "this" or "self" object (C++ and Objective-C respectively).
llvm-svn: 58107
2008-10-24 20:32:16 +00:00
Zhongxing Xu e834fc1249 The Decl of an array region can be VarDecl or FieldDecl. Handle this in RegionStoreManager::ArrayToPointer().
llvm-svn: 58086
2008-10-24 09:06:51 +00:00
Zhongxing Xu 729518be3a Implement struct initialization. Make it into a recursive function. Also make
the array initialization code into a function.

llvm-svn: 58083
2008-10-24 08:42:28 +00:00
Zhongxing Xu 1359e00f9c Add printing method to RegionStoreManager.
llvm-svn: 58074
2008-10-24 06:01:33 +00:00
Zhongxing Xu c7796d347d Fix 80-col violation.
llvm-svn: 58070
2008-10-24 04:33:15 +00:00
Zhongxing Xu cebb741f68 Add a bunch of dummy methods to make RegionStoreManager non-virtual.
llvm-svn: 58061
2008-10-24 01:38:55 +00:00
Zhongxing Xu a8d2cbe47f Added getLValueElement() to RegionStore. Only handle constant array for now.
llvm-svn: 58058
2008-10-24 01:09:32 +00:00
Ted Kremenek 6779f893b9 Make the analyzer store (memory model) a command line option.
llvm-svn: 58056
2008-10-24 01:04:59 +00:00
Zhongxing Xu 2fbc35443d Add a bunch of getLValue* methods to RegionStore.
llvm-svn: 57977
2008-10-22 13:44:38 +00:00
Douglas Gregor 5251f1b283 Preliminary support for function overloading
llvm-svn: 57909
2008-10-21 16:13:35 +00:00
Zhongxing Xu 8f6855e642 Modify Store interface: GetSVal/SetSVal => Retrieve/Bind.
llvm-svn: 57896
2008-10-21 06:27:32 +00:00
Zhongxing Xu 83aff7079f Process decls in RegionStore. Individual elements of fixed size arrays are
initialized to UndefinedVal.

llvm-svn: 57892
2008-10-21 05:29:26 +00:00
Ted Kremenek 8b103c65c6 - constify some uses of MemRegion* (MemRegion should be immutable).
- Added new region "SymbolicRegion", which maps symbol values to the region domain.
- Enhanced BasicStore::getFieldLValue() to return a FieldRegion (using SymbolicRegion)
- Added some utility methods to GRState for fetch svals from the store.
- Fixed regression in CheckNSError (we weren't getting the value bound to the parameter)

llvm-svn: 57717
2008-10-17 20:28:54 +00:00
Zhongxing Xu 27f174214d This patch did the following renaming. There should be no functional changes.
RVal => SVal
LVal => Loc
NonLVal => NonLoc
lval => loc
nonlval => nonloc

llvm-svn: 57671
2008-10-17 05:57:07 +00:00
Zhongxing Xu d9959aee34 This is the first step to implement a field-sensitive store model. Other things are simplified: no heap shape assumption, no parameter alias assumption, etc.
llvm-svn: 57285
2008-10-08 02:50:44 +00:00