[cfe-commits] r138314 - in /cfe/trunk: lib/CodeGen/CGDecl.cpp test/CodeGen/block-3.c
jahanian
fjahanian at apple.com
Tue Aug 23 09:49:00 PDT 2011
On Aug 22, 2011, at 7:32 PM, John McCall wrote:
> On Aug 22, 2011, at 5:59 PM, Eli Friedman wrote:
>> On Mon, Aug 22, 2011 at 5:27 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
>>> Author: fjahanian
>>> Date: Mon Aug 22 19:27:49 2011
>>> New Revision: 138314
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=138314&view=rev
>>> Log:
>>> block IRgen - Fixes a crash when determining if given block variable
>>> is captured by a given statement expression. // rdar://10001085
>>>
>>> Added:
>>> cfe/trunk/test/CodeGen/block-3.c
>>> 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=138314&r1=138313&r2=138314&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGDecl.cpp Mon Aug 22 19:27:49 2011
>>> @@ -875,6 +875,9 @@
>>> 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;
>>
>> SE->getSubStmt()->body_back() isn't guaranteed to be an Expr here.
>> Also, don't you need to check the other substatements?
>
> I agree; the right solution here is to be able to recursively walk over
> arbitrary statements.
>
This is in r138334 now. Thanks to both.
- Fariborz
> John.
More information about the cfe-commits
mailing list