diff options
| author | Ted Kremenek <kremenek@apple.com> | 2009-01-21 06:57:53 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2009-01-21 06:57:53 +0000 |
| commit | fe32cc0ba6765a42ae460f3c53449e61866a891a (patch) | |
| tree | cb0413963f46069edcf2d3da20a8ef075174f63d /clang/lib | |
| parent | dc6ceca4bab233e755ea6853e8eca57bb062b69d (diff) | |
| download | bcm5719-llvm-fe32cc0ba6765a42ae460f3c53449e61866a891a.tar.gz bcm5719-llvm-fe32cc0ba6765a42ae460f3c53449e61866a891a.zip | |
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).
llvm-svn: 62667
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Analysis/RegionStore.cpp | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp index 20cf38f0bba..0c6fb8098b7 100644 --- a/clang/lib/Analysis/RegionStore.cpp +++ b/clang/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(). |

