[cfe-commits] r79050 - in /cfe/trunk: lib/Sema/SemaStmt.cpp test/SemaObjC/blocks.m

Daniel Dunbar daniel at zuster.org
Sat Aug 15 21:04:45 PDT 2009


Hi Fariborz,

Should isObjCObjectPointerType return true for block pointers?

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...

 - 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