From b8e7410b22fa573fb0078712439f343bc69208dd Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 14 Jun 2009 09:24:02 +0000 Subject: Import Clang r73340. --- lib/Analysis/RegionStore.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/Analysis/RegionStore.cpp') diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp index 02d3d1f..eae3aef 100644 --- a/lib/Analysis/RegionStore.cpp +++ b/lib/Analysis/RegionStore.cpp @@ -651,7 +651,7 @@ SVal RegionStoreManager::EvalBinOp(const GRState *state, // Get symbol's type. It should be a pointer type. SymbolRef Sym = SR->getSymbol(); QualType T = Sym->getType(getContext()); - QualType EleTy = cast(T.getTypePtr())->getPointeeType(); + QualType EleTy = T->getAsPointerType()->getPointeeType(); SVal ZeroIdx = ValMgr.makeZeroArrayIndex(); ER = MRMgr.getElementRegion(EleTy, ZeroIdx, SR); @@ -840,7 +840,7 @@ SVal RegionStoreManager::RetrieveStruct(const GRState* St,const TypedRegion* R){ QualType T = R->getValueType(getContext()); assert(T->isStructureType()); - const RecordType* RT = cast(T.getTypePtr()); + const RecordType* RT = T->getAsStructureType(); RecordDecl* RD = RT->getDecl(); assert(RD->isDefinition()); @@ -1198,6 +1198,11 @@ RegionStoreManager::BindStruct(const GRState* St, const TypedRegion* R, SVal V){ if (V.isUnknown()) return KillStruct(St, R); + // We may get non-CompoundVal accidentally due to imprecise cast logic. Ignore + // them and make struct unknown. + if (!isa(V)) + return KillStruct(St, R); + nonloc::CompoundVal& CV = cast(V); nonloc::CompoundVal::iterator VI = CV.begin(), VE = CV.end(); RecordDecl::field_iterator FI = RD->field_begin(getContext()), -- cgit v1.1