aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-08-23 00:27:49 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-08-23 00:27:49 +0000
commitb9dbab1e78917c80704428f948f7b2ef8110f8e1 (patch)
treed62e09dce17f2dc45b350d692fccc7d576be3187 /lib/CodeGen/CGDecl.cpp
parent6fa7dbeac72b5d29484a6e01cc4e9b68b49133a4 (diff)
block IRgen - Fixes a crash when determining if given block variable
is captured by a given statement expression. // rdar://10001085 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r--lib/CodeGen/CGDecl.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index 6e65e88bce..6be6fcedd3 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -875,6 +875,9 @@ static bool isCapturedBy(const VarDecl &var, const Expr *e) {
return false;
}
+ if (const StmtExpr *SE = dyn_cast<StmtExpr>(e))
+ e = cast<Expr>(SE->getSubStmt()->body_back());
+
for (Stmt::const_child_range children = e->children(); children; ++children)
if (isCapturedBy(var, cast<Expr>(*children)))
return true;