summaryrefslogtreecommitdiffstats
path: root/clang/lib/Checker/RegionStore.cpp
Commit message (Collapse)AuthorAgeFilesLines
* It's kindof silly that ExtQuals has an ASTContext&, and we can use thatJohn McCall2010-12-101-1/+1
| | | | | | | | | | 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>. llvm-svn: 121478
* Merge ValueManager into SValBuilder.Ted Kremenek2010-12-021-45/+46
| | | | llvm-svn: 120696
* Rename all 'EvalXXX' methods in libChecker toTed Kremenek2010-12-011-3/+3
| | | | | | 'evalXXX'. llvm-svn: 120609
* Rename 'SValuator' to 'SValBuilder'. The new nameTed Kremenek2010-12-011-5/+5
| | | | | | reflects what the class actually does. llvm-svn: 120605
* Rename CXXObjectRegion to CXXTempObjectRegion.Zhongxing Xu2010-11-261-1/+1
| | | | llvm-svn: 120176
* Regionstore: support derived-to-base cast by creating a CXXBaseObjectRegion.Zhongxing Xu2010-11-261-0/+12
| | | | llvm-svn: 120173
* Adjust method calls to reflect name changes inTed Kremenek2010-11-241-49/+54
| | | | | | | | | | 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. llvm-svn: 120071
* Handle CFGAutomaticObjDtor. Zhongxing Xu2010-11-201-1/+1
| | | | llvm-svn: 119897
* RegionStore/BasicStore: do not return UndefinedVal for accesses to concrete ↵Ted Kremenek2010-11-111-4/+9
| | | | | | | | | | 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>. llvm-svn: 118852
* Fix lazy symbolication bug in RegionStore involving fields of global ↵Ted Kremenek2010-10-261-4/+14
| | | | | | | | | | | 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. llvm-svn: 117336
* Move 'includeGlobals' as a field into ClusterAnalysis.Ted Kremenek2010-10-261-8/+12
| | | | llvm-svn: 117335
* Disallow the use of UnknownVal as the index for ElementRegions. UnknownVals ↵Ted Kremenek2010-09-151-5/+9
| | | | | | | | | | | | | | | | | 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>. llvm-svn: 113920
* Adjust assertion in RegionStoreManager::RetrieveArray() to also take into ↵Ted Kremenek2010-09-141-1/+1
| | | | | | account typedefs. llvm-svn: 113893
* Don't divide-by-zero in RegionStoreManager::getSizeInElements() when getting ↵Ted Kremenek2010-09-141-0/+8
| | | | | | | | the size of a VLA. We don't track VLA extents yet, but we should at least not crash. Fixes <rdar://problem/8424269>. llvm-svn: 113888
* Fixed unused variable warning.Ted Kremenek2010-09-021-1/+1
| | | | llvm-svn: 112784
* Partial fix for PR 8015 (fix is actually by Jordy Rose, and I added a test ↵Ted Kremenek2010-09-011-1/+6
| | | | | | case for follow-on work). This patch adds a bandaid for RegionStore's limited reasoning about symbolic array values. llvm-svn: 112766
* Don't assert in the analyzer when analyze code does a byte load from a ↵Ted Kremenek2010-09-011-0/+4
| | | | | | function's address. Fixes PR 8052. llvm-svn: 112761
* GCC didn't care for my attempt at API compatibility, so brute-force everythingJohn McCall2010-08-251-2/+2
| | | | | | to the new constants. llvm-svn: 112047
* Adjust code placement.Zhongxing Xu2010-08-231-8/+8
| | | | llvm-svn: 111790
* Place method near its class.Zhongxing Xu2010-08-211-12/+13
| | | | llvm-svn: 111737
* Remove dead code.Zhongxing Xu2010-08-211-12/+0
| | | | llvm-svn: 111736
* Improve comments.Zhongxing Xu2010-08-211-6/+1
| | | | llvm-svn: 111735
* Remove a special case for OSAtomic functions. We can already bind and retrieveZhongxing Xu2010-08-211-7/+1
| | | | | | | | 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(). llvm-svn: 111734
* Remove dead code. We no longer need it because now we treat the first elementZhongxing Xu2010-08-211-34/+0
| | | | | | region and its base region as the same binding key. llvm-svn: 111732
* remove unused variable.Zhongxing Xu2010-08-211-1/+1
| | | | llvm-svn: 111731
* When invalidating a struct region, whether its type definition exists is notZhongxing Xu2010-08-211-9/+2
| | | | | | | relavant any more, because we set its default value to a symbol, and the type of default symbolic value is irrelavant. llvm-svn: 111730
* Remove dead code.Ted Kremenek2010-08-201-23/+2
| | | | llvm-svn: 111616
* Handle nested compound values in BindArray for multidimensional arrays. ↵Jordy Rose2010-08-201-0/+2
| | | | | | Fixes PR7945. llvm-svn: 111602
* Rewrite code fragment to avoide ICE in MSVC. Fixes PR 7875. Patch by ↵Ted Kremenek2010-08-171-2/+4
| | | | | | Dimitry Andric! llvm-svn: 111327
* Convert all uses of StringLiteral::getStrData() to StringLiteral::getString()Benjamin Kramer2010-08-171-1/+1
| | | | | | and remove getStrData(). Patch by Peter Davies (with some tweaks). llvm-svn: 111229
* Instead of using operator bool() for testing if a BindingKey is valid, use ↵Jordy Rose2010-08-161-4/+4
| | | | | | an explicit isValid() method. llvm-svn: 111181
* - Allow making ElementRegions with complex offsets (expressions or symbols) ↵Jordy Rose2010-08-161-5/+14
| | | | | | | | | | 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. llvm-svn: 111116
* StoreManager::RemoveDeadBindings() can take a Store instead of an entire ↵Zhongxing Xu2010-08-151-8/+6
| | | | | | GRState now. llvm-svn: 111103
* Remove redundant method.Zhongxing Xu2010-08-151-19/+12
| | | | llvm-svn: 111099
* Add a callback for when region changes occur. Still somewhat of a ↵Jordy Rose2010-08-141-5/+18
| | | | | | work-in-progress, but working! Effect on clients: all changes to a store now go through GRState. llvm-svn: 111078
* MemRegion can refer to ASTContext without external help.Zhongxing Xu2010-08-111-19/+15
| | | | llvm-svn: 110784
* Remove InvalidateRegion from stores, since it's no longer called from outside.Jordy Rose2010-08-051-8/+2
| | | | llvm-svn: 110309
* Makes GRState::makeWithStore private, to encourage clients to make store ↵Jordy Rose2010-08-031-6/+5
| | | | | | | | 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. llvm-svn: 110137
* Improve flat store: MemRegion::getAsOffset() computes a region's offset withinZhongxing Xu2010-08-021-2/+2
| | | | | | | | the top-level object. FlatStore now can bind and retrieve element and field regions. PR7297 is fixed by flat store. llvm-svn: 110020
* Use a LazyCompoundVal to handle initialization with a string literal, rather ↵Jordy Rose2010-07-291-35/+12
| | | | | | than copying each character. llvm-svn: 109734
* Augment RegionStore::BindStruct() to bind symbolicated struct values. This ↵Ted Kremenek2010-07-291-6/+8
| | | | | | fixes a false path issue reported in <rdar://problem/8243408> and also spurs another cause where the idempotent operations checker fires. llvm-svn: 109710
* Fix casts in RegionStore to not always assume that bindings are only to ↵Ted Kremenek2010-07-061-4/+4
| | | | | | | | SubRegions. Fixes assertion failure reported in PR 7572. llvm-svn: 107738
* Add a new symbol type, SymbolExtent, to represent the extents of memory ↵Jordy Rose2010-07-041-115/+12
| | | | | | | | | | 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. llvm-svn: 107577
* Fix PR 7475 by enhancing the static analyzer to also invalidate bindings for ↵Ted Kremenek2010-07-011-28/+78
| | | | | | | | | | | 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. llvm-svn: 107423
* Add an ivar to SymbolReaper for the current statement, and then stop passing ↵Jordy Rose2010-07-011-7/+6
| | | | | | the current statement around everywhere. Preparation for symbolic extents. llvm-svn: 107422
* Pointer comparisons (and pointer-pointer subtraction). Basically filling in ↵Jordy Rose2010-06-281-0/+13
| | | | | | SimpleSValuator::EvalBinOpLL(). llvm-svn: 106992
* When a constant size array is casted to another type, its length should be ↵Jordy Rose2010-06-251-4/+9
| | | | | | scaled as well. llvm-svn: 106911
* Change RegionStoreManager::Retrieve to infer the type of a symbolic region ↵Tom Care2010-06-251-1/+6
| | | | | | from the context when it is not already available. llvm-svn: 106868
* Correctly construct an ElementRegion for alloca() + pointer arithmetic. ↵Ted Kremenek2010-06-221-2/+1
| | | | | | | | Fixes analyzer crash reported in PR 7450. llvm-svn: 106609
* Implement RegionStoreManager::iterBindings(). This implementation only ↵Ted Kremenek2010-06-171-6/+11
| | | | | | | | | | returns the base region in the binding key instead of the region + offset. It isn't clear if this is the best semantics, but most clients will likely only care about simple bindings, or bindings to a particular variable. We can refine later if necessary. llvm-svn: 106183
OpenPOWER on IntegriCloud