aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/RegionStore.cpp
AgeCommit message (Collapse)Author
2009-04-03This is the first step to gradually remove the use of loc::SymbolVal. NowZhongxing Xu
when creating symbolic values, we distinguish between location and non-location values. For location values, we create a symbolic region instead of a loc::SymbolVal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68373 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30Re-apply 68028. The code had drifted enough that the tests would fail withoutTed Kremenek
it. Will discuss offline whether symbolic regions should by typed or typeless. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68070 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30Revert 68028.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68068 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30Make SymbolicRegion untyped.Zhongxing Xu
Layer the type information with a TypedViewRegion on top of the SymbolicRegion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68028 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30Implement a FIXME.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68024 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27remove dead code.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67825 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-26analyzer infrastructure: make a bunch of changes to symbolic expressions thatTed Kremenek
Zhongxing and I discussed by email. Main changes: - Removed SymIntConstraintVal and SymIntConstraint - Added SymExpr as a parent class to SymbolData, SymSymExpr, SymIntExpr - Added nonloc::SymExprVal to wrap SymExpr - SymbolRef is now just a typedef of 'const SymbolData*' - Bunch of minor code cleanups in how some methods were invoked (no functionality change) This changes are part of a long-term plan to have full symbolic expression trees. This will be useful for lazily evaluating complicated expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67731 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18Use a work list to recursively build up the subregion mapping, and mark liveZhongxing Xu
var region roots. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67152 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13Updated comment.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66894 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13Fix failure reported by Sebastian of test/Analysis/ptr-arith.c when the targetTed Kremenek
is 64-bit. I used his suggestion of doing a direct bitwidth/signedness conversion of the 'offset' instead of just changing the sign. For more information, see: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2009-March/004587.html git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12Use getAsRecordType() to get around sugar types.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66768 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11Do not stipulate the record type is a definition in BindStruct().Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66654 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11Fix crash when LHS of pointer arithmetic is not ElementRegion.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66649 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11RegionStore::getLValueElement: Handle the case where the signedness of theTed Kremenek
offset may be different that the base. Ultimately we need a better solution for these issues, but this point-by-point fixes are gradually outlining the scope of the problem. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66638 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09RegionStore::getElementLValue(): Handle the case where the base is a null ↵Ted Kremenek
pointer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66486 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09Only track integer and pointer values.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66419 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09Now we do not retrieve untyped regions.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66418 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09Fix a serious bug in RegionStore: we got the new state with new store fromZhongxing Xu
Bind() and BindStruct(), but we returned a state with the old store. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66409 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05Add initial support for tracking ivars, with special handling for ivars of ↵Ted Kremenek
'self'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66133 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04RegionStore: Handle implicit parameters.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65987 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04RegionStore::RemoveDeadBindings needs to check all the symbols of the super ↵Ted Kremenek
region of a scanned region as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65981 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-03Don't use std::auto_ptr with getSubRegionMap().Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65957 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-03Implement FIXME: GRStateManager::scanReachableSymbols now supports scanning ↵Ted Kremenek
MemRegions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65919 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-03Add StoreManager::getSubRegionMap(). This method returns an opaque mapping ↵Ted Kremenek
for clients of StoreManagers from MemRegions to their subregions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65914 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02remove an implemented fixme.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65817 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02Initial support for pointer arithmetic. Only support concrete indexes and Zhongxing Xu
offsets for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65814 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-01Rename AnonTypedRegion to TypedViewRegion.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65764 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-24Fix <rdar://problem/6611677>: Add basic transfer function support in the staticTed Kremenek
analyzer for array subscript expressions involving bases that are vectors. This solution is probably a hack: it gets the lvalue of the vector instead of an rvalue like all other types. This should be reviewed (big FIXME in GRExprEngine). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20Add an example in comments.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65110 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-19only track integer and pointer values for now.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65041 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-19Convert the offset to signed before making an ElementRegion with it. It seemsZhongxing Xu
that this problem arises from time to time. We should find a fundamental solution for it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65035 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06SymbolicRegions really have unknown sizes.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06Create ElementRegion when the base is SymbolicRegion. This is like what we doZhongxing Xu
for FieldRegion. This enables us to track more values. Simplify SymbolicRegion::getRValueType(). We assume the symbol always has pointer type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63928 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05Make SymbolicRegion subclass TypedRegion, for symbols usually have types, so Zhongxing Xu
do the symblic regions associated with them and we need them to be typed. Current SymbolicRegion::getRValueType() method is very restricting. It may be modified when we are more clear about what could be the types of symblic regions. BasicConstraintManager::Assume() is changed due to that now SymblicRegion is a subclass of SubRegion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63844 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30Fix a couple bugs:Ted Kremenek
- NonLoc::MakeVal() would use sizeof(unsigned) (literally) instead of consulting ASTContext for the size (in bits) of 'int'. While it worked, it was a conflation of concepts and using ASTContext.IntTy is 100% correct. - RegionStore::getSizeInElements() no longer assumes that a VarRegion has the type "ConstantArray", and handles the case when uses use ordinary variables as if they were arrays. - Fixed ElementRegion::getRValueType() to just return the rvalue type of its "array region" in the case the array didn't have ArrayType. - All of this fixes <rdar://problem/6541136> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26Correct size assumption; fixes a crash on amd64.Sebastian Redl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63031 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23Implement retrieval of the default value of element and field regions.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23Now this comment should be resolved. See the comments for the KillSet.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62846 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-22For now, return UnknownVal() in RegionStore::getElementsSize() for ↵Ted Kremenek
AnonTypedRegions. It wasn't really doing the right thing and was crashing on rdar-6442306-1.m. This fix causes all path-sensitive test cases to pass with RegionStore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62816 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-22Add RegionStore support for the implicit object region that 'self' ↵Ted Kremenek
references. This causes tests 'ObjCProperties.m' and 'refcnt_naming.m' to now pass with RegionStore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62814 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-22Fix RegionStore::getLValueElement() to handle the case when the base region ↵Ted Kremenek
is not an ElementRegion (also do some cleanups of its core logic). This gets array-struct.c to work with RegionStore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62781 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-22Static analyzer: Remove a bunch of outdated SymbolData objects andTed Kremenek
their associated APIs. We no longer need separate SymbolData objects for fields, variables, etc. Instead, we now associated symbols with the "rvalue" of a MemRegion (i.e., the value stored at that region). Now we only have two kinds of SymbolData objects: SymbolRegionRValue and SymbolConjured. This cleanup also makes the distinction between a SymbolicRegion and a symbolic value that is a location much clearer. A SymbolicRegion represents a chunk of symbolic memory, while a symbolic location is just a "pointer" with different possible values. Without any specific knowledge, a symbolic location resolves (i.e., via a dereference) to a SymbolicRegion. In the future, when we do better alias reasoning, a symbolic location can become an alias for another location, thus merging the constraints on the referred SymbolicRegion with the other region. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62769 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-21Combine two branches into one. No functionality change.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62727 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-21Static Analyzer: Replace LiveSymbols/DeadSymbols sets with a new object ↵Ted Kremenek
called "SymbolReaper". Right now it just consolidates the two and cleans up some client code, but shortly it will be used to enable "lazy computation" of live symbols for use with RegionStore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-21Get RegionStore to work with the retain/release checker and its test cases.Ted Kremenek
Because the RegionStore can reason about values beyond the reasoning power of BasicStore, this patch splits some of the test cases for the retain/release checker to have versions that are handled by RegionStore (more warnings) and BasicStore (less warnings). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62667 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13add a fixme.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13Add KillStruct to region store. Zhongxing Xu
- put the killed region in the kill set. - set its default value to unknown. - removes all bindings for its subregions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13Invert condition on branch (was causing RegionStore::ArrayToPointer to ↵Ted Kremenek
return 'unknown' on most cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62129 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-07Refactor MemRegionManager instance variable into parent class. No ↵Ted Kremenek
functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-06Return UnknownVal in RegionStoreManager::getSizeInElements() for unsupported ↵Ted Kremenek
regions. This silences a warning when compiling Release-Asserts builds. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61818 91177308-0d34-0410-b5e6-96231b3b80d8