diff options
author | Joey Gouly <joey.gouly@gmail.com> | 2014-01-02 12:04:42 +0000 |
---|---|---|
committer | Joey Gouly <joey.gouly@gmail.com> | 2014-01-02 12:04:42 +0000 |
commit | d4993032a9bd985a296729f52b14de207f128083 (patch) | |
tree | 7ca9ae94723c680fc02c89a6f56ae9ce08a068de | |
parent | 1d5e0d308a29a77e131e6616465c2a84a5af453d (diff) | |
download | bcm5719-llvm-d4993032a9bd985a296729f52b14de207f128083.tar.gz bcm5719-llvm-d4993032a9bd985a296729f52b14de207f128083.zip |
[OpenCL] The kernel attribute can only be used on functions.
llvm-svn: 198300
-rw-r--r-- | clang/include/clang/Basic/Attr.td | 1 | ||||
-rw-r--r-- | clang/test/SemaOpenCL/invalid-kernel-attrs.cl | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index c63a1d07b2d..cd1cbb22183 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -432,6 +432,7 @@ def CXX11NoReturn : InheritableAttr { def OpenCLKernel : InheritableAttr { let Spellings = [Keyword<"__kernel">, Keyword<"kernel">]; + let Subjects = SubjectList<[Function], ErrorDiag>; } def OpenCLImageAccess : Attr { diff --git a/clang/test/SemaOpenCL/invalid-kernel-attrs.cl b/clang/test/SemaOpenCL/invalid-kernel-attrs.cl index 0da7ddf34dd..81ce1227cbb 100644 --- a/clang/test/SemaOpenCL/invalid-kernel-attrs.cl +++ b/clang/test/SemaOpenCL/invalid-kernel-attrs.cl @@ -25,3 +25,8 @@ constant int foo1 __attribute__((reqd_work_group_size(8,16,32))); // expected-e 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}} + +} |