]> granicus.if.org Git - clang/commit
CodeGen: block capture shouldn't ICE
authorJF Bastien <jfb@google.com>
Sat, 19 May 2018 04:21:26 +0000 (04:21 +0000)
committerJF Bastien <jfb@google.com>
Sat, 19 May 2018 04:21:26 +0000 (04:21 +0000)
commit8315ee9477cf32cc7420ef89e80fd151916b3951
treeb7b88021adac986193550c0d618255547d5b98e4
parentbdd8eec77435aa6a2ea91fa4844fedf6d8a34cc3
CodeGen: block capture shouldn't ICE

When a lambda capture captures a __block in the same statement, the compiler asserts out because isCapturedBy assumes that an Expr can only be a BlockExpr, StmtExpr, or if it's a Stmt then all the statement's children are expressions. That's wrong, we need to visit all sub-statements even if they're not expressions to see if they also capture.

Fix this issue by pulling out the isCapturedBy logic to use RecursiveASTVisitor.

<rdar://problem/39926584>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332801 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGDecl.cpp
test/CodeGenCXX/block-capture.cpp [new file with mode: 0644]