aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-18 22:10:22 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-18 22:10:22 +0000
commitec099f1f9d1384cec624944744a9fe92df4b389b (patch)
treede775aaf8d6bd3bcaeb44602970b0ccf8f78dc32 /lib
parent632f50edc08c76ebc643a0d4871bae33a55d7b4e (diff)
Fix crash reported in <rdar://problem/6695527>. We now have
SVal::GetRValueSymbolVal do the checking if we can symbolicate a type instead of having BasicStoreManager do it (which wasn't always doing the check consistently). Having this check in SVal::GetRValueSymbolVal keeps the check in one centralized place. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67245 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/BasicStore.cpp22
-rw-r--r--lib/Analysis/SVals.cpp13
2 files changed, 19 insertions, 16 deletions
diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp
index 8cfe7a9840..b883f88061 100644
--- a/lib/Analysis/BasicStore.cpp
+++ b/lib/Analysis/BasicStore.cpp
@@ -526,19 +526,15 @@ Store BasicStoreManager::getInitialStore() {
if (VD->getStorageClass() == VarDecl::Static)
continue;
- // Only handle pointers and integers for now.
- QualType T = VD->getType();
- if (Loc::IsLocType(T) || T->isIntegerType()) {
- // Initialize globals and parameters to symbolic values.
- // Initialize local variables to undefined.
- const MemRegion *R = StateMgr.getRegion(VD);
- SVal X = (VD->hasGlobalStorage() || isa<ParmVarDecl>(VD) ||
- isa<ImplicitParamDecl>(VD))
- ? SVal::GetRValueSymbolVal(StateMgr.getSymbolManager(), R)
- : UndefinedVal();
-
- St = BindInternal(St, Loc::MakeVal(R), X);
- }
+ // Initialize globals and parameters to symbolic values.
+ // Initialize local variables to undefined.
+ const MemRegion *R = StateMgr.getRegion(VD);
+ SVal X = (VD->hasGlobalStorage() || isa<ParmVarDecl>(VD) ||
+ isa<ImplicitParamDecl>(VD))
+ ? SVal::GetRValueSymbolVal(StateMgr.getSymbolManager(), R)
+ : UndefinedVal();
+
+ St = BindInternal(St, Loc::MakeVal(R), X);
}
}
return St;
diff --git a/lib/Analysis/SVals.cpp b/lib/Analysis/SVals.cpp
index cca0e94191..3762ae5ce6 100644
--- a/lib/Analysis/SVals.cpp
+++ b/lib/Analysis/SVals.cpp
@@ -324,11 +324,18 @@ NonLoc NonLoc::MakeCompoundVal(QualType T, llvm::ImmutableList<SVal> Vals,
SVal SVal::GetRValueSymbolVal(SymbolManager& SymMgr, const MemRegion* R) {
SymbolRef sym = SymMgr.getRegionRValueSymbol(R);
- if (const TypedRegion* TR = dyn_cast<TypedRegion>(R))
- if (Loc::IsLocType(TR->getRValueType(SymMgr.getContext())))
+ if (const TypedRegion* TR = dyn_cast<TypedRegion>(R)) {
+ QualType T = TR->getRValueType(SymMgr.getContext());
+
+ if (Loc::IsLocType(T))
return Loc::MakeVal(sym);
- return NonLoc::MakeVal(sym);
+ // Only handle integers for now.
+ if (T->isIntegerType())
+ return NonLoc::MakeVal(sym);
+ }
+
+ return UnknownVal();
}
nonloc::LocAsInteger nonloc::LocAsInteger::Make(BasicValueFactory& Vals, Loc V,