aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/BasicConstraintManager.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-10-17 21:22:20 +0000
committerTed Kremenek <kremenek@apple.com>2008-10-17 21:22:20 +0000
commitc5234715f145b5fa0a3a08fed33b83a3203728ae (patch)
treef3416b6a02085f24c0701ebef057c9d7cd7f4f85 /lib/Analysis/BasicConstraintManager.cpp
parent4bd1eefd48c70ebef185e524d0484c00f16000cf (diff)
Enhance "Assumption" logic in BasicConstraintManager when reasoning about regions and symbolic regions. When assuming whether or not a location is non-null, walk up the region hierarchy until we hit a symbolic region (and test it for null). This may not be the end all solution, as the notion of what a "symbolic region" is really belongs in the specific subclass of StoreManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57730 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicConstraintManager.cpp')
-rw-r--r--lib/Analysis/BasicConstraintManager.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/Analysis/BasicConstraintManager.cpp b/lib/Analysis/BasicConstraintManager.cpp
index aab1f5e7eb..8617ba650f 100644
--- a/lib/Analysis/BasicConstraintManager.cpp
+++ b/lib/Analysis/BasicConstraintManager.cpp
@@ -129,7 +129,26 @@ const GRState* BasicConstraintManager::AssumeAux(const GRState* St, Loc Cond,
return AssumeSymEQ(St, cast<loc::SymbolVal>(Cond).getSymbol(),
BasicVals.getZeroWithPtrWidth(), isFeasible);
- case loc::MemRegionKind:
+ case loc::MemRegionKind: {
+ // FIXME: Should this go into the storemanager?
+
+ const MemRegion* R = cast<loc::MemRegionVal>(Cond).getRegion();
+
+ while (R) {
+ if (const SubRegion* SubR = dyn_cast<SubRegion>(R)) {
+ R = SubR->getSuperRegion();
+ continue;
+ }
+ else if (const SymbolicRegion* SymR = dyn_cast<SymbolicRegion>(R))
+ return AssumeAux(St, loc::SymbolVal(SymR->getSymbol()), Assumption,
+ isFeasible);
+
+ break;
+ }
+
+ // FALL-THROUGH.
+ }
+
case loc::FuncValKind:
case loc::GotoLabelKind:
case loc::StringLiteralValKind: