From 113bee05361d648adb51edd0e2ec281432d2009f Mon Sep 17 00:00:00 2001 From: John McCall Date: Sat, 10 Mar 2012 09:33:50 +0000 Subject: Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr to track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491 --- clang/lib/Analysis/AnalysisDeclContext.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'clang/lib/Analysis/AnalysisDeclContext.cpp') diff --git a/clang/lib/Analysis/AnalysisDeclContext.cpp b/clang/lib/Analysis/AnalysisDeclContext.cpp index cbb08fd..1020898 100644 --- a/clang/lib/Analysis/AnalysisDeclContext.cpp +++ b/clang/lib/Analysis/AnalysisDeclContext.cpp @@ -362,20 +362,16 @@ public: flag = 1; BEVals.push_back(VD, BC); } + } else if (DR->refersToEnclosingLocal()) { + unsigned &flag = Visited[VD]; + if (!flag) { + flag = 1; + if (IsTrackedDecl(VD)) + BEVals.push_back(VD, BC); + } } } - void VisitBlockDeclRefExpr(BlockDeclRefExpr *DR) { - if (const VarDecl *VD = dyn_cast(DR->getDecl())) { - unsigned &flag = Visited[VD]; - if (!flag) { - flag = 1; - if (IsTrackedDecl(VD)) - BEVals.push_back(VD, BC); - } - } - } - void VisitBlockExpr(BlockExpr *BR) { // Blocks containing blocks can transitively capture more variables. IgnoredContexts.insert(BR->getBlockDecl()); -- cgit v1.1