aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker/RegionStore.cpp
AgeCommit message (Collapse)Author
2010-12-22[analyzer] Refactoring: lib/Checker -> lib/GR and libclangChecker -> ↵Argyrios Kyrtzidis
libclangGRCore git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122421 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22[analyzer] Refactoring: include/clang/Checker -> include/clang/GRArgyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122420 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22The base type is not always pointer type. We may cast to a base reference.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122393 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10It's kindof silly that ExtQuals has an ASTContext&, and we can use thatJohn McCall
space better. Remove this reference. To make that work, change some APIs (most importantly, getDesugaredType()) to take an ASTContext& if they need to return a QualType. Simultaneously, diminish the need to return a QualType by introducing some useful APIs on SplitQualType, which is just a std::pair<const Type *, Qualifiers>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121478 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02Merge ValueManager into SValBuilder.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120696 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01Rename all 'EvalXXX' methods in libChecker toTed Kremenek
'evalXXX'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120609 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01Rename 'SValuator' to 'SValBuilder'. The new nameTed Kremenek
reflects what the class actually does. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120605 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-26Rename CXXObjectRegion to CXXTempObjectRegion.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120176 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-26Regionstore: support derived-to-base cast by creating a CXXBaseObjectRegion.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120173 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24Adjust method calls to reflect name changes inTed Kremenek
ImmutableSet/ImmtuableMap/ImmutableList APIs. Along the way, clean up some method names in the static analyzer so that they are more descriptive and/or start with lowercase letters. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120071 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20Handle CFGAutomaticObjDtor. Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119897 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-11RegionStore/BasicStore: do not return UndefinedVal for accesses to concrete ↵Ted Kremenek
addresses; instead return UnknownVal. This leads it up to checkers (e.g., DereferenceChecker) to guard against illegal accesses (e.g., null dereferences). Fixes PR 5272 and <rdar://problem/6839683>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118852 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26Fix lazy symbolication bug in RegionStore involving fields of global ↵Ted Kremenek
variables. When invalidated, the entire globals memory space gets assigned a symbolic value, but that value was not being used for lazy symbolication of fields of globals. This could result in cases where bogus null dereferences were being reported. Fixes PR 8440. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117336 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26Move 'includeGlobals' as a field into ClusterAnalysis.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117335 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15Disallow the use of UnknownVal as the index for ElementRegions. UnknownVals ↵Ted Kremenek
can be used as the index when the value evaluation isn't powerful enough. By creating ElementRegions with UnknownVals as the index, this gives the false impression that they are the same element, when they really aren't. This becomes really problematic when deriving symbols from these regions (e.g., those representing the initial value of the index), since two different indices will get the same symbol for their binding. This fixes an issue with the idempotent operations checker that would cause two indices that are clearly not the same to make it appear as if they always had the same value. Fixes <rdar://problem/8431728>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113920 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-14Adjust assertion in RegionStoreManager::RetrieveArray() to also take into ↵Ted Kremenek
account typedefs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113893 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-14Don't divide-by-zero in RegionStoreManager::getSizeInElements() when getting ↵Ted Kremenek
the size of a VLA. We don't track VLA extents yet, but we should at least not crash. Fixes <rdar://problem/8424269>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113888 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02Fixed unused variable warning.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112784 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01Partial fix for PR 8015 (fix is actually by Jordy Rose, and I added a test ↵Ted Kremenek
case for follow-on work). This patch adds a bandaid for RegionStore's limited reasoning about symbolic array values. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112766 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01Don't assert in the analyzer when analyze code does a byte load from a ↵Ted Kremenek
function's address. Fixes PR 8052. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112761 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall
to the new constants. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112047 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23Adjust code placement.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111790 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21Place method near its class.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111737 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21Remove dead code.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111736 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21Improve comments.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111735 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21Remove a special case for OSAtomic functions. We can already bind and retrieveZhongxing Xu
with the same binding key. The only trick here is that sometimes the Symbolic region is stored in with an LocAsInteger wrapper. We unwrap that in SVal::getAsLocSymbol(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111734 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21Remove dead code. We no longer need it because now we treat the first elementZhongxing Xu
region and its base region as the same binding key. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111732 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21remove unused variable.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111731 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21When invalidating a struct region, whether its type definition exists is notZhongxing Xu
relavant any more, because we set its default value to a symbol, and the type of default symbolic value is irrelavant. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111730 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20Remove dead code.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111616 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20Handle nested compound values in BindArray for multidimensional arrays. ↵Jordy Rose
Fixes PR7945. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111602 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17Rewrite code fragment to avoide ICE in MSVC. Fixes PR 7875. Patch by ↵Ted Kremenek
Dimitry Andric! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111327 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17Convert all uses of StringLiteral::getStrData() to StringLiteral::getString()Benjamin Kramer
and remove getStrData(). Patch by Peter Davies (with some tweaks). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111229 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16Instead of using operator bool() for testing if a BindingKey is valid, use ↵Jordy Rose
an explicit isValid() method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111181 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16- Allow making ElementRegions with complex offsets (expressions or symbols) ↵Jordy Rose
for the purpose of bounds-checking. - Rewrite GRState::AssumeInBound to actually do that checking, and to use the normal constraint path. - Remove ConstraintManager::AssumeInBound. - Teach RegionStore and FlatStore to ignore those regions for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111116 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15StoreManager::RemoveDeadBindings() can take a Store instead of an entire ↵Zhongxing Xu
GRState now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111103 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-15Remove redundant method.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111099 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14Add a callback for when region changes occur. Still somewhat of a ↵Jordy Rose
work-in-progress, but working! Effect on clients: all changes to a store now go through GRState. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111078 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11MemRegion can refer to ASTContext without external help.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110784 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05Remove InvalidateRegion from stores, since it's no longer called from outside.Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110309 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03Makes GRState::makeWithStore private, to encourage clients to make store ↵Jordy Rose
changes through GRState instead of directly accessing the StoreManager. Also adds cover methods for InvalidateRegion(s) and EnterStackFrame to GRState. This is in preparation for proposed region change notifications. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110137 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02Improve flat store: MemRegion::getAsOffset() computes a region's offset withinZhongxing Xu
the top-level object. FlatStore now can bind and retrieve element and field regions. PR7297 is fixed by flat store. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110020 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29Use a LazyCompoundVal to handle initialization with a string literal, rather ↵Jordy Rose
than copying each character. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109734 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29Augment RegionStore::BindStruct() to bind symbolicated struct values. This ↵Ted Kremenek
fixes a false path issue reported in <rdar://problem/8243408> and also spurs another cause where the idempotent operations checker fires. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109710 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-06Fix casts in RegionStore to not always assume that bindings are only to ↵Ted Kremenek
SubRegions. Fixes assertion failure reported in PR 7572. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107738 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-04Add a new symbol type, SymbolExtent, to represent the extents of memory ↵Jordy Rose
regions that may not be known at compile-time (such as those created by malloc). This replaces the old setExtent/getExtent API on Store, which used the GRState's GDM to store SVals. Also adds a getKnownValue() method to SValuator, which gets the integer value of an SVal if it is known to only have one possible value. There are more places in the code that could be using this, but in general we want to be dealing entirely in SVals, so its usefulness is limited. The only visible functionality change is that extents are now honored for any DeclRegion, such as fields and Objective-C ivars, rather than just variables. This shows up in bounds-checking and cast-size-checking. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107577 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01Fix PR 7475 by enhancing the static analyzer to also invalidate bindings for ↵Ted Kremenek
non-static global variables when calling a function/method whose impact on global variables we cannot accurately estimate. This change introduces two new MemSpaceRegions that divide up the memory space of globals, and causes RegionStore and BasicStore to consult a binding to the NonStaticGlobalsMemSpaceRegion when lazily determining the value of a global. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107423 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-01Add an ivar to SymbolReaper for the current statement, and then stop passing ↵Jordy Rose
the current statement around everywhere. Preparation for symbolic extents. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107422 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-28Pointer comparisons (and pointer-pointer subtraction). Basically filling in ↵Jordy Rose
SimpleSValuator::EvalBinOpLL(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106992 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-25When a constant size array is casted to another type, its length should be ↵Jordy Rose
scaled as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106911 91177308-0d34-0410-b5e6-96231b3b80d8