summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/BasicStore.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Added preliminary support for CompoundLiterals in the static analyzer:Ted Kremenek2008-10-271-0/+5
| | | | | | | | | | | | | | | | | | | | - 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
* Remove loc::StringLiteralVal. Now we allocate regions for string literals in ↵Zhongxing Xu2008-10-261-5/+0
| | | | | | the Store. llvm-svn: 58182
* Add code for get the lvalue for string literals. Now we return a StringRegionZhongxing Xu2008-10-251-0/+6
| | | | | | | for StringLiteral lvalue evaluation, instead of directly returning a loc::StringLiteralVal by the Environment. llvm-svn: 58138
* Added method "getSelfRegion" to Store. This method returns the region ↵Ted Kremenek2008-10-241-21/+41
| | | | | | associated with the "this" or "self" object (C++ and Objective-C respectively). llvm-svn: 58107
* Let StoreManager do different cast on arrays. BasicStore will just keep it ↵Zhongxing Xu2008-10-231-0/+2
| | | | | | intact. llvm-svn: 58028
* Adjust parameter order to more natural one.Zhongxing Xu2008-10-221-3/+3
| | | | llvm-svn: 57964
* Preliminary support for function overloadingDouglas Gregor2008-10-211-2/+2
| | | | llvm-svn: 57909
* Localize the special processing of array variable inside Zhongxing Xu2008-10-211-0/+1
| | | | | | | | | | | GRExprEngine::VisitCast() so that other parts of the analyzer can be ignorant. When we cast "array of type T" to "pointer to T", we get the loc::MemRegionVal corresponding to the array variable. This is sufficient for BasicStore, but not for RegionStore. RegionStore should get the element region for the first array element in the cast. So next comes to the revamping of transfer functions for different store model. llvm-svn: 57897
* Modify Store interface: GetSVal/SetSVal => Retrieve/Bind.Zhongxing Xu2008-10-211-11/+11
| | | | llvm-svn: 57896
* Hack: have BasicStore::getLValueElement return the "Base" lvalue. This ↵Ted Kremenek2008-10-171-15/+28
| | | | | | | | restores null dereference checking with array accesses. BasicStore::RemoveDeadBindings: handle regions besides VarRegions (we now have FieldRegions). llvm-svn: 57741
* - constify some uses of MemRegion* (MemRegion should be immutable).Ted Kremenek2008-10-171-5/+39
| | | | | | | | | - 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
* This patch did the following renaming. There should be no functional changes.Zhongxing Xu2008-10-171-61/+61
| | | | | | | | | | RVal => SVal LVal => Loc NonLVal => NonLoc lval => loc nonlval => nonloc llvm-svn: 57671
* Array and struct variables do have lvalue. For example,Zhongxing Xu2008-10-171-2/+0
| | | | | | | | | | | | | | | | | | struct s {}; void f() { int a[10]; int (*p)[10]; p = &a; (*p)[3] =1; struct s d; struct s *q; q = &d; } We return the corresponding MemRegionVal for them. llvm-svn: 57664
* Remove lval::FieldOffset, lval::ArrayOffset. These will be replaced with ↵Ted Kremenek2008-10-171-41/+25
| | | | | | | | | | | regions. Remove GRExprEngine::getLVal and RValues::MakeVal. Enhance StoreManager "GetLValue" methods to dispatch for specific kinds of lvalue queries, as opposed to interogating the expression tree (GRExprEngine already does this). Added FIXMEs. In particular, we no longer "assume" that a base pointer in a field/array access is null (this logic was removed). Perhaps we should do this when fetching the lvalue for fields and array elements? llvm-svn: 57657
* Add transfer function support for ObjCIvarRefExpr.Ted Kremenek2008-10-171-0/+6
| | | | llvm-svn: 57654
* This is the first step to build a better evaluation model for GRExprEngine. AZhongxing Xu2008-10-161-0/+32
| | | | | | | | new VisitLValue method is added to replace the old VisitLVal. The semantics model becomes more explicit to separate rvalue evaluation from lvalue evaluation. llvm-svn: 57627
* Migrate MemRegionManager from StateManager to StoreManager.Zhongxing Xu2008-10-071-10/+18
| | | | llvm-svn: 57225
* Remove redundant parameter and rename StMgr to StateMgr.Zhongxing Xu2008-10-051-14/+14
| | | | llvm-svn: 57107
* This is a big patch, but the functionality change is small and the rest of ↵Ted Kremenek2008-10-041-140/+62
| | | | | | | | | | | | | | the patch consists of deltas due to API changes. This patch overhauls the "memory region" abstraction that was prototyped (but never really used) as part of the Store.h. This patch adds MemRegion.h and MemRegion.cpp, which defines the class MemRegion and its subclasses. This classes serve to define an abstract representation of memory, with regions being layered on other regions to to capture the relationships between fields and variables, variables and the address space they are allocated in, and so on. The main motivation of this patch is that key parts of the analyzer assumed that all value bindings were to VarDecls. In the future this won't be the case, and this patch removes lval::DeclVal and replaces it with lval::MemRegionVal. Now all pieces of the analyzer must reason about abstract memory blocks instead of just variables. There should be no functionality change from this patch, but it opens the door for significant improvements to the analyzer such as field-sensitivity and object-sensitivity, both which were on hold until the memory abstraction got generalized. The memory region abstraction also allows type-information to literally be affixed to a memory region. This will allow the some now redundant logic to be removed from the retain/release checker. llvm-svn: 57042
* Store: (static analyzer)Ted Kremenek2008-09-031-28/+88
| | | | | | | | | | | | | | | | | | | | | - Change definition of store::Region and store::Binding (once again) to make them real classes that just wrap pointers. This makes them more strictly typed, and allows specific implementations of Regions/Bindings to just subclass them. - minor renamings to RegionExtent and its subclasses - added a bunch of doxygen comments StoreManager: (static analyzer) - added 'iterBindings', an iteration method for iterating over the bindings of a store. It that takes a callback object (acting like a poor man's closure). - added 'getRVal' version for store::Binding. Will potentially phase the other versions of GetRVal in StoreManager out. - reimplemented 'getBindings' to be non-virtual and to use 'iterBindings' BasicStoreManager: (static analyzer) - implemented 'iterBindings' for BasicStoreManager llvm-svn: 55688
* Added "getBindings" and "BindingAsString" to GRStateManager and StoreManager.Ted Kremenek2008-08-291-0/+34
| | | | | | | Migrated CFRefCount.cpp to use getBindings and BindingsAsString instead of making assumptions about the Store (removed dependence on GRState::vb_iterator). llvm-svn: 55522
* Remove BasicStore.h (migrated function prototype for CreateBasicStore() to ↵Ted Kremenek2008-08-281-1/+0
| | | | | | Store.h) llvm-svn: 55519
* Make store "Regions" and "Bindings" more abstract instead of concrete variants.Ted Kremenek2008-08-281-12/+22
| | | | | | | | Their precise semantics will be implemented by a specific StoreManager. Use function pointer to create the StoreManager in GRStateManager. This matches how we create ConstraintsManager. llvm-svn: 55514
* Added 'extents' for Regions.Ted Kremenek2008-08-251-26/+17
| | | | | | | Added 'getExtent()' to StoreManager. Implemented 'getExtent()' for BasicStoreManager. llvm-svn: 55321
* Simplify interface to Store::AddDeclTed Kremenek2008-08-231-5/+9
| | | | llvm-svn: 55213
* Move the handling of DeclStmt from GRExprEngine to BasicStoreManager.Zhongxing Xu2008-08-211-1/+68
| | | | llvm-svn: 55144
* Move store pretty-printing logic inside of StoreManager (previously in GRState).Ted Kremenek2008-08-191-1/+22
| | | | llvm-svn: 55013
* Patch by Zhongxing Xu!Ted Kremenek2008-08-191-3/+37
| | | | | | | This patch extends BasicStoreManager::getInitialStore() to include code that symbolicates input variables. It also removes redundant handling of ImplicitParamDecl, since it is a subclass of VarDecl. llvm-svn: 54993
* Moved RemoveDeadBindings logic for the contents of 'Store' to a virtual ↵Ted Kremenek2008-07-171-17/+78
| | | | | | RemoveDeadBindings method in StoreManager. llvm-svn: 53726
* Refactored most of the "Store" piece of ValueState into a Store type. TheTed Kremenek2008-07-101-0/+141
current store implementation is now encapsulated by BasicStore. These changes prompted some long due constification of ValueState. Much of the diffs in this patch include adding "const" qualifiers. llvm-svn: 53423
OpenPOWER on IntegriCloud