From 39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 20 Feb 2011 13:06:31 +0000 Subject: Vendor import of clang trunk r126079: http://llvm.org/svn/llvm-project/cfe/trunk@126079 --- lib/Analysis/LiveVariables.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/Analysis/LiveVariables.cpp') diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp index 47b2e3d..303dc0f 100644 --- a/lib/Analysis/LiveVariables.cpp +++ b/lib/Analysis/LiveVariables.cpp @@ -104,8 +104,9 @@ namespace { class TransferFuncs : public CFGRecStmtVisitor{ LiveVariables::AnalysisDataTy& AD; LiveVariables::ValTy LiveState; + const CFGBlock *currentBlock; public: - TransferFuncs(LiveVariables::AnalysisDataTy& ad) : AD(ad) {} + TransferFuncs(LiveVariables::AnalysisDataTy& ad) : AD(ad), currentBlock(0) {} LiveVariables::ValTy& getVal() { return LiveState; } CFG& getCFG() { return AD.getCFG(); } @@ -128,7 +129,10 @@ public: void SetTopValue(LiveVariables::ValTy& V) { V = AD.AlwaysLive; } - + + void setCurrentBlock(const CFGBlock *block) { + currentBlock = block; + } }; void TransferFuncs::Visit(Stmt *S) { @@ -136,7 +140,7 @@ void TransferFuncs::Visit(Stmt *S) { if (S == getCurrentBlkStmt()) { if (AD.Observer) - AD.Observer->ObserveStmt(S,AD,LiveState); + AD.Observer->ObserveStmt(S, currentBlock, AD, LiveState); if (getCFG().isBlkExpr(S)) LiveState(S, AD) = Dead; @@ -146,7 +150,7 @@ void TransferFuncs::Visit(Stmt *S) { else if (!getCFG().isBlkExpr(S)) { if (AD.Observer) - AD.Observer->ObserveStmt(S,AD,LiveState); + AD.Observer->ObserveStmt(S, currentBlock, AD, LiveState); StmtVisitor::Visit(S); -- cgit v1.1