diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-11-14 01:58:12 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-11-14 01:58:12 +0000 |
commit | 99d4ff3c7a3f9c9d12bdb7f2f94de88e2b7605d5 (patch) | |
tree | 45c28c11c9b3eeff27c33ba9ca30adbc1d4acf2f | |
parent | 5cf87ff564cb44cd89966fc0459580607a56ac6d (diff) | |
download | bcm5719-llvm-99d4ff3c7a3f9c9d12bdb7f2f94de88e2b7605d5.tar.gz bcm5719-llvm-99d4ff3c7a3f9c9d12bdb7f2f94de88e2b7605d5.zip |
Handle the case where 'element' in ObjCforCollectionstmt is not a DeclStmt or DeclRefExpr.
llvm-svn: 59290
-rw-r--r-- | clang/lib/Analysis/LiveVariables.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Analysis/LiveVariables.cpp b/clang/lib/Analysis/LiveVariables.cpp index 98b1ee28209..7b04beb2b5c 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<DeclStmt>(Element)) VD = cast<VarDecl>(DS->getSolitaryDecl()); else { - DR = cast<DeclRefExpr>(Element); - VD = cast<VarDecl>(DR->getDecl()); + Expr* ElemExpr = cast<Expr>(Element)->IgnoreParens(); + if ((DR = dyn_cast<DeclRefExpr>(ElemExpr))) + VD = cast<VarDecl>(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); } + } } |