From fc419a035fd1fe34893738f976b6cc3ef7067418 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 14 Nov 2008 21:07:14 +0000 Subject: Minor tweaks to liveness analysis: - Block-expression for 'ObjCForCollectionStmt' is not alive before it occurs - Recursively visit 'element' expression for ObjCForCollectionStmt to get liveness for referenced block-level expressions and variables. llvm-svn: 59316 --- clang/lib/Analysis/LiveVariables.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'clang/lib') diff --git a/clang/lib/Analysis/LiveVariables.cpp b/clang/lib/Analysis/LiveVariables.cpp index 7b04beb2b5c..4b181a954c0 100644 --- a/clang/lib/Analysis/LiveVariables.cpp +++ b/clang/lib/Analysis/LiveVariables.cpp @@ -179,6 +179,9 @@ void TransferFuncs::VisitBinaryOperator(BinaryOperator* B) { void TransferFuncs::BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) { + // This is a block-level expression. Its value is 'dead' before this point. + LiveState(S, AD) = Dead; + // This represents a 'use' of the collection. Visit(S->getCollection()); @@ -193,6 +196,10 @@ TransferFuncs::BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) { Expr* ElemExpr = cast(Element)->IgnoreParens(); if ((DR = dyn_cast(ElemExpr))) VD = cast(DR->getDecl()); + else { + Visit(ElemExpr); + return; + } } if (VD) { -- cgit v1.2.3