summaryrefslogtreecommitdiffstats
path: root/clang/lib/Checker/RegionStore.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Limit the use of BindDefault().Zhongxing Xu2010-06-011-1/+5
| | | | llvm-svn: 105265
* Add support for calloc() in MallocChecker. Patch by Jordy Rose, with my Zhongxing Xu2010-06-011-1/+6
| | | | | | modification. llvm-svn: 105264
* After conversations with Zhongxing Xu and Jordy Rose, refine the logic inTed Kremenek2010-05-311-19/+25
| | | | | | | | | RegionStoreManager::RetrieveElement() that handles indexing into a larger scalar object to only consult the direct binding of a super region if it is a scalar. This isn't perfect yet, and a big FIXME is attached to the code. This causes the test case for PR 7218 now to pass. llvm-svn: 105195
* Revert r105097. Thinking about a better fix.Zhongxing Xu2010-05-291-18/+5
| | | | llvm-svn: 105099
* Fix PR7218. Patch by Jordy Rose.Zhongxing Xu2010-05-291-3/+17
| | | | llvm-svn: 105097
* Small fix.Zhongxing Xu2010-05-261-1/+1
| | | | llvm-svn: 104669
* Remove extents of dead symbolic regions when RemoveDeadBindings.Zhongxing Xu2010-05-261-7/+15
| | | | | | This requires creating new persistent states due to the nature of GDM. llvm-svn: 104668
* CastSizeChecker checks when casting a malloc'ed symbolic region to type T,Zhongxing Xu2010-05-251-7/+12
| | | | | | | whether the size of the symbolic region is a multiple of the size of T. Fixes PR6123 and PR7217. llvm-svn: 104584
* Introduce Type::isStructureOrClassType(), which does the obviousDouglas Gregor2010-04-261-8/+8
| | | | | | | | thing. Audit all uses of Type::isStructure(), changing those calls to isStructureOrClassType() as needed (which is alsmost everywhere). Fixes the remaining failure in Boost.Utility/Swap. llvm-svn: 102386
* Analyzer: add support for CXXNewExpr.Zhongxing Xu2010-04-191-10/+0
| | | | llvm-svn: 101771
* Remove copy of 'Optional' in Clang tree, and convert clients to use the one ↵Ted Kremenek2010-04-091-9/+9
| | | | | | now in the LLVM tree. llvm-svn: 100891
* Use the element type to compute the array size when the base region is a ↵Zhongxing Xu2010-04-011-3/+6
| | | | | | | | VarRegion. Patch by Jordy Rose. llvm-svn: 100099
* Fix a bug (PR 6699) in RegionStore::RemoveDeadBindings() whereTed Kremenek2010-04-011-32/+31
| | | | | | array values with a non-zero offset would get prematurely pruned from the store. llvm-svn: 100067
* RegionStore: specially handle loads from integer global variables declared ↵Ted Kremenek2010-03-301-1/+16
| | | | | | | | 'const'. Fixes a false positive reported in PR 6288. llvm-svn: 99922
* Use 'const Optional<SVal>&' to avoid an extra copy.Ted Kremenek2010-03-301-8/+8
| | | | llvm-svn: 99921
* Bind the constructed object value to CXXConstructExpr.Zhongxing Xu2010-03-231-3/+2
| | | | llvm-svn: 99271
* Mark CXXThisRegion in the current or parent stack frame context as live so thatZhongxing Xu2010-03-171-4/+18
| | | | | | their bindings are not removed. llvm-svn: 98705
* Add VisitCXXContructExpr logic to the analyzer. This still has not fully workedZhongxing Xu2010-03-161-9/+22
| | | | | | since RemoveDeadBinding mistakenly remove the binding to CXXThisRegion. llvm-svn: 98629
* Simplify assertion.Ted Kremenek2010-03-101-5/+1
| | | | llvm-svn: 98176
* Remove '#if 0' code. Lazy compound values have proven their worth.Ted Kremenek2010-03-101-39/+0
| | | | llvm-svn: 98175
* Remove the subregion map cache. It is no longer used.Ted Kremenek2010-03-101-8/+0
| | | | llvm-svn: 98161
* Fix stale comment.Ted Kremenek2010-03-101-1/+1
| | | | llvm-svn: 98160
* Really apply (unnoticed weird git-svn merge conflict in 98144): Refactor ↵Ted Kremenek2010-03-101-299/+290
| | | | | | | | | | | RegionStore::RemoveDeadBindings to use the same core cluster analysis algorithm as RegionStore::InvalidateRegions(). Beyond simplifying the algorithm significantly, we no longer need to build subregion maps in RemoveDeadBindings(). This and other changes cause a significant speedup: the time to analyze sqlite3.c (single core) drops by 14%. llvm-svn: 98159
* Refactor RegionStore::RemoveDeadBindings to use the same coreTed Kremenek2010-03-101-87/+87
| | | | | | | | | | | cluster analysis algorithm as RegionStore::InvalidateRegions(). Beyond simplifying the algorithm significantly, we no longer need to build subregion maps in RemoveDeadBindings(). This and other changes cause a significant speedup: the time to analyze sqlite3.c (single core) drops by 14%. llvm-svn: 98144
* Refactor some of RegionStore's InvalidateRegionsWorker classTed Kremenek2010-03-101-62/+86
| | | | | | | into a 'ClusterAnalysis' parent class. The idea is to potentially reuse this for reworking RemoveDeadBindings. llvm-svn: 98143
* Since now we store the cast type with an ElementRegion, there isZhongxing Xu2010-03-011-5/+5
| | | | | | no need to store a type with SymbolRegionValue. llvm-svn: 97437
OpenPOWER on IntegriCloud