[cfe-commits] r79050 - in /cfe/trunk: lib/Sema/SemaStmt.cpp test/SemaObjC/blocks.m
Fariborz Jahanian
fjahanian at apple.com
Sun Aug 16 09:52:55 PDT 2009
On Aug 15, 2009, at 9:04 PM, Daniel Dunbar wrote:
> Hi Fariborz,
>
> Should isObjCObjectPointerType return true for block pointers?
I would like to keep them separate as isObjCObjectPointerType may be
used for such things as
encoding and other uses which may not be applicable to a block pointer.
>
>
> Also, I think we should fix the warning for a real type mismatch to be
> more meaningful. Selector element mismatch doesn't make any sense...
I think the term came from the instigator of the foreach statement,
which probably came from
Ruby. Yes, it is confusing with objc's selector name. Do you have a
suggestion?
- fariborz
>
>
> - Daniel
>
> On Fri, Aug 14, 2009 at 2:53 PM, Fariborz
> Jahanian<fjahanian at apple.com> wrote:
>> Author: fjahanian
>> Date: Fri Aug 14 16:53:27 2009
>> New Revision: 79050
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=79050&view=rev
>> Log:
>> objc2's foreach statement's selector type can be
>> a block pointer too.
>>
>> Modified:
>> cfe/trunk/lib/Sema/SemaStmt.cpp
>> cfe/trunk/test/SemaObjC/blocks.m
>>
>> Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=79050&r1=79049&r2=79050&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaStmt.cpp Fri Aug 14 16:53:27 2009
>> @@ -693,7 +693,8 @@
>>
>> FirstType = static_cast<Expr*>(First)->getType();
>> }
>> - if (!FirstType->isObjCObjectPointerType())
>> + if (!FirstType->isObjCObjectPointerType() &&
>> + !FirstType->isBlockPointerType())
>> Diag(ForLoc, diag::err_selector_element_type)
>> << FirstType << First->getSourceRange();
>> }
>>
>> Modified: cfe/trunk/test/SemaObjC/blocks.m
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/blocks.m?rev=79050&r1=79049&r2=79050&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/test/SemaObjC/blocks.m (original)
>> +++ cfe/trunk/test/SemaObjC/blocks.m Fri Aug 14 16:53:27 2009
>> @@ -44,3 +44,14 @@
>> P = ^itf() {}; // expected-error {{Objective-C interface
>> type 'itf' cannot be returned by value}}
>> P = ^itf{}; // expected-error {{Objective-C interface
>> type 'itf' cannot be returned by value}}
>> }
>> +
>> +
>> +int foo9() {
>> + typedef void (^DVTOperationGroupScheduler)();
>> + id _suboperationSchedulers;
>> +
>> + for (DVTOperationGroupScheduler scheduler in
>> _suboperationSchedulers) {
>> + ;
>> + }
>> +
>> +}
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
More information about the cfe-commits
mailing list