summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/RegionStore.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-02-06 08:44:27 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-02-06 08:44:27 +0000
commitdec48a50dff9574c2e232deb964dd9e7a19d88d3 (patch)
treec33a35d597298c0dc730b72ee274e87973afb74b /clang/lib/Analysis/RegionStore.cpp
parent8811ecdadf42dc39ff1f8869463e7486324c2beb (diff)
downloadbcm5719-llvm-dec48a50dff9574c2e232deb964dd9e7a19d88d3.tar.gz
bcm5719-llvm-dec48a50dff9574c2e232deb964dd9e7a19d88d3.zip
Create ElementRegion when the base is SymbolicRegion. This is like what we do
for FieldRegion. This enables us to track more values. Simplify SymbolicRegion::getRValueType(). We assume the symbol always has pointer type. llvm-svn: 63928
Diffstat (limited to 'clang/lib/Analysis/RegionStore.cpp')
-rw-r--r--clang/lib/Analysis/RegionStore.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp
index e640087acba..93b55255d58 100644
--- a/clang/lib/Analysis/RegionStore.cpp
+++ b/clang/lib/Analysis/RegionStore.cpp
@@ -339,15 +339,20 @@ SVal RegionStoreManager::getLValueField(const GRState* St, SVal Base,
SVal RegionStoreManager::getLValueElement(const GRState* St,
SVal Base, SVal Offset) {
- if (Base.isUnknownOrUndef() || isa<loc::SymbolVal>(Base))
+ if (Base.isUnknownOrUndef())
return Base;
// Only handle integer offsets... for now.
if (!isa<nonloc::ConcreteInt>(Offset))
return UnknownVal();
- const TypedRegion *BaseRegion =
- cast<TypedRegion>(cast<loc::MemRegionVal>(Base).getRegion());
+ const TypedRegion* BaseRegion = 0;
+
+ if (isa<loc::SymbolVal>(Base))
+ BaseRegion = MRMgr.getSymbolicRegion(cast<loc::SymbolVal>(Base).getSymbol(),
+ StateMgr.getSymbolManager());
+ else
+ BaseRegion = cast<TypedRegion>(cast<loc::MemRegionVal>(Base).getRegion());
// Pointer of any type can be cast and used as array base.
const ElementRegion *ElemR = dyn_cast<ElementRegion>(BaseRegion);
@@ -476,6 +481,12 @@ SVal RegionStoreManager::getSizeInElements(const GRState* St,
return UnknownVal();
}
+ if (const SymbolicRegion* SR = dyn_cast<SymbolicRegion>(R)) {
+ // FIXME: Unsupported yet.
+ SR = 0;
+ return UnknownVal();
+ }
+
assert(0 && "Other regions are not supported yet.");
return UnknownVal();
}
OpenPOWER on IntegriCloud