[OpenCL] __generic address space for CL2.0

Aaron Ballman aaron at aaronballman.com
Wed Nov 12 05:08:30 PST 2014


On Mon, Nov 10, 2014 at 12:53 PM, Anastasia Stulova
<anastasia.stulova at arm.com> wrote:
> This patch adds parsing of __generic as a keyword and extends Clang address
> spaces with generic one.

> diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td
> index 51837fe..a90bfaa 100644
> --- a/include/clang/Basic/Attr.td
> +++ b/include/clang/Basic/Attr.td
> @@ -640,6 +640,11 @@ def OpenCLConstantAddressSpace : TypeAttr {
>    let Documentation = [Undocumented];
>  }
>
> +def OpenCLGenericAddressSpace : TypeAttr {
> +  let Spellings = [Keyword<"__generic">, Keyword<"generic">];
> +  let Documentation = [Undocumented];
> +}

No new undocumented attributes, please. :-)

> diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
> index 90d30d7..1087a22 100644
> --- a/include/clang/Basic/DiagnosticParseKinds.td
> +++ b/include/clang/Basic/DiagnosticParseKinds.td
> @@ -932,6 +932,8 @@ def err_pragma_optimize_extra_argument : Error<
>  // OpenCL Section 6.8.g
>  def err_not_opencl_storage_class_specifier : Error<
>    "OpenCL does not support the '%0' storage class specifier">;
> +def err_opencl_unknown_type_specifier : Error<
> +  "OpenCL does not support the '%0' type qualifier">;

These could be combined with a %select.

> --- /dev/null
> +++ b/test/Parser/opencl-cl20.cl
> @@ -0,0 +1,5 @@
> +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
> +// expected-no-diagnostics
> +
> +void __generic_test(__generic int *g) {}
> +void generic_test(generic int *g) {}
>

You are missing a test case that exercises the new diagnostic you've
added. Also, since this attribute can go on any type, does it make
sense to place it on a function type, or other parsing contexts?

Thanks!

~Aaron

>
>
>
> A basic parsing test is included in this patch.
>
>
>
> Looking forward to your feedback,
>
> Anastasia
>
>
> _______________________________________________
> 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