diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-11-14 21:07:14 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-11-14 21:07:14 +0000 |
| commit | fc419a035fd1fe34893738f976b6cc3ef7067418 (patch) | |
| tree | e16df6c41b949fa9e0a0b716ca3bfa70ceb2dd7b /clang/lib | |
| parent | 30f6f8fdad0a180c179c2bf20adc8cb150170ff7 (diff) | |
| download | bcm5719-llvm-fc419a035fd1fe34893738f976b6cc3ef7067418.tar.gz bcm5719-llvm-fc419a035fd1fe34893738f976b6cc3ef7067418.zip | |
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
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Analysis/LiveVariables.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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<Expr>(Element)->IgnoreParens(); if ((DR = dyn_cast<DeclRefExpr>(ElemExpr))) VD = cast<VarDecl>(DR->getDecl()); + else { + Visit(ElemExpr); + return; + } } if (VD) { |

