diff options
Diffstat (limited to 'clang/test/SemaOpenCL')
| -rw-r--r-- | clang/test/SemaOpenCL/invalid-access-qualifier.cl | 14 | ||||
| -rw-r--r-- | clang/test/SemaOpenCL/invalid-kernel-attrs.cl | 2 | ||||
| -rw-r--r-- | clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl | 4 |
3 files changed, 16 insertions, 4 deletions
diff --git a/clang/test/SemaOpenCL/invalid-access-qualifier.cl b/clang/test/SemaOpenCL/invalid-access-qualifier.cl new file mode 100644 index 00000000000..b090bb57338 --- /dev/null +++ b/clang/test/SemaOpenCL/invalid-access-qualifier.cl @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -verify %s +// RUN: %clang_cc1 -verify -cl-std=CL2.0 -DCL20 %s + +void test1(read_only int i){} // expected-error{{access qualifier can only be used for pipe and image type}} + +void test2(read_only write_only image1d_t i){} // expected-error{{multiple access qualifiers}} + +void test3(read_only read_only image1d_t i){} // expected-error{{multiple access qualifiers}} + +#ifdef CL20 +void test4(read_write pipe int i){} // expected-error{{access qualifier 'read_write' can not be used for 'pipe'}} +#else +void test4(__read_write image1d_t i){} // expected-error{{access qualifier '__read_write' can not be used for 'image1d_t' earlier than OpenCL2.0 version}} +#endif diff --git a/clang/test/SemaOpenCL/invalid-kernel-attrs.cl b/clang/test/SemaOpenCL/invalid-kernel-attrs.cl index 4b4fdf79e3d..cedbb066467 100644 --- a/clang/test/SemaOpenCL/invalid-kernel-attrs.cl +++ b/clang/test/SemaOpenCL/invalid-kernel-attrs.cl @@ -28,8 +28,6 @@ constant int foo3 __attribute__((vec_type_hint(char))) = 0; // expected-error {{ 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}} - read_only int i; // expected-error {{'read_only' attribute only applies to parameters}} - __write_only int j; // expected-error {{'__write_only' attribute only applies to parameters}} } kernel __attribute__((reqd_work_group_size(1,2,0))) void kernel11(){} // expected-error {{'reqd_work_group_size' attribute must be greater than 0}} diff --git a/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl b/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl index 3b613b57cf2..7836a25e7f3 100644 --- a/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl +++ b/clang/test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl @@ -21,7 +21,7 @@ void test1(read_only pipe int p, global int* ptr){ // commit_read/write_pipe commit_read_pipe(tmp, rid); // expected-error{{first argument to commit_read_pipe must be a pipe type}} work_group_commit_read_pipe(p, tmp); // expected-error{{invalid argument type to function work_group_commit_read_pipe (expecting 'reserve_id_t')}} - sub_group_commit_write_pipe(p, tmp); // expected-error{{nvalid pipe access modifier (expecting write_only)}} + sub_group_commit_write_pipe(p, tmp); // expected-error{{invalid pipe access modifier (expecting write_only)}} } void test2(write_only pipe int p, global int* ptr){ @@ -45,7 +45,7 @@ void test2(write_only pipe int p, global int* ptr){ // commit_read/write_pipe commit_write_pipe(tmp, rid); // expected-error{{first argument to commit_write_pipe must be a pipe type}} work_group_commit_write_pipe(p, tmp); // expected-error{{invalid argument type to function work_group_commit_write_pipe (expecting 'reserve_id_t')}} - sub_group_commit_read_pipe(p, tmp); // expected-error{{nvalid pipe access modifier (expecting read_only)}} + sub_group_commit_read_pipe(p, tmp); // expected-error{{invalid pipe access modifier (expecting read_only)}} } void test3(){ |

