[cfe-commits] r56770 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/block-args.c

Chris Lattner clattner at apple.com
Sun Sep 28 13:44:44 PDT 2008


On Sep 28, 2008, at 1:42 PM, Chris Lattner wrote:

>
> On Sep 28, 2008, at 7:02 AM, Steve Naroff wrote:
>
>> Author: snaroff
>> Date: Sun Sep 28 09:02:55 2008
>> New Revision: 56770
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=56770&view=rev
>> Log:
>> Fix <rdar://problem/6252108> assigning to argument passed to block  
>> should not require __block.
>
> Hi Steve,
>
> Won't this break something like this:
>
>> +int main(int argc) {
>> +  ^(int X) {
>> +    argc = 3;
>> +  };
>> +}
>
>
> The ParmVarDecl referenced has to belong to the block, it can't  
> belong to the containing function.

In fact, I think the whole problem is really the reliance on  
'DeclDefinedWithinScope'.  I think that DeclDefinedWithinScope should  
be nuked, and DeclContext should be used to determine whether  
something is within the block or not.  Each block literal should  
define a new DeclContext, and this will hopefully make the predicate  
trivial (and faster!).  DeclContext didn't exist when the initial  
blocks support was added to clang.

-Chris



More information about the cfe-commits mailing list