[cfe-commits] r138334 - /cfe/trunk/lib/CodeGen/CGDecl.cpp
Fariborz Jahanian
fjahanian at apple.com
Tue Aug 23 09:47:15 PDT 2011
Author: fjahanian
Date: Tue Aug 23 11:47:15 2011
New Revision: 138334
URL: http://llvm.org/viewvc/llvm-project?rev=138334&view=rev
Log:
checking for __block variable captured by given
stmt expression, recursively walk down all substatements
of the stmt expression. // rdar://10001085
Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=138334&r1=138333&r2=138334&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Tue Aug 23 11:47:15 2011
@@ -875,8 +875,15 @@
return false;
}
- if (const StmtExpr *SE = dyn_cast<StmtExpr>(e))
- e = cast<Expr>(SE->getSubStmt()->body_back());
+ if (const StmtExpr *SE = dyn_cast<StmtExpr>(e)) {
+ const CompoundStmt *CS = SE->getSubStmt();
+ for (CompoundStmt::const_body_iterator BI = CS->body_begin(), BE = CS->body_end()
+ ;BI != BE; ++BI)
+ if (Expr *E = dyn_cast<Expr>((*BI)))
+ if (isCapturedBy(var, E))
+ return true;
+ return false;
+ }
for (Stmt::const_child_range children = e->children(); children; ++children)
if (isCapturedBy(var, cast<Expr>(*children)))
More information about the cfe-commits
mailing list