1 // RUN: %clang_cc1 -verify -fopenmp %s 2 foo()3void foo() { 4 } 5 foobool(int argc)6bool foobool(int argc) { 7 return argc; 8 } 9 10 struct S1; // expected-note {{declared here}} 11 12 template <class T, class S> // expected-note {{declared here}} tmain(T argc,S ** argv)13int tmain(T argc, S **argv) { 14 T i; 15 #pragma omp parallel for simd if // expected-error {{expected '(' after 'if'}} 16 for (i = 0; i < argc; ++i) foo(); 17 #pragma omp parallel for simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 18 for (i = 0; i < argc; ++i) foo(); 19 #pragma omp parallel for simd if () // expected-error {{expected expression}} 20 for (i = 0; i < argc; ++i) foo(); 21 #pragma omp parallel for simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 22 for (i = 0; i < argc; ++i) foo(); 23 #pragma omp parallel for simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}} 24 for (i = 0; i < argc; ++i) foo(); 25 #pragma omp parallel for simd if (argc > 0 ? argv[1] : argv[2]) 26 for (i = 0; i < argc; ++i) foo(); 27 #pragma omp parallel for simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'if' clause}} 28 for (i = 0; i < argc; ++i) foo(); 29 #pragma omp parallel for simd if (S) // expected-error {{'S' does not refer to a value}} 30 for (i = 0; i < argc; ++i) foo(); 31 #pragma omp parallel for simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} 32 for (i = 0; i < argc; ++i) foo(); 33 #pragma omp parallel for simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} 34 for (i = 0; i < argc; ++i) foo(); 35 #pragma omp parallel for simd if(argc) 36 for (i = 0; i < argc; ++i) foo(); 37 #pragma omp parallel for simd if(parallel // expected-warning {{missing ':' after directive name modifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 38 for (i = 0; i < argc; ++i) foo(); 39 #pragma omp parallel for simd if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 40 for (i = 0; i < argc; ++i) foo(); 41 #pragma omp parallel for simd if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 42 for (i = 0; i < argc; ++i) foo(); 43 #pragma omp parallel for simd if(parallel : argc) 44 for (i = 0; i < argc; ++i) foo(); 45 #pragma omp parallel for simd if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp parallel for simd'}} 46 for (i = 0; i < argc; ++i) foo(); 47 #pragma omp parallel for simd if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'if' clause with 'parallel' name modifier}} 48 for (i = 0; i < argc; ++i) foo(); 49 #pragma omp parallel for simd if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}} 50 for (i = 0; i < argc; ++i) foo(); 51 52 return 0; 53 } 54 main(int argc,char ** argv)55int main(int argc, char **argv) { 56 int i; 57 #pragma omp parallel for simd if // expected-error {{expected '(' after 'if'}} 58 for (i = 0; i < argc; ++i) foo(); 59 #pragma omp parallel for simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 60 for (i = 0; i < argc; ++i) foo(); 61 #pragma omp parallel for simd if () // expected-error {{expected expression}} 62 for (i = 0; i < argc; ++i) foo(); 63 #pragma omp parallel for simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 64 for (i = 0; i < argc; ++i) foo(); 65 #pragma omp parallel for simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}} 66 for (i = 0; i < argc; ++i) foo(); 67 #pragma omp parallel for simd if (argc > 0 ? argv[1] : argv[2]) 68 for (i = 0; i < argc; ++i) foo(); 69 #pragma omp parallel for simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'if' clause}} 70 for (i = 0; i < argc; ++i) foo(); 71 #pragma omp parallel for simd if (S1) // expected-error {{'S1' does not refer to a value}} 72 for (i = 0; i < argc; ++i) foo(); 73 #pragma omp parallel for simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} 74 for (i = 0; i < argc; ++i) foo(); 75 #pragma omp parallel for simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} 76 for (i = 0; i < argc; ++i) foo(); 77 #pragma omp parallel for simd if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}} 78 for (i = 0; i < argc; ++i) foo(); 79 #pragma omp parallel for simd if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 80 for (i = 0; i < argc; ++i) foo(); 81 #pragma omp parallel for simd if(parallel // expected-warning {{missing ':' after directive name modifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 82 for (i = 0; i < argc; ++i) foo(); 83 #pragma omp parallel for simd if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 84 for (i = 0; i < argc; ++i) foo(); 85 #pragma omp parallel for simd if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 86 for (i = 0; i < argc; ++i) foo(); 87 #pragma omp parallel for simd if(parallel : argc) 88 for (i = 0; i < argc; ++i) foo(); 89 #pragma omp parallel for simd if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp parallel for simd'}} 90 for (i = 0; i < argc; ++i) foo(); 91 #pragma omp parallel for simd if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'if' clause with 'parallel' name modifier}} 92 for (i = 0; i < argc; ++i) foo(); 93 #pragma omp parallel for simd if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}} 94 for (i = 0; i < argc; ++i) foo(); 95 96 return tmain(argc, argv); 97 } 98