22 lines · plain
1//RUN: %clang_cc1 -cl-std=CL2.0 -fsyntax-only -verify %s2 3kernel void B (global int *x) {4 __attribute__((opencl_unroll_hint(42))) // expected-error {{'opencl_unroll_hint' attribute only applies to 'for', 'while', and 'do' statements}}5 if (x[0])6 x[0] = 15;7}8 9void parse_order_error() {10 // Ensure we properly diagnose OpenCL loop attributes on the incorrect11 // subject in the presence of other attributes.12 int i = 1000;13 __attribute__((nomerge, opencl_unroll_hint(8))) // expected-error {{'opencl_unroll_hint' attribute only applies to 'for', 'while', and 'do' statements}}14 if (i) { parse_order_error(); } // Recursive call silences unrelated diagnostic about nomerge.15 16 __attribute__((opencl_unroll_hint(8), nomerge)) // expected-error {{'opencl_unroll_hint' attribute only applies to 'for', 'while', and 'do' statements}}17 if (i) { parse_order_error(); } // Recursive call silences unrelated diagnostic about nomerge.18 19 __attribute__((nomerge, opencl_unroll_hint(8))) // OK20 while (1) { parse_order_error(); } // Recursive call silences unrelated diagnostic about nomerge.21}22