1// RUN: %clang_cc1 %s -fblocks -verify -pedantic -fsyntax-only -ferror-limit 100 2// RUN: %clang_cc1 %s -fblocks -verify -pedantic -fsyntax-only -ferror-limit 100 -cl-std=CL1.2 3// RUN: %clang_cc1 %s -fblocks -verify -pedantic -fsyntax-only -ferror-limit 100 -cl-std=CL3.0 -cl-ext=-__opencl_c_device_enqueue,-__opencl_c_generic_address_space,-__opencl_c_pipes 4 5// Confirm CL2.0 Clang builtins are not available in earlier versions and in OpenCL C 3.0 without required features. 6 7kernel void dse_builtins(void) { 8 int tmp; 9 enqueue_kernel(tmp, tmp, tmp, ^(void) { // expected-error{{use of undeclared identifier 'enqueue_kernel'}} 10 return; 11 }); 12 unsigned size = get_kernel_work_group_size(^(void) { // expected-error{{use of undeclared identifier 'get_kernel_work_group_size'}} 13 return; 14 }); 15 size = get_kernel_preferred_work_group_size_multiple(^(void) { // expected-error{{use of undeclared identifier 'get_kernel_preferred_work_group_size_multiple'}} 16 return; 17 }); 18#if (__OPENCL_C_VERSION__ >= CL_VERSION_3_0) && !defined(__opencl_c_device_enqueue) 19// expected-error@-10{{support disabled - compile with -fblocks or for OpenCL C 2.0 or OpenCL C 3.0 with __opencl_c_device_enqueue feature}} 20// FIXME: the typo correction for the undeclared identifiers finds alternative 21// suggestions, but instantiating the typo correction causes us to 22// re-instantiate the argument to the call, which triggers the support 23// diagnostic a second time. 24// expected-error@-12 2{{support disabled - compile with -fblocks or for OpenCL C 2.0 or OpenCL C 3.0 with __opencl_c_device_enqueue feature}} 25// expected-error@-10 2{{support disabled - compile with -fblocks or for OpenCL C 2.0 or OpenCL C 3.0 with __opencl_c_device_enqueue feature}} 26#endif 27} 28 29void pipe_builtins(void) { 30 int tmp; 31 32 // FIXME: the typo correction for this case goes off the rails and tries to 33 // convert this mistake into a for loop instead of a local function 34 // declaration. 35 foo(void); // expected-error{{use of undeclared identifier 'foo'; did you mean 'for'?}} 36 // expected-error@-1{{expected identifier or '('}} 37 // expected-note@-2{{to match this '('}} 38 boo(); // expected-error{{use of undeclared identifier 'boo'}} 39 // expected-error@-1{{expected ';' in 'for' statement specifier}} 40 41 read_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'read_pipe'}} 42 // expected-error@-1{{expected ')'}} 43 write_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'write_pipe'}} 44 45 reserve_read_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'reserve_read_pipe'}} 46 reserve_write_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'reserve_write_pipe'}} 47 48 work_group_reserve_read_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'work_group_reserve_read_pipe'}} 49 work_group_reserve_write_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'work_group_reserve_write_pipe'}} 50 51 sub_group_reserve_write_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'sub_group_reserve_write_pipe'}} 52 sub_group_reserve_read_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'sub_group_reserve_read_pipe'}} 53 54 commit_read_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'commit_read_pipe'}} 55 commit_write_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'commit_write_pipe'}} 56 57 work_group_commit_read_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'work_group_commit_read_pipe'}} 58 work_group_commit_write_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'work_group_commit_write_pipe'}} 59 60 sub_group_commit_write_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'sub_group_commit_write_pipe'}} 61 sub_group_commit_read_pipe(tmp, tmp); // expected-error{{use of undeclared identifier 'sub_group_commit_read_pipe'}} 62 63 get_pipe_num_packets(tmp); // expected-error{{use of undeclared identifier 'get_pipe_num_packets'}} 64 get_pipe_max_packets(tmp); // expected-error{{use of undeclared identifier 'get_pipe_max_packets'}} 65} 66