aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker/RegionStore.cpp
AgeCommit message (Collapse)Author
2010-06-25Change RegionStoreManager::Retrieve to infer the type of a symbolic region ↵Tom Care
from the context when it is not already available. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106868 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-22Correctly construct an ElementRegion for alloca() + pointer arithmetic. ↵Ted Kremenek
Fixes analyzer crash reported in PR 7450. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106609 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-17Implement RegionStoreManager::iterBindings(). This implementation only ↵Ted Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106183 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-01Limit the use of BindDefault().Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105265 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-01Add support for calloc() in MallocChecker. Patch by Jordy Rose, with my Zhongxing Xu
modification. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105264 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-31After conversations with Zhongxing Xu and Jordy Rose, refine the logic inTed Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105195 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-29Revert r105097. Thinking about a better fix.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105099 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-29Fix PR7218. Patch by Jordy Rose.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26Small fix.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104669 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26Remove extents of dead symbolic regions when RemoveDeadBindings.Zhongxing Xu
This requires creating new persistent states due to the nature of GDM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104668 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-25CastSizeChecker checks when casting a malloc'ed symbolic region to type T,Zhongxing Xu
whether the size of the symbolic region is a multiple of the size of T. Fixes PR6123 and PR7217. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104584 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-26Introduce Type::isStructureOrClassType(), which does the obviousDouglas Gregor
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102386 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-19Analyzer: add support for CXXNewExpr.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101771 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09Remove copy of 'Optional' in Clang tree, and convert clients to use the one ↵Ted Kremenek
now in the LLVM tree. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100891 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01Use the element type to compute the array size when the base region is a ↵Zhongxing Xu
VarRegion. Patch by Jordy Rose. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100099 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-01Fix a bug (PR 6699) in RegionStore::RemoveDeadBindings() whereTed Kremenek
array values with a non-zero offset would get prematurely pruned from the store. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100067 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30RegionStore: specially handle loads from integer global variables declared ↵Ted Kremenek
'const'. Fixes a false positive reported in PR 6288. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99922 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30Use 'const Optional<SVal>&' to avoid an extra copy.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99921 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23Bind the constructed object value to CXXConstructExpr.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99271 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-17Mark CXXThisRegion in the current or parent stack frame context as live so thatZhongxing Xu
their bindings are not removed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98705 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16Add VisitCXXContructExpr logic to the analyzer. This still has not fully workedZhongxing Xu
since RemoveDeadBinding mistakenly remove the binding to CXXThisRegion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98629 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Simplify assertion.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98176 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Remove '#if 0' code. Lazy compound values have proven their worth.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98175 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Remove the subregion map cache. It is no longer used.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98161 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Fix stale comment.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98160 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Really apply (unnoticed weird git-svn merge conflict in 98144): Refactor ↵Ted Kremenek
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%. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98159 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Refactor RegionStore::RemoveDeadBindings to use the same coreTed Kremenek
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%. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98144 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10Refactor some of RegionStore's InvalidateRegionsWorker classTed Kremenek
into a 'ClusterAnalysis' parent class. The idea is to potentially reuse this for reworking RemoveDeadBindings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98143 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01Since now we store the cast type with an ElementRegion, there isZhongxing Xu
no need to store a type with SymbolRegionValue. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97437 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-01Assert when loading from a code text region instead of returning an unknown ↵Zhongxing Xu
silently. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97436 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13Enhance RegionStore::InvalidateRegions() to correctly invalidate bindingsTed Kremenek
by scanning through the values of LazyCompoundVals. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96067 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-13Pull logic for visiting value bindings in InvalidateRegionsWorker into a ↵Ted Kremenek
separate method. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96060 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11Eliminate the ASTContext parameter from RecordDecl::getDefinition()Douglas Gregor
and CXXRecordDecl::getDefinition(); it's totally unnecessary. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95836 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10Add comment.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95755 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09Fix lookup of fields from lazy bindings to check if the region isTed Kremenek
NULL, not the store, to determine if a lookup succeeded. The store can be null if it contained no bindings. This fixes a false positive reported to me by a user of the analyzer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95679 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Revert 95541.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95545 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Rename: GRState::getSVal(Stmt*) => getExprVal(),Zhongxing Xu
GRState::getSVal(MemRegion*) => Load(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95541 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Like for symbolic region, automatically create a element zero region for Zhongxing Xu
alloca region. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95539 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Unify the implementation of getLValueElement of store managers.Zhongxing Xu
It's more sophisticated than the original one of BasicStore. But it does matter. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95536 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Unify the implementation of getLValueIvar and getLValueField of store managers.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95535 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08Move common methods to the base StoreManager class.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95534 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-06Also teach RegionStore::RetrieveVar() to handle 'static' pointers that are ↵Ted Kremenek
implicitly initialized to NULL. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95479 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-06Fix regression in RegionStore (from BasicStore) where static variables were ↵Ted Kremenek
not treated as being implicitly initialized to 0 (and instead were getting symbolicated). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95478 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-06Teach RegionStore::InvalidateRegions() to also invalidate static variables ↵Ted Kremenek
referenced by blocks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95459 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05More GRState* -> Store changes.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95365 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05Remove unused parameter.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95364 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05More GRState* -> Store changes.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95362 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05More GRState* -> Store changes.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95360 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05More GRState* -> Store changes.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95357 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05Change LazyCompoundVal to a <Store, MemRegion*> pair. We really don't need toZhongxing Xu
spread GRState* everywhere. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95354 91177308-0d34-0410-b5e6-96231b3b80d8