• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -verify -pedantic -fsyntax-only -cl-std=CL1.2 %s
2// RUN: %clang_cc1 -verify -pedantic -fsyntax-only -cl-std=CL2.0 %s
3
4typedef image1d_t img1d_ro_default; // expected-note {{previously declared 'read_only' here}}
5
6typedef write_only image1d_t img1d_wo; // expected-note {{previously declared 'write_only' here}}
7typedef read_only image1d_t img1d_ro;
8
9#if __OPENCL_C_VERSION__ >= 200
10typedef read_write image1d_t img1d_rw;
11#endif
12
13typedef int Int;
14typedef read_only int IntRO; // expected-error {{access qualifier can only be used for pipe and image type}}
15
16
17void myWrite(write_only image1d_t); // expected-note {{passing argument to parameter here}} expected-note {{passing argument to parameter here}}
18void myRead(read_only image1d_t); // expected-note {{passing argument to parameter here}}
19
20#if __OPENCL_C_VERSION__ >= 200
21void myReadWrite(read_write image1d_t);
22#else
23void myReadWrite(read_write image1d_t); // expected-error {{access qualifier 'read_write' can not be used for '__read_write image1d_t' prior to OpenCL version 2.0}}
24#endif
25
26
27kernel void k1(img1d_wo img) {
28  myRead(img); // expected-error {{passing 'img1d_wo' (aka '__write_only image1d_t') to parameter of incompatible type '__read_only image1d_t'}}
29}
30
31kernel void k2(img1d_ro img) {
32  myWrite(img); // expected-error {{passing 'img1d_ro' (aka '__read_only image1d_t') to parameter of incompatible type '__write_only image1d_t'}}
33}
34
35kernel void k3(img1d_wo img) {
36  myWrite(img);
37}
38
39#if __OPENCL_C_VERSION__ >= 200
40kernel void k4(img1d_rw img) {
41  myReadWrite(img);
42}
43#endif
44
45kernel void k5(img1d_ro_default img) {
46  myWrite(img); // expected-error {{passing 'img1d_ro_default' (aka '__read_only image1d_t') to parameter of incompatible type '__write_only image1d_t'}}
47}
48
49kernel void k6(img1d_ro img) {
50  myRead(img);
51}
52
53kernel void k7(read_only img1d_wo img){} // expected-error {{multiple access qualifiers}}
54
55kernel void k8(write_only img1d_ro_default img){} // expected-error {{multiple access qualifiers}}
56
57kernel void k9(read_only int i){} // expected-error{{access qualifier can only be used for pipe and image type}}
58
59kernel void k10(read_only Int img){} // expected-error {{access qualifier can only be used for pipe and image type}}
60
61kernel void k11(read_only write_only image1d_t i){} // expected-error{{multiple access qualifiers}}
62
63kernel void k12(read_only read_only image1d_t i){} // expected-error{{multiple access qualifiers}}
64
65#if __OPENCL_C_VERSION__ >= 200
66kernel void k13(read_write pipe int i){} // expected-error{{access qualifier 'read_write' can not be used for 'pipe int'}}
67#else
68kernel void k13(__read_write image1d_t i){} // expected-error{{access qualifier '__read_write' can not be used for '__read_write image1d_t' prior to OpenCL version 2.0}}
69#endif
70