r198300 - [OpenCL] The kernel attribute can only be used on functions.
Joey Gouly
joey.gouly at gmail.com
Thu Jan 2 04:04:42 PST 2014
Author: joey
Date: Thu Jan 2 06:04:42 2014
New Revision: 198300
URL: http://llvm.org/viewvc/llvm-project?rev=198300&view=rev
Log:
[OpenCL] The kernel attribute can only be used on functions.
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/test/SemaOpenCL/invalid-kernel-attrs.cl
Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=198300&r1=198299&r2=198300&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Thu Jan 2 06:04:42 2014
@@ -432,6 +432,7 @@ def CXX11NoReturn : InheritableAttr {
def OpenCLKernel : InheritableAttr {
let Spellings = [Keyword<"__kernel">, Keyword<"kernel">];
+ let Subjects = SubjectList<[Function], ErrorDiag>;
}
def OpenCLImageAccess : Attr {
Modified: cfe/trunk/test/SemaOpenCL/invalid-kernel-attrs.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/invalid-kernel-attrs.cl?rev=198300&r1=198299&r2=198300&view=diff
==============================================================================
--- cfe/trunk/test/SemaOpenCL/invalid-kernel-attrs.cl (original)
+++ cfe/trunk/test/SemaOpenCL/invalid-kernel-attrs.cl Thu Jan 2 06:04:42 2014
@@ -25,3 +25,8 @@ constant int foo1 __attribute__((reqd_w
constant int foo2 __attribute__((work_group_size_hint(8,16,32))); // expected-error {{'work_group_size_hint' attribute only applies to functions}}
constant int foo3 __attribute__((vec_type_hint(char))); // expected-error {{'vec_type_hint' attribute only applies to functions}}
+
+void f_kernel_image2d_t( kernel image2d_t image ) { // expected-error {{'kernel' attribute only applies to functions}}
+ int __kernel x; // expected-error {{'__kernel' attribute only applies to functions}}
+
+}
More information about the cfe-commits
mailing list