This is the first step to gradually remove the use of loc::SymbolVal. Now
when creating symbolic values, we distinguish between location and non-location
values. For location values, we create a symbolic region instead of a
loc::SymbolVal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68373 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp
index 28a5b98..c1efb98 100644
--- a/lib/Analysis/BasicStore.cpp
+++ b/lib/Analysis/BasicStore.cpp
@@ -125,6 +125,9 @@
}
void print(Store store, std::ostream& Out, const char* nl, const char *sep);
+
+private:
+ ASTContext& getContext() { return StateMgr.getContext(); }
};
} // end anonymous namespace
@@ -273,9 +276,10 @@
break;
}
- // FIXME: Handle SymbolRegions? Shouldn't be possible in
- // BasicStoreManager.
- assert(!isa<SymbolicRegion>(R));
+ if (const SymbolicRegion* SR = dyn_cast<SymbolicRegion>(R)) {
+ SymbolRef Sym = SR->getSymbol();
+ BaseR = MRMgr.getTypedViewRegion(Sym->getType(getContext()), SR);
+ }
break;
}
@@ -477,7 +481,7 @@
SelfRegion);
SVal X = SVal::GetRValueSymbolVal(StateMgr.getSymbolManager(),
- IVR);
+ MRMgr, IVR);
St = BindInternal(St, Loc::MakeVal(IVR), X);
}
@@ -534,7 +538,7 @@
const MemRegion *R = StateMgr.getRegion(VD);
SVal X = (VD->hasGlobalStorage() || isa<ParmVarDecl>(VD) ||
isa<ImplicitParamDecl>(VD))
- ? SVal::GetRValueSymbolVal(StateMgr.getSymbolManager(), R)
+ ? SVal::GetRValueSymbolVal(StateMgr.getSymbolManager(), MRMgr,R)
: UndefinedVal();
St = BindInternal(St, Loc::MakeVal(R), X);