diff --git a/clang/lib/Analysis/LiveVariables.cpp b/clang/lib/Analysis/LiveVariables.cpp index 98b1ee282096..7b04beb2b5c6 100644 --- a/clang/lib/Analysis/LiveVariables.cpp +++ b/clang/lib/Analysis/LiveVariables.cpp @@ -184,18 +184,21 @@ TransferFuncs::BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) { // This represents a 'kill' for the variable. Stmt* Element = S->getElement(); - DeclRefExpr *DR = 0; + DeclRefExpr* DR = 0; VarDecl* VD = 0; if (DeclStmt* DS = dyn_cast(Element)) VD = cast(DS->getSolitaryDecl()); else { - DR = cast(Element); - VD = cast(DR->getDecl()); + Expr* ElemExpr = cast(Element)->IgnoreParens(); + if ((DR = dyn_cast(ElemExpr))) + VD = cast(DR->getDecl()); } - LiveState(VD, AD) = Dead; - if (AD.Observer && DR) { AD.Observer->ObserverKill(DR); } + if (VD) { + LiveState(VD, AD) = Dead; + if (AD.Observer && DR) { AD.Observer->ObserverKill(DR); } + } }