[cfe-commits] r59053 - /cfe/trunk/lib/Analysis/LiveVariables.cpp
Ted Kremenek
kremenek at apple.com
Tue Nov 11 09:42:10 PST 2008
Author: kremenek
Date: Tue Nov 11 11:42:10 2008
New Revision: 59053
URL: http://llvm.org/viewvc/llvm-project?rev=59053&view=rev
Log:
Add transfer function support for ObjCForCollectionStmt to LiveVariables.
Modified:
cfe/trunk/lib/Analysis/LiveVariables.cpp
Modified: cfe/trunk/lib/Analysis/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/LiveVariables.cpp?rev=59053&r1=59052&r2=59053&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/lib/Analysis/LiveVariables.cpp Tue Nov 11 11:42:10 2008
@@ -121,8 +121,9 @@
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 @@
else VisitStmt(B);
}
+void TransferFuncs::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
+ Stmt* Element = S->getElement();
+
+ if (DeclStmt* DS = dyn_cast<DeclStmt>(Element)) {
+ VisitDeclStmt(DS);
+ return;
+ }
+
+ // This represents a 'kill' for the variable.
+ DeclRefExpr* DR = cast<DeclRefExpr>(Element);
+ LiveState(cast<VarDecl>(DR->getDecl()), AD) = Dead;
+ if (AD.Observer) { AD.Observer->ObserverKill(DR); }
+}
+
+
void TransferFuncs::VisitUnaryOperator(UnaryOperator* U) {
Expr *E = U->getSubExpr();
More information about the cfe-commits
mailing list