Flow-sensitive uninitialized values analysis: properly handle the 'element' expression of ObjCForCollectionStmt (can be anything).

llvm-svn: 59312
This commit is contained in:
Ted Kremenek 2008-11-14 18:21:25 +00:00
parent 80cd21dba6
commit 8959a1a69a
1 changed files with 9 additions and 2 deletions

View File

@ -194,9 +194,16 @@ TransferFuncs::BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
if (DeclStmt* DS = dyn_cast<DeclStmt>(Element))
VD = cast<VarDecl>(DS->getSolitaryDecl());
else
VD = cast<VarDecl>(cast<DeclRefExpr>(Element)->getDecl());
else {
Expr* ElemExpr = cast<Expr>(Element)->IgnoreParens();
// Initialize the value of the reference variable.
if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(ElemExpr))
VD = cast<VarDecl>(DR->getDecl());
else
return Visit(ElemExpr);
}
V(VD,AD) = Initialized;
return Initialized;
}