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. llvm-svn: 67245
This commit is contained in:
parent
4724b8262f
commit
b36e01d87e
|
|
@ -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();
|
||||
// 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);
|
||||
}
|
||||
St = BindInternal(St, Loc::MakeVal(R), X);
|
||||
}
|
||||
}
|
||||
return St;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -195,3 +195,9 @@ void pr3772(void)
|
|||
// PR 3780 - This tests that StmtIterator isn't broken for VLAs in DeclGroups.
|
||||
void pr3780(int sz) { typedef double MAT[sz][sz]; }
|
||||
|
||||
// <rdar://problem/6695527> - Test that we don't symbolicate doubles before
|
||||
// we are ready to do something with them.
|
||||
int rdar6695527(double x) {
|
||||
if (!x) { return 0; }
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue