aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/RegionStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-01-21 06:57:53 +0000
committerTed Kremenek <kremenek@apple.com>2009-01-21 06:57:53 +0000
commit0964a06d5cc1dc36ac5f8c89ba47ec0a47c08bb1 (patch)
treed2bb76485b4aa1efc00a6d825f60b0959d7c1b0c /lib/Analysis/RegionStore.cpp
parente6ea27995fb15add0de47588b4226049fa0753e5 (diff)
Get RegionStore to work with the retain/release checker and its test cases.
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
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r--lib/Analysis/RegionStore.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index 20cf38f0bb..0c6fb8098b 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -652,37 +652,33 @@ const GRState* RegionStoreManager::Bind(const GRState* St, Loc L, SVal V) {
}
Store RegionStoreManager::Remove(Store store, Loc L) {
- RegionBindingsTy B = GetRegionBindings(store);
-
- const MemRegion* R = cast<loc::MemRegionVal>(L).getRegion();
- assert(R);
-
- return RBFactory.Remove(B, R).getRoot();
+ const MemRegion* R = 0;
+
+ if (isa<loc::MemRegionVal>(L))
+ R = cast<loc::MemRegionVal>(L).getRegion();
+ else if (isa<loc::SymbolVal>(L))
+ R = MRMgr.getSymbolicRegion(cast<loc::SymbolVal>(L).getSymbol());
+
+ if (R) {
+ RegionBindingsTy B = GetRegionBindings(store);
+ return RBFactory.Remove(B, R).getRoot();
+ }
+
+ return store;
}
const GRState* RegionStoreManager::BindDecl(const GRState* St,
const VarDecl* VD, SVal InitVal) {
- // All static variables are treated as symbolic values.
- if (VD->hasGlobalStorage())
- return St;
-
- // Process local variables.
QualType T = VD->getType();
-
VarRegion* VR = MRMgr.getVarRegion(VD);
-
- if (Loc::IsLocType(T) || T->isIntegerType())
- return Bind(St, Loc::MakeVal(VR), InitVal);
- else if (T->isArrayType())
+ if (T->isArrayType())
return BindArray(St, VR, InitVal);
-
- else if (T->isStructureType())
+ if (T->isStructureType())
return BindStruct(St, VR, InitVal);
- // Other types of variable are not supported yet.
- return St;
+ return Bind(St, Loc::MakeVal(VR), InitVal);
}
// FIXME: this method should be merged into Bind().