Home | History | Annotate | Download | only in Parser
      1 // RUN: %clang_cc1 -std=c++11 -verify %s
      2 
      3 // Note that this puts the expected lines before the directives to work around
      4 // limitations in the -verify mode.
      5 
      6 void test(int *List, int Length) {
      7   int i = 0;
      8 
      9 #pragma clang loop vectorize(assume_safety)
     10 #pragma clang loop interleave(assume_safety)
     11   while (i + 1 < Length) {
     12     List[i] = i;
     13   }
     14 
     15 /* expected-error {{expected ')'}} */ #pragma clang loop vectorize(assume_safety
     16 /* expected-error {{expected ')'}} */ #pragma clang loop interleave(assume_safety
     17 
     18 /* expected-error {{invalid argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll(assume_safety)
     19 /* expected-error {{invalid argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute(assume_safety)
     20 
     21 /* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop vectorize(badidentifier)
     22 /* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop interleave(badidentifier)
     23 /* expected-error {{invalid argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll(badidentifier)
     24   while (i-7 < Length) {
     25     List[i] = i;
     26   }
     27 
     28 /* expected-error {{duplicate directives 'vectorize(assume_safety)' and 'vectorize(enable)'}} */ #pragma clang loop vectorize(enable)
     29 #pragma clang loop vectorize(assume_safety)
     30 /* expected-error {{duplicate directives 'interleave(assume_safety)' and 'interleave(enable)'}} */ #pragma clang loop interleave(enable)
     31 #pragma clang loop interleave(assume_safety)
     32   while (i-9 < Length) {
     33     List[i] = i;
     34   }
     35 }
     36