From: Ted Kremenek Date: Tue, 11 Nov 2008 17:42:10 +0000 (+0000) Subject: Add transfer function support for ObjCForCollectionStmt to LiveVariables. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8f5aab696173cc6e9c9963635d91dc2e83d54442;p=clang Add transfer function support for ObjCForCollectionStmt to LiveVariables. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59053 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp index e0b3f1992c..9b0f09e54e 100644 --- a/lib/Analysis/LiveVariables.cpp +++ b/lib/Analysis/LiveVariables.cpp @@ -121,8 +121,9 @@ public: void VisitBinaryOperator(BinaryOperator* B); void VisitAssign(BinaryOperator* B); void VisitDeclStmt(DeclStmt* DS); + void VisitObjCForCollectionStmt(ObjCForCollectionStmt* S); void VisitUnaryOperator(UnaryOperator* U); - void Visit(Stmt *S); + void Visit(Stmt *S); void VisitTerminator(CFGBlock* B); void SetTopValue(LiveVariables::ValTy& V) { @@ -175,6 +176,21 @@ void TransferFuncs::VisitBinaryOperator(BinaryOperator* B) { else VisitStmt(B); } +void TransferFuncs::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) { + Stmt* Element = S->getElement(); + + if (DeclStmt* DS = dyn_cast(Element)) { + VisitDeclStmt(DS); + return; + } + + // This represents a 'kill' for the variable. + DeclRefExpr* DR = cast(Element); + LiveState(cast(DR->getDecl()), AD) = Dead; + if (AD.Observer) { AD.Observer->ObserverKill(DR); } +} + + void TransferFuncs::VisitUnaryOperator(UnaryOperator* U) { Expr *E = U->getSubExpr();