summaryrefslogtreecommitdiff
path: root/lib/Analysis/RegionStore.cpp
Commit message (Collapse)AuthorAge
...
* Add getSize() support for StringRegion.Zhongxing Xu2008-11-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59930 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up code by using utility methods.Zhongxing Xu2008-11-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59899 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove debug code.Zhongxing Xu2008-11-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59870 91177308-0d34-0410-b5e6-96231b3b80d8
* Initial support for checking out of bound memory access. Only support Zhongxing Xu2008-11-22
| | | | | | | ConcreteInt index for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59869 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for symbolicating global structs and arrays in ↵Zhongxing Xu2008-11-19
| | | | | | RegionStoreManager::getInitialStore(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59619 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix warning about RegionStoreManager::Retrieve() not always returning a value.Ted Kremenek2008-11-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59571 91177308-0d34-0410-b5e6-96231b3b80d8
* handle the case that the array element is of structure type when bind the ↵Zhongxing Xu2008-11-18
| | | | | | whole array to a single value (for example, UnknownVal, UndefinedVal). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59521 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhance modularization: return a <state,loc> pair to let GRExprEngine modify theZhongxing Xu2008-11-16
| | | | | | | environment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59407 91177308-0d34-0410-b5e6-96231b3b80d8
* Enhances SCA to process untyped region to typed region conversion.Zhongxing Xu2008-11-16
| | | | | | | | | | | | | - RegionView and RegionViewMap is introduced to assist back-mapping from super region to subregions. - GDM is used to carry RegionView information. - AnonTypedRegion is added to represent a typed region introduced by pointer casting. Later AnonTypedRegion can be used in other similar cases, e.g., malloc()'ed region. - The specific conversion is delegated to store manager. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59382 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve zero value generation.Zhongxing Xu2008-11-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59356 91177308-0d34-0410-b5e6-96231b3b80d8
* Process array base expression of any type.Zhongxing Xu2008-11-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59240 91177308-0d34-0410-b5e6-96231b3b80d8
* Array index might be unsigned. We have to generate a temporary signed value forZhongxing Xu2008-11-13
| | | | | | | it to be evaluated by APSInt::operators. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59238 91177308-0d34-0410-b5e6-96231b3b80d8
* Incomplete struct pointer can be used as a function argument.Zhongxing Xu2008-11-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59235 91177308-0d34-0410-b5e6-96231b3b80d8
* StoreManager::BindDecl now takes an SVal* for the initialization value ↵Ted Kremenek2008-11-12
| | | | | | instead of an Expr* (which can be null). Lazy symbolication of conjured symbols is now the sole responsibility of GRExprEngine. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59151 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement RegionStoreManager::RemoveDeadBindings(). This prunes several ↵Zhongxing Xu2008-11-10
| | | | | | false warning caused by removal of symbolic constraints. Currently we just mark all symbols live. Further optimization for dead binding removal needed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58982 91177308-0d34-0410-b5e6-96231b3b80d8
* Finish the implementation of VisitCompoundLiteralExpr. As VisitInitListExpr is Zhongxing Xu2008-11-07
| | | | | | | | | | available, things get much simplified. One addition is that CompoundLiteralExpr can appear both in rvalue and lvalue context. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58837 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the assertion real.Zhongxing Xu2008-11-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58833 91177308-0d34-0410-b5e6-96231b3b80d8
* 1. When a pointer to struct is used as an argument, GRSimpleVals::EvalCall()Zhongxing Xu2008-11-02
| | | | | | | | | | | | sets the whole struct to Unknown. Then we cannot assume the V passed to BindStruct() is always a CompoundVal. When it is an UnknownVal, we call BindStructToVal(UnknownVal). 2. Change the signature of InitializeStructToUndefined() to BindStructToVal() to reuse the code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58564 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify interface. We can get canonical type from the base region directly. ↵Zhongxing Xu2008-10-31
| | | | | | No need for an extra type argument. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58507 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement struct initialization for SCA.Zhongxing Xu2008-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58506 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement array initialization for SCA.Zhongxing Xu2008-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58504 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement BindStruct and fix a bug in RetriveStruct.Zhongxing Xu2008-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58496 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement load from struct region. Instead of returning an UnknownVal(), we ↵Zhongxing Xu2008-10-31
| | | | | | create a CompoundVal by loading from each field of the struct. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58494 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename: AddDecl => BindDeclZhongxing Xu2008-10-29
| | | | | | | | | BindDecl better describes what the function does: - Bind the VarDecl to its memory region - Bind the memory region to some initial value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58359 91177308-0d34-0410-b5e6-96231b3b80d8
* Added preliminary support for CompoundLiterals in the static analyzer:Ted Kremenek2008-10-27
| | | | | | | | | | | | | | | | | | | | | | - 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58277 91177308-0d34-0410-b5e6-96231b3b80d8
* Use ASTContext::getCanonicalType() to get TypedRegion's type.Zhongxing Xu2008-10-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58247 91177308-0d34-0410-b5e6-96231b3b80d8
* We cannot get precise lvalue for symbolic base array region.Zhongxing Xu2008-10-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58243 91177308-0d34-0410-b5e6-96231b3b80d8
* Get the canonical type for struct initialization. The original code would ↵Zhongxing Xu2008-10-27
| | | | | | crash on TypedefType. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58236 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove loc::StringLiteralVal. Now we allocate regions for string literals in ↵Zhongxing Xu2008-10-26
| | | | | | the Store. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58182 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify ArrayToPointer conversion. Actually the only thing we need to do is ↵Zhongxing Xu2008-10-26
| | | | | | to get the first element region. It is not necessary to care about the kind of the base array region. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58181 91177308-0d34-0410-b5e6-96231b3b80d8
* Add code for get the lvalue for string literals. Now we return a StringRegionZhongxing Xu2008-10-25
| | | | | | | | for StringLiteral lvalue evaluation, instead of directly returning a loc::StringLiteralVal by the Environment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58138 91177308-0d34-0410-b5e6-96231b3b80d8
* Added method "getSelfRegion" to Store. This method returns the region ↵Ted Kremenek2008-10-24
| | | | | | associated with the "this" or "self" object (C++ and Objective-C respectively). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58107 91177308-0d34-0410-b5e6-96231b3b80d8
* The Decl of an array region can be VarDecl or FieldDecl. Handle this in ↵Zhongxing Xu2008-10-24
| | | | | | RegionStoreManager::ArrayToPointer(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58086 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement struct initialization. Make it into a recursive function. Also makeZhongxing Xu2008-10-24
| | | | | | | the array initialization code into a function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58083 91177308-0d34-0410-b5e6-96231b3b80d8
* Add printing method to RegionStoreManager.Zhongxing Xu2008-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58074 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix 80-col violation.Zhongxing Xu2008-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58070 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a bunch of dummy methods to make RegionStoreManager non-virtual.Zhongxing Xu2008-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58061 91177308-0d34-0410-b5e6-96231b3b80d8
* Added getLValueElement() to RegionStore. Only handle constant array for now.Zhongxing Xu2008-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58058 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the analyzer store (memory model) a command line option.Ted Kremenek2008-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58056 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a bunch of getLValue* methods to RegionStore.Zhongxing Xu2008-10-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57977 91177308-0d34-0410-b5e6-96231b3b80d8
* Preliminary support for function overloadingDouglas Gregor2008-10-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57909 91177308-0d34-0410-b5e6-96231b3b80d8
* Modify Store interface: GetSVal/SetSVal => Retrieve/Bind.Zhongxing Xu2008-10-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57896 91177308-0d34-0410-b5e6-96231b3b80d8
* Process decls in RegionStore. Individual elements of fixed size arrays areZhongxing Xu2008-10-21
| | | | | | | initialized to UndefinedVal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57892 91177308-0d34-0410-b5e6-96231b3b80d8
* - constify some uses of MemRegion* (MemRegion should be immutable).Ted Kremenek2008-10-17
| | | | | | | | | | - 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) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57717 91177308-0d34-0410-b5e6-96231b3b80d8
* This patch did the following renaming. There should be no functional changes.Zhongxing Xu2008-10-17
| | | | | | | | | | | RVal => SVal LVal => Loc NonLVal => NonLoc lval => loc nonlval => nonloc git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57671 91177308-0d34-0410-b5e6-96231b3b80d8
* This is the first step to implement a field-sensitive store model. Other ↵Zhongxing Xu2008-10-08
things are simplified: no heap shape assumption, no parameter alias assumption, etc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57285 91177308-0d34-0410-b5e6-96231b3b80d8