summaryrefslogtreecommitdiffstats
path: root/clang/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
commit1416a521b5c3179fc999391cdf3c16b3121842ed (patch)
treed56a78475dc1c78fd82fe32f338ba209c133a442 /clang/lib/Analysis/BasicConstraintManager.cpp
parentd01ddb51eeca94898fd727a8f797038db4dec4d1 (diff)
downloadbcm5719-llvm-1416a521b5c3179fc999391cdf3c16b3121842ed.tar.gz
bcm5719-llvm-1416a521b5c3179fc999391cdf3c16b3121842ed.zip
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.
llvm-svn: 57730
Diffstat (limited to 'clang/lib/Analysis/BasicConstraintManager.cpp')
-rw-r--r--clang/lib/Analysis/BasicConstraintManager.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/clang/lib/Analysis/BasicConstraintManager.cpp b/clang/lib/Analysis/BasicConstraintManager.cpp
index aab1f5e7eb1..8617ba650f3 100644
--- a/clang/lib/Analysis/BasicConstraintManager.cpp
+++ b/clang/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:
OpenPOWER on IntegriCloud