| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ast-print %s | FileCheck %s | ||
| // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -emit-pch -o %t %s | ||
| // RUN: %clang_cc1 -fopenmp=libiomp5 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s | ||
| // expected-no-diagnostics | ||
|
|
||
| #ifndef HEADER | ||
| #define HEADER | ||
|
|
||
| void foo() {} | ||
|
|
||
| template <class T, int N> | ||
| T tmain(T argc) { | ||
| T b = argc, c, d, e, f, h; | ||
| static T a; | ||
| // CHECK: static T a; | ||
| static T g; | ||
| #pragma omp threadprivate(g) | ||
| #pragma omp parallel for schedule(dynamic) default(none) copyin(g) | ||
| // CHECK: #pragma omp parallel for schedule(dynamic) default(none) copyin(g) | ||
| for (int i = 0; i < 2; ++i) | ||
| a = 2; | ||
| // CHECK-NEXT: for (int i = 0; i < 2; ++i) | ||
| // CHECK-NEXT: a = 2; | ||
| #pragma omp parallel for private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered if (argc) num_threads(N) default(shared) shared(e) reduction(+ : h) | ||
| for (int i = 0; i < 10; ++i) | ||
| for (int j = 0; j < 10; ++j) | ||
| for (int j = 0; j < 10; ++j) | ||
| for (int j = 0; j < 10; ++j) | ||
| for (int j = 0; j < 10; ++j) | ||
| foo(); | ||
| // CHECK-NEXT: #pragma omp parallel for private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered if(argc) num_threads(N) default(shared) shared(e) reduction(+: h) | ||
| // CHECK-NEXT: for (int i = 0; i < 10; ++i) | ||
| // CHECK-NEXT: for (int j = 0; j < 10; ++j) | ||
| // CHECK-NEXT: for (int j = 0; j < 10; ++j) | ||
| // CHECK-NEXT: for (int j = 0; j < 10; ++j) | ||
| // CHECK-NEXT: for (int j = 0; j < 10; ++j) | ||
| // CHECK-NEXT: foo(); | ||
| return T(); | ||
| } | ||
|
|
||
| int main(int argc, char **argv) { | ||
| int b = argc, c, d, e, f, h; | ||
| static int a; | ||
| // CHECK: static int a; | ||
| static float g; | ||
| #pragma omp threadprivate(g) | ||
| #pragma omp parallel for schedule(guided, argc) default(none) copyin(g) | ||
| // CHECK: #pragma omp parallel for schedule(guided, argc) default(none) copyin(g) | ||
| for (int i = 0; i < 2; ++i) | ||
| a = 2; | ||
| // CHECK-NEXT: for (int i = 0; i < 2; ++i) | ||
| // CHECK-NEXT: a = 2; | ||
| #pragma omp parallel for private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) schedule(auto) ordered if (argc) num_threads(a) default(shared) shared(e) reduction(+ : h) | ||
| for (int i = 0; i < 10; ++i) | ||
| for (int j = 0; j < 10; ++j) | ||
| foo(); | ||
| // CHECK-NEXT: #pragma omp parallel for private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) schedule(auto) ordered if(argc) num_threads(a) default(shared) shared(e) reduction(+: h) | ||
| // CHECK-NEXT: for (int i = 0; i < 10; ++i) | ||
| // CHECK-NEXT: for (int j = 0; j < 10; ++j) | ||
| // CHECK-NEXT: foo(); | ||
| return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0])); | ||
| } | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s | ||
|
|
||
| void foo() { | ||
| } | ||
|
|
||
| bool foobool(int argc) { | ||
| return argc; | ||
| } | ||
|
|
||
| struct S1; // expected-note {{declared here}} | ||
|
|
||
| template <class T, typename S, int N, int ST> // expected-note {{declared here}} | ||
| T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} | ||
| #pragma omp parallel for collapse // expected-error {{expected '(' after 'collapse'}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for collapse ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for collapse () // expected-error {{expected expression}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}} | ||
| // expected-error@+2 2 {{expression is not an integral constant expression}} | ||
| // expected-note@+1 2 {{read of non-const variable 'argc' is not allowed in a constant expression}} | ||
| #pragma omp parallel for collapse (argc | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| // expected-error@+1 2 {{argument to 'collapse' clause must be a positive integer value}} | ||
| #pragma omp parallel for collapse (ST // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for collapse (1)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp parallel for', but found only 1}} | ||
| // expected-error@+3 2 {{directive '#pragma omp parallel for' cannot contain more than one 'collapse' clause}} | ||
| // expected-error@+2 2 {{argument to 'collapse' clause must be a positive integer value}} | ||
| // expected-error@+1 2 {{expression is not an integral constant expression}} | ||
| #pragma omp parallel for collapse (foobool(argc)), collapse (true), collapse (-5) | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for collapse (S) // expected-error {{'S' does not refer to a value}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| // expected-error@+1 2 {{expression is not an integral constant expression}} | ||
| #pragma omp parallel for collapse (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for collapse (1) | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for collapse (N) // expected-error {{argument to 'collapse' clause must be a positive integer value}} | ||
| for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for collapse (2) // expected-note {{as specified in 'collapse' clause}} | ||
| foo(); // expected-error {{expected 2 for loops after '#pragma omp parallel for'}} | ||
| return argc; | ||
| } | ||
|
|
||
| int main(int argc, char **argv) { | ||
| #pragma omp parallel for collapse // expected-error {{expected '(' after 'collapse'}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| #pragma omp parallel for collapse ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| #pragma omp parallel for collapse () // expected-error {{expected expression}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| #pragma omp parallel for collapse (4 // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{as specified in 'collapse' clause}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; // expected-error {{expected 4 for loops after '#pragma omp parallel for', but found only 1}} | ||
| #pragma omp parallel for collapse (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} expected-note {{as specified in 'collapse' clause}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; // expected-error {{expected 4 for loops after '#pragma omp parallel for', but found only 1}} | ||
| #pragma omp parallel for collapse (foobool(1) > 0 ? 1 : 2) // expected-error {{expression is not an integral constant expression}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| // expected-error@+3 {{expression is not an integral constant expression}} | ||
| // expected-error@+2 2 {{directive '#pragma omp parallel for' cannot contain more than one 'collapse' clause}} | ||
| // expected-error@+1 2 {{argument to 'collapse' clause must be a positive integer value}} | ||
| #pragma omp parallel for collapse (foobool(argc)), collapse (true), collapse (-5) | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| #pragma omp parallel for collapse (S1) // expected-error {{'S1' does not refer to a value}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| // expected-error@+1 {{expression is not an integral constant expression}} | ||
| #pragma omp parallel for collapse (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| // expected-error@+3 {{statement after '#pragma omp parallel for' must be a for loop}} | ||
| // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}} | ||
| #pragma omp parallel for collapse(collapse(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} | ||
| foo(); | ||
| #pragma omp parallel for collapse (2) // expected-note {{as specified in 'collapse' clause}} | ||
| foo(); // expected-error {{expected 2 for loops after '#pragma omp parallel for'}} | ||
| // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}} | ||
| return tmain<int, char, 1, 0>(argc, argv); | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 -o - %s | ||
|
|
||
| void foo() { | ||
| } | ||
|
|
||
| bool foobool(int argc) { | ||
| return argc; | ||
| } | ||
|
|
||
| struct S1; // expected-note {{declared here}} | ||
| class S2 { | ||
| mutable int a; | ||
|
|
||
| public: | ||
| S2() : a(0) {} | ||
| S2 &operator=(S2 &s2) { return *this; } | ||
| }; | ||
| class S3 { | ||
| int a; | ||
|
|
||
| public: | ||
| S3() : a(0) {} | ||
| S3 &operator=(S3 &s3) { return *this; } | ||
| }; | ||
| class S4 { // expected-note {{'S4' declared here}} | ||
| int a; | ||
| S4(); | ||
| S4 &operator=(const S4 &s4); | ||
|
|
||
| public: | ||
| S4(int v) : a(v) {} | ||
| }; | ||
| class S5 { // expected-note {{'S5' declared here}} | ||
| int a; | ||
| S5() : a(0) {} | ||
| S5 &operator=(const S5 &s5) { return *this; } | ||
|
|
||
| public: | ||
| S5(int v) : a(v) {} | ||
| }; | ||
| template <class T> | ||
| class ST { | ||
| public: | ||
| static T s; | ||
| }; | ||
|
|
||
| S2 k; | ||
| S3 h; | ||
| S4 l(3); // expected-note {{'l' defined here}} | ||
| S5 m(4); // expected-note {{'m' defined here}} | ||
| #pragma omp threadprivate(h, k, l, m) | ||
|
|
||
| int main(int argc, char **argv) { | ||
| int i; | ||
| #pragma omp parallel for copyin // expected-error {{expected '(' after 'copyin'}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for copyin() // expected-error {{expected expression}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for copyin(l) // expected-error {{copyin variable must have an accessible, unambiguous copy assignment operator}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for copyin(S1) // expected-error {{'S1' does not refer to a value}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for copyin(argv[1]) // expected-error {{expected variable name}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for copyin(i) // expected-error {{copyin variable must be threadprivate}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for copyin(m) // expected-error {{copyin variable must have an accessible, unambiguous copy assignment operator}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for copyin(ST < int > ::s) // expected-error {{copyin variable must be threadprivate}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
|
|
||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 -o - %s | ||
|
|
||
| void foo(); | ||
|
|
||
| int main(int argc, char **argv) { | ||
| int i; | ||
| #pragma omp parallel for default // expected-error {{expected '(' after 'default'}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} | ||
| foo(); | ||
| #pragma omp parallel for default(shared), default(shared) // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'default' clause}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
|
|
||
| #pragma omp parallel for default(none) | ||
| for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} | ||
| foo(); | ||
|
|
||
| #pragma omp parallel default(none) | ||
| #pragma omp parallel for default(shared) | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
|
|
||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,252 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s | ||
|
|
||
| void foo() { | ||
| } | ||
|
|
||
| bool foobool(int argc) { | ||
| return argc; | ||
| } | ||
|
|
||
| struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}} | ||
| extern S1 a; | ||
| class S2 { | ||
| mutable int a; | ||
|
|
||
| public: | ||
| S2() : a(0) {} | ||
| S2(S2 &s2) : a(s2.a) {} | ||
| static float S2s; | ||
| static const float S2sc; | ||
| }; | ||
| const float S2::S2sc = 0; | ||
| const S2 b; | ||
| const S2 ba[5]; | ||
| class S3 { | ||
| int a; | ||
| S3 &operator=(const S3 &s3); | ||
|
|
||
| public: | ||
| S3() : a(0) {} | ||
| S3(S3 &s3) : a(s3.a) {} | ||
| }; | ||
| const S3 c; | ||
| const S3 ca[5]; | ||
| extern const int f; | ||
| class S4 { // expected-note 2 {{'S4' declared here}} | ||
| int a; | ||
| S4(); | ||
| S4(const S4 &s4); | ||
|
|
||
| public: | ||
| S4(int v) : a(v) {} | ||
| }; | ||
| class S5 { // expected-note 4 {{'S5' declared here}} | ||
| int a; | ||
| S5(const S5 &s5) : a(s5.a) {} | ||
|
|
||
| public: | ||
| S5() : a(0) {} | ||
| S5(int v) : a(v) {} | ||
| }; | ||
| class S6 { | ||
| int a; | ||
| S6() : a(0) {} | ||
|
|
||
| public: | ||
| S6(const S6 &s6) : a(s6.a) {} | ||
| S6(int v) : a(v) {} | ||
| }; | ||
|
|
||
| S3 h; | ||
| #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} | ||
|
|
||
| template <class I, class C> | ||
| int foomain(int argc, char **argv) { | ||
| I e(4); // expected-note {{'e' defined here}} | ||
| C g(5); // expected-note 2 {{'g' defined here}} | ||
| int i; | ||
| int &j = i; // expected-note {{'j' defined here}} | ||
| #pragma omp parallel for firstprivate // expected-error {{expected '(' after 'firstprivate'}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for firstprivate() // expected-error {{expected expression}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for firstprivate(argc) | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for firstprivate(S1) // expected-error {{'S1' does not refer to a value}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for firstprivate(a, b) // expected-error {{firstprivate variable with incomplete type 'S1'}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for firstprivate(argv[1]) // expected-error {{expected variable name}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for linear(i) // expected-error {{unexpected OpenMP clause 'linear' in directive '#pragma omp parallel for'}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel | ||
| { | ||
| int v = 0; | ||
| int i; | ||
| #pragma omp parallel for firstprivate(i) | ||
| for (int k = 0; k < argc; ++k) { | ||
| i = k; | ||
| v += i; | ||
| } | ||
| } | ||
| #pragma omp parallel shared(i) | ||
| #pragma omp parallel private(i) | ||
| #pragma omp parallel for firstprivate(j) // expected-error {{arguments of OpenMP clause 'firstprivate' cannot be of reference type}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for firstprivate(i) | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel private(i) | ||
| #pragma omp parallel for firstprivate(i) // expected-note {{defined as firstprivate}} | ||
| for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel for' directive may not be firstprivate, predetermined as private}} | ||
| foo(); | ||
| #pragma omp parallel reduction(+ : i) | ||
| #pragma omp parallel for firstprivate(i) // expected-note {{defined as firstprivate}} | ||
| for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel for' directive may not be firstprivate, predetermined as private}} | ||
| foo(); | ||
| return 0; | ||
| } | ||
|
|
||
| int main(int argc, char **argv) { | ||
| const int d = 5; | ||
| const int da[5] = {0}; | ||
| S4 e(4); // expected-note {{'e' defined here}} | ||
| S5 g(5); // expected-note 2 {{'g' defined here}} | ||
| S3 m; | ||
| S6 n(2); | ||
| int i; | ||
| int &j = i; // expected-note {{'j' defined here}} | ||
| #pragma omp parallel for firstprivate // expected-error {{expected '(' after 'firstprivate'}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate() // expected-error {{expected expression}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(argc) | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(S1) // expected-error {{'S1' does not refer to a value}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(argv[1]) // expected-error {{expected variable name}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(2 * 2) // expected-error {{expected variable name}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(ba) // OK | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(ca) // OK | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(da) // OK | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| int xa; | ||
| #pragma omp parallel for firstprivate(xa) // OK | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(S2::S2s) // OK | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(S2::S2sc) // OK | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for safelen(5) // expected-error {{unexpected OpenMP clause 'safelen' in directive '#pragma omp parallel for'}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(m) // OK | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(i) // expected-note {{defined as firstprivate}} | ||
| for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel for' directive may not be firstprivate, predetermined as private}} | ||
| foo(); | ||
| #pragma omp parallel shared(xa) | ||
| #pragma omp parallel for firstprivate(xa) // OK: may be firstprivate | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(j) // expected-error {{arguments of OpenMP clause 'firstprivate' cannot be of reference type}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(n) firstprivate(n) // OK | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel | ||
| { | ||
| int v = 0; | ||
| int i; | ||
| #pragma omp parallel for firstprivate(i) | ||
| for (int k = 0; k < argc; ++k) { | ||
| i = k; | ||
| v += i; | ||
| } | ||
| } | ||
| #pragma omp parallel private(i) | ||
| #pragma omp parallel for firstprivate(i) // expected-note {{defined as firstprivate}} | ||
| for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel for' directive may not be firstprivate, predetermined as private}} | ||
| foo(); | ||
| #pragma omp parallel reduction(+ : i) | ||
| #pragma omp parallel for firstprivate(i) // expected-note {{defined as firstprivate}} | ||
| for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel for' directive may not be firstprivate, predetermined as private}} | ||
| foo(); | ||
|
|
||
| return foomain<S4, S5>(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<S4, S5>' requested here}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s | ||
|
|
||
| void foo() { | ||
| } | ||
|
|
||
| bool foobool(int argc) { | ||
| return argc; | ||
| } | ||
|
|
||
| struct S1; // expected-note {{declared here}} | ||
|
|
||
| template <class T, class S> // expected-note {{declared here}} | ||
| int tmain(T argc, S **argv) { | ||
| T i; | ||
| #pragma omp parallel for if // expected-error {{expected '(' after 'if'}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if () // expected-error {{expected expression}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (argc > 0 ? argv[1] : argv[2]) | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'if' clause}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (S) // expected-error {{'S' does not refer to a value}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if(argc) | ||
| for (i = 0; i < argc; ++i) foo(); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| int main(int argc, char **argv) { | ||
| int i; | ||
| #pragma omp parallel for if // expected-error {{expected '(' after 'if'}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if () // expected-error {{expected expression}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (argc > 0 ? argv[1] : argv[2]) | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'if' clause}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (S1) // expected-error {{'S1' does not refer to a value}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
|
|
||
| return tmain(argc, argv); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,226 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s | ||
|
|
||
| void foo() { | ||
| } | ||
|
|
||
| bool foobool(int argc) { | ||
| return argc; | ||
| } | ||
|
|
||
| struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}} | ||
| extern S1 a; | ||
| class S2 { | ||
| mutable int a; | ||
|
|
||
| public: | ||
| S2() : a(0) {} | ||
| S2(S2 &s2) : a(s2.a) {} | ||
| static float S2s; // expected-note {{static data member is predetermined as shared}} | ||
| static const float S2sc; | ||
| }; | ||
| const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}} | ||
| const S2 b; | ||
| const S2 ba[5]; | ||
| class S3 { // expected-note 2 {{'S3' declared here}} | ||
| int a; | ||
| S3 &operator=(const S3 &s3); | ||
|
|
||
| public: | ||
| S3() : a(0) {} | ||
| S3(S3 &s3) : a(s3.a) {} | ||
| }; | ||
| const S3 c; // expected-note {{global variable is predetermined as shared}} | ||
| const S3 ca[5]; // expected-note {{global variable is predetermined as shared}} | ||
| extern const int f; // expected-note {{global variable is predetermined as shared}} | ||
| class S4 { // expected-note 3 {{'S4' declared here}} | ||
| int a; | ||
| S4(); | ||
| S4(const S4 &s4); | ||
|
|
||
| public: | ||
| S4(int v) : a(v) {} | ||
| }; | ||
| class S5 { // expected-note {{'S5' declared here}} | ||
| int a; | ||
| S5() : a(0) {} | ||
|
|
||
| public: | ||
| S5(const S5 &s5) : a(s5.a) {} | ||
| S5(int v) : a(v) {} | ||
| }; | ||
| class S6 { | ||
| int a; | ||
| S6() : a(0) {} | ||
|
|
||
| public: | ||
| S6(const S6 &s6) : a(s6.a) {} | ||
| S6(int v) : a(v) {} | ||
| }; | ||
|
|
||
| S3 h; | ||
| #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} | ||
|
|
||
| template <class I, class C> | ||
| int foomain(int argc, char **argv) { | ||
| I e(4); // expected-note {{'e' defined here}} | ||
| I g(5); // expected-note {{'g' defined here}} | ||
| int i; | ||
| int &j = i; // expected-note {{'j' defined here}} | ||
| #pragma omp parallel for lastprivate // expected-error {{expected '(' after 'lastprivate'}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for lastprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for lastprivate() // expected-error {{expected expression}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for lastprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for lastprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for lastprivate(argc) | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for lastprivate(a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for lastprivate(argv[1]) // expected-error {{expected variable name}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for lastprivate(e, g) // expected-error 2 {{lastprivate variable must have an accessible, unambiguous default constructor}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for linear(i) // expected-error {{unexpected OpenMP clause 'linear' in directive '#pragma omp parallel for'}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel | ||
| { | ||
| int v = 0; | ||
| int i; | ||
| #pragma omp parallel for lastprivate(i) | ||
| for (int k = 0; k < argc; ++k) { | ||
| i = k; | ||
| v += i; | ||
| } | ||
| } | ||
| #pragma omp parallel shared(i) | ||
| #pragma omp parallel private(i) | ||
| #pragma omp parallel for lastprivate(j) // expected-error {{arguments of OpenMP clause 'lastprivate' cannot be of reference type}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for lastprivate(i) | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| return 0; | ||
| } | ||
|
|
||
| int main(int argc, char **argv) { | ||
| const int d = 5; // expected-note {{constant variable is predetermined as shared}} | ||
| const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}} | ||
| S4 e(4); // expected-note {{'e' defined here}} | ||
| S5 g(5); // expected-note {{'g' defined here}} | ||
| S3 m; // expected-note 2 {{'m' defined here}} | ||
| S6 n(2); | ||
| int i; | ||
| int &j = i; // expected-note {{'j' defined here}} | ||
| #pragma omp parallel for lastprivate // expected-error {{expected '(' after 'lastprivate'}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate() // expected-error {{expected expression}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(argc) | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 3 {{shared variable cannot be lastprivate}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(argv[1]) // expected-error {{expected variable name}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(2 * 2) // expected-error {{expected variable name}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(ba) | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(ca) // expected-error {{shared variable cannot be lastprivate}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(da) // expected-error {{shared variable cannot be lastprivate}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| int xa; | ||
| #pragma omp parallel for lastprivate(xa) // OK | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(S2::S2sc) // expected-error {{shared variable cannot be lastprivate}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for safelen(5) // expected-error {{unexpected OpenMP clause 'safelen' in directive '#pragma omp parallel for'}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(e, g) // expected-error 2 {{lastprivate variable must have an accessible, unambiguous default constructor}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(m) // expected-error {{lastprivate variable must have an accessible, unambiguous copy assignment operator}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(i) | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel private(xa) | ||
| #pragma omp parallel for lastprivate(xa) | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel reduction(+ : xa) | ||
| #pragma omp parallel for lastprivate(xa) | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(j) // expected-error {{arguments of OpenMP clause 'lastprivate' cannot be of reference type}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for firstprivate(m) lastprivate(m) // expected-error {{lastprivate variable must have an accessible, unambiguous copy assignment operator}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for lastprivate(n) firstprivate(n) // OK | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| return foomain<S4, S5>(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<S4, S5>' requested here}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 -std=c++11 -o - %s | ||
|
|
||
| void foo() { | ||
| } | ||
|
|
||
| #pragma omp parallel for // expected-error {{unexpected OpenMP directive '#pragma omp parallel for'}} | ||
|
|
||
| int main(int argc, char **argv) { | ||
| #pragma omp parallel for { // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for(int i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for ( // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for(int i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for [ // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for(int i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for ] // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for(int i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for ) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for(int i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for } // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for(int i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for | ||
| for(int i = 0; i < argc; ++i) foo(); | ||
| // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| #pragma omp parallel for unknown() | ||
| for(int i = 0; i < argc; ++i) foo(); | ||
| L1: | ||
| for(int i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for | ||
| for(int i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for | ||
| for(int i = 0; i < argc; ++i) | ||
| { | ||
| goto L1; // expected-error {{use of undeclared label 'L1'}} | ||
| argc++; | ||
| } | ||
|
|
||
| for (int i = 0; i < 10; ++i) { | ||
| switch(argc) { | ||
| case (0): | ||
| #pragma omp parallel for | ||
| for(int i = 0; i < argc; ++i) | ||
| { | ||
| foo(); | ||
| break; // expected-error {{'break' statement cannot be used in OpenMP for loop}} | ||
| continue; | ||
| } | ||
| default: | ||
| break; | ||
| } | ||
| } | ||
| #pragma omp parallel for default(none) | ||
| for (int i = 0; i < 10; ++i) | ||
| ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} | ||
|
|
||
| goto L2; // expected-error {{use of undeclared label 'L2'}} | ||
| #pragma omp parallel for | ||
| for(int i = 0; i < argc; ++i) L2:foo(); | ||
| #pragma omp parallel for | ||
| for(int i = 0; i < argc; ++i) | ||
| { | ||
| return 1; // expected-error {{cannot return from OpenMP region}} | ||
| } | ||
|
|
||
| [[]] // expected-error {{an attribute list cannot appear here}} | ||
| #pragma omp parallel for | ||
| for (int n = 0; n < 100; ++n) {} | ||
|
|
||
| return 0; | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,309 @@ | ||
| // RUN: %clang_cc1 -fsyntax-only -fopenmp=libiomp5 -verify %s | ||
|
|
||
| // expected-error@+1 {{unexpected OpenMP directive '#pragma omp parallel for'}} | ||
| #pragma omp parallel for | ||
|
|
||
| // expected-error@+1 {{unexpected OpenMP directive '#pragma omp parallel for'}} | ||
| #pragma omp parallel for foo | ||
|
|
||
| void test_no_clause() { | ||
| int i; | ||
| #pragma omp parallel for | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
|
|
||
| // expected-error@+2 {{statement after '#pragma omp parallel for' must be a for loop}} | ||
| #pragma omp parallel for | ||
| ++i; | ||
| } | ||
|
|
||
| void test_branch_protected_scope() { | ||
| int i = 0; | ||
| L1: | ||
| ++i; | ||
|
|
||
| int x[24]; | ||
|
|
||
| #pragma omp parallel for | ||
| for (i = 0; i < 16; ++i) { | ||
| if (i == 5) | ||
| goto L1; // expected-error {{use of undeclared label 'L1'}} | ||
| else if (i == 6) | ||
| return; // expected-error {{cannot return from OpenMP region}} | ||
| else if (i == 7) | ||
| goto L2; | ||
| else if (i == 8) { | ||
| L2: | ||
| x[i]++; | ||
| } | ||
| } | ||
|
|
||
| if (x[0] == 0) | ||
| goto L2; // expected-error {{use of undeclared label 'L2'}} | ||
| else if (x[1] == 1) | ||
| goto L1; | ||
| } | ||
|
|
||
| void test_invalid_clause() { | ||
| int i; | ||
| // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| #pragma omp parallel for foo bar | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| } | ||
|
|
||
| void test_non_identifiers() { | ||
| int i, x; | ||
|
|
||
| // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| #pragma omp parallel for; | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+2 {{unexpected OpenMP clause 'linear' in directive '#pragma omp parallel for'}} | ||
| // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| #pragma omp parallel for linear(x); | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
|
|
||
| // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| #pragma omp parallel for private(x); | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
|
|
||
| // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| #pragma omp parallel for, private(x); | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| } | ||
|
|
||
| extern int foo(); | ||
|
|
||
| void test_collapse() { | ||
| int i; | ||
| // expected-error@+1 {{expected '('}} | ||
| #pragma omp parallel for collapse | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} | ||
| #pragma omp parallel for collapse( | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel for collapse() | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} | ||
| #pragma omp parallel for collapse(, | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} | ||
| #pragma omp parallel for collapse(, ) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-warning@+2 {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| // expected-error@+1 {{expected '('}} | ||
| #pragma omp parallel for collapse 4) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+2 {{expected ')'}} | ||
| // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} | ||
| #pragma omp parallel for collapse(4 | ||
| for (i = 0; i < 16; ++i) | ||
| ; // expected-error {{expected 4 for loops after '#pragma omp parallel for', but found only 1}} | ||
| // expected-error@+2 {{expected ')'}} | ||
| // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} | ||
| #pragma omp parallel for collapse(4, | ||
| for (i = 0; i < 16; ++i) | ||
| ; // expected-error {{expected 4 for loops after '#pragma omp parallel for', but found only 1}} | ||
| // expected-error@+2 {{expected ')'}} | ||
| // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} | ||
| #pragma omp parallel for collapse(4, ) | ||
| for (i = 0; i < 16; ++i) | ||
| ; // expected-error {{expected 4 for loops after '#pragma omp parallel for', but found only 1}} | ||
| // expected-note@+1 {{as specified in 'collapse' clause}} | ||
| #pragma omp parallel for collapse(4) | ||
| for (i = 0; i < 16; ++i) | ||
| ; // expected-error {{expected 4 for loops after '#pragma omp parallel for', but found only 1}} | ||
| // expected-error@+2 {{expected ')'}} | ||
| // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} | ||
| #pragma omp parallel for collapse(4 4) | ||
| for (i = 0; i < 16; ++i) | ||
| ; // expected-error {{expected 4 for loops after '#pragma omp parallel for', but found only 1}} | ||
| // expected-error@+2 {{expected ')'}} | ||
| // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} | ||
| #pragma omp parallel for collapse(4, , 4) | ||
| for (i = 0; i < 16; ++i) | ||
| ; // expected-error {{expected 4 for loops after '#pragma omp parallel for', but found only 1}} | ||
| #pragma omp parallel for collapse(4) | ||
| for (int i1 = 0; i1 < 16; ++i1) | ||
| for (int i2 = 0; i2 < 16; ++i2) | ||
| for (int i3 = 0; i3 < 16; ++i3) | ||
| for (int i4 = 0; i4 < 16; ++i4) | ||
| foo(); | ||
| // expected-error@+2 {{expected ')'}} | ||
| // expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}} | ||
| #pragma omp parallel for collapse(4, 8) | ||
| for (i = 0; i < 16; ++i) | ||
| ; // expected-error {{expected 4 for loops after '#pragma omp parallel for', but found only 1}} | ||
| // expected-error@+1 {{expression is not an integer constant expression}} | ||
| #pragma omp parallel for collapse(2.5) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{expression is not an integer constant expression}} | ||
| #pragma omp parallel for collapse(foo()) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{argument to 'collapse' clause must be a positive integer value}} | ||
| #pragma omp parallel for collapse(-5) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{argument to 'collapse' clause must be a positive integer value}} | ||
| #pragma omp parallel for collapse(0) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{argument to 'collapse' clause must be a positive integer value}} | ||
| #pragma omp parallel for collapse(5 - 5) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| } | ||
|
|
||
| void test_private() { | ||
| int i; | ||
| // expected-error@+2 {{expected expression}} | ||
| // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} | ||
| #pragma omp parallel for private( | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} | ||
| // expected-error@+1 2 {{expected expression}} | ||
| #pragma omp parallel for private(, | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 2 {{expected expression}} | ||
| #pragma omp parallel for private(, ) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel for private() | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel for private(int) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{expected variable name}} | ||
| #pragma omp parallel for private(0) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
|
|
||
| int x, y, z; | ||
| #pragma omp parallel for private(x) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| #pragma omp parallel for private(x, y) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| #pragma omp parallel for private(x, y, z) | ||
| for (i = 0; i < 16; ++i) { | ||
| x = y * i + z; | ||
| } | ||
| } | ||
|
|
||
| void test_lastprivate() { | ||
| int i; | ||
| // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel for lastprivate( | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
|
|
||
| // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} | ||
| // expected-error@+1 2 {{expected expression}} | ||
| #pragma omp parallel for lastprivate(, | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 2 {{expected expression}} | ||
| #pragma omp parallel for lastprivate(, ) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel for lastprivate() | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel for lastprivate(int) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{expected variable name}} | ||
| #pragma omp parallel for lastprivate(0) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
|
|
||
| int x, y, z; | ||
| #pragma omp parallel for lastprivate(x) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| #pragma omp parallel for lastprivate(x, y) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| #pragma omp parallel for lastprivate(x, y, z) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| } | ||
|
|
||
| void test_firstprivate() { | ||
| int i; | ||
| // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel for firstprivate( | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
|
|
||
| // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} | ||
| // expected-error@+1 2 {{expected expression}} | ||
| #pragma omp parallel for firstprivate(, | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 2 {{expected expression}} | ||
| #pragma omp parallel for firstprivate(, ) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel for firstprivate() | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel for firstprivate(int) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| // expected-error@+1 {{expected variable name}} | ||
| #pragma omp parallel for firstprivate(0) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
|
|
||
| int x, y, z; | ||
| #pragma omp parallel for lastprivate(x) firstprivate(x) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| #pragma omp parallel for lastprivate(x, y) firstprivate(x, y) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| #pragma omp parallel for lastprivate(x, y, z) firstprivate(x, y, z) | ||
| for (i = 0; i < 16; ++i) | ||
| ; | ||
| } | ||
|
|
||
| void test_loop_messages() { | ||
| float a[100], b[100], c[100]; | ||
| // expected-error@+2 {{variable must be of integer or pointer type}} | ||
| #pragma omp parallel for | ||
| for (float fi = 0; fi < 10.0; fi++) { | ||
| c[(int)fi] = a[(int)fi] + b[(int)fi]; | ||
| } | ||
| // expected-error@+2 {{variable must be of integer or pointer type}} | ||
| #pragma omp parallel for | ||
| for (double fi = 0; fi < 10.0; fi++) { | ||
| c[(int)fi] = a[(int)fi] + b[(int)fi]; | ||
| } | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s | ||
|
|
||
| void foo() { | ||
| } | ||
|
|
||
| bool foobool(int argc) { | ||
| return argc; | ||
| } | ||
|
|
||
| struct S1; // expected-note {{declared here}} | ||
|
|
||
| template <class T, typename S, int N> // expected-note {{declared here}} | ||
| T tmain(T argc, S **argv) { | ||
| T i; | ||
| #pragma omp parallel for num_threads // expected-error {{expected '(' after 'num_threads'}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads () // expected-error {{expected expression}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads ((argc > 0) ? argv[1] : argv[2]) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'char *'}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads (foobool(argc)), num_threads (true), num_threads (-5) // expected-error 2 {{directive '#pragma omp parallel for' cannot contain more than one 'num_threads' clause}} expected-error {{argument to 'num_threads' clause must be a positive integer value}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads (S) // expected-error {{'S' does not refer to a value}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error 2 {{expression must have integral or unscoped enumeration type, not 'char *'}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads (argc) | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads (N) // expected-error {{argument to 'num_threads' clause must be a positive integer value}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
|
|
||
| return argc; | ||
| } | ||
|
|
||
| int main(int argc, char **argv) { | ||
| int i; | ||
| #pragma omp parallel for num_threads // expected-error {{expected '(' after 'num_threads'}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads () // expected-error {{expected expression}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads (argc > 0 ? argv[1] : argv[2]) // expected-error {{integral }} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads (foobool(argc)), num_threads (true), num_threads (-5) // expected-error 2 {{directive '#pragma omp parallel for' cannot contain more than one 'num_threads' clause}} expected-error {{argument to 'num_threads' clause must be a positive integer value}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads (S1) // expected-error {{'S1' does not refer to a value}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
| #pragma omp parallel for num_threads (num_threads(tmain<int, char, -1>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} expected-note {{in instantiation of function template specialization 'tmain<int, char, -1>' requested here}} | ||
| for (i = 0; i < argc; ++i) foo(); | ||
|
|
||
| return tmain<int, char, 3>(argc, argv); // expected-note {{in instantiation of function template specialization 'tmain<int, char, 3>' requested here}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s | ||
|
|
||
| void foo() { | ||
| } | ||
|
|
||
| bool foobool(int argc) { | ||
| return argc; | ||
| } | ||
|
|
||
| struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}} | ||
| extern S1 a; | ||
| class S2 { | ||
| mutable int a; | ||
|
|
||
| public: | ||
| S2() : a(0) {} | ||
| }; | ||
| const S2 b; | ||
| const S2 ba[5]; | ||
| class S3 { | ||
| int a; | ||
|
|
||
| public: | ||
| S3() : a(0) {} | ||
| }; | ||
| const S3 ca[5]; | ||
| class S4 { // expected-note {{'S4' declared here}} | ||
| int a; | ||
| S4(); | ||
|
|
||
| public: | ||
| S4(int v) : a(v) {} | ||
| }; | ||
| class S5 { // expected-note {{'S5' declared here}} | ||
| int a; | ||
| S5() : a(0) {} | ||
|
|
||
| public: | ||
| S5(int v) : a(v) {} | ||
| }; | ||
|
|
||
| S3 h; | ||
| #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} | ||
|
|
||
| template <class I, class C> | ||
| int foomain(I argc, C **argv) { | ||
| I e(4); | ||
| I g(5); | ||
| int i; | ||
| int &j = i; // expected-note {{'j' defined here}} | ||
| #pragma omp parallel for private // expected-error {{expected '(' after 'private'}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private() // expected-error {{expected expression}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(argc) | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(S1) // expected-error {{'S1' does not refer to a value}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(a, b) // expected-error {{private variable with incomplete type 'S1'}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(argv[1]) // expected-error {{expected variable name}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(e, g) | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(h) // expected-error {{threadprivate or thread local variable cannot be private}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for nowait // expected-error {{unexpected OpenMP clause 'nowait' in directive '#pragma omp parallel for'}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel | ||
| { | ||
| int v = 0; | ||
| int i; | ||
| #pragma omp parallel for private(i) | ||
| for (int k = 0; k < argc; ++k) { | ||
| i = k; | ||
| v += i; | ||
| } | ||
| } | ||
| #pragma omp parallel shared(i) | ||
| #pragma omp parallel private(i) | ||
| #pragma omp parallel for private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(i) | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| return 0; | ||
| } | ||
|
|
||
| int main(int argc, char **argv) { | ||
| S4 e(4); // expected-note {{'e' defined here}} | ||
| S5 g(5); // expected-note {{'g' defined here}} | ||
| int i; | ||
| int &j = i; // expected-note {{'j' defined here}} | ||
| #pragma omp parallel for private // expected-error {{expected '(' after 'private'}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private() // expected-error {{expected expression}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(argc) | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(S1) // expected-error {{'S1' does not refer to a value}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(a, b) // expected-error {{private variable with incomplete type 'S1'}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(argv[1]) // expected-error {{expected variable name}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(e, g) // expected-error 2 {{private variable must have an accessible, unambiguous default constructor}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(h) // expected-error {{threadprivate or thread local variable cannot be private}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for nowait // expected-error {{unexpected OpenMP clause 'nowait' in directive '#pragma omp parallel for'}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel | ||
| { | ||
| int i; | ||
| #pragma omp parallel for private(i) | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| } | ||
| #pragma omp parallel shared(i) | ||
| #pragma omp parallel private(i) | ||
| #pragma omp parallel for private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type}} | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
| #pragma omp parallel for private(i) | ||
| for (int k = 0; k < argc; ++k) | ||
| ++k; | ||
|
|
||
| return 0; | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 -o - %s | ||
|
|
||
| void foo(); | ||
|
|
||
| int main(int argc, char **argv) { | ||
| int i; | ||
| #pragma omp parallel for proc_bind // expected-error {{expected '(' after 'proc_bind'}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for proc_bind( // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for proc_bind() // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for proc_bind(master // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for proc_bind(close), proc_bind(spread) // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'proc_bind' clause}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| #pragma omp parallel for proc_bind(x) // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}} | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
|
|
||
| #pragma omp parallel for proc_bind(master) | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
|
|
||
| #pragma omp parallel proc_bind(close) | ||
| #pragma omp parallel for proc_bind(spread) | ||
| for (i = 0; i < argc; ++i) | ||
| foo(); | ||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,295 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 -o - %s | ||
|
|
||
| void foo() { | ||
| } | ||
|
|
||
| bool foobool(int argc) { | ||
| return argc; | ||
| } | ||
|
|
||
| struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}} | ||
| extern S1 a; | ||
| class S2 { | ||
| mutable int a; | ||
| S2 &operator+=(const S2 &arg) { return (*this); } | ||
|
|
||
| public: | ||
| S2() : a(0) {} | ||
| S2(S2 &s2) : a(s2.a) {} | ||
| static float S2s; // expected-note 2 {{static data member is predetermined as shared}} | ||
| static const float S2sc; | ||
| }; | ||
| const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}} | ||
| S2 b; // expected-note 2 {{'b' defined here}} | ||
| const S2 ba[5]; // expected-note 2 {{'ba' defined here}} | ||
| class S3 { | ||
| int a; | ||
|
|
||
| public: | ||
| S3() : a(0) {} | ||
| S3(const S3 &s3) : a(s3.a) {} | ||
| S3 operator+=(const S3 &arg1) { return arg1; } | ||
| }; | ||
| int operator+=(const S3 &arg1, const S3 &arg2) { return 5; } | ||
| S3 c; // expected-note 2 {{'c' defined here}} | ||
| const S3 ca[5]; // expected-note 2 {{'ca' defined here}} | ||
| extern const int f; // expected-note 4 {{'f' declared here}} | ||
| class S4 { // expected-note {{'S4' declared here}} | ||
| int a; | ||
| S4(); | ||
| S4(const S4 &s4); | ||
| S4 &operator+=(const S4 &arg) { return (*this); } | ||
|
|
||
| public: | ||
| S4(int v) : a(v) {} | ||
| }; | ||
| S4 &operator&=(S4 &arg1, S4 &arg2) { return arg1; } | ||
| class S5 { | ||
| int a; | ||
| S5() : a(0) {} | ||
| S5(const S5 &s5) : a(s5.a) {} | ||
| S5 &operator+=(const S5 &arg); | ||
|
|
||
| public: | ||
| S5(int v) : a(v) {} | ||
| }; | ||
| class S6 { | ||
| int a; | ||
|
|
||
| public: | ||
| S6() : a(6) {} | ||
| operator int() { return 6; } | ||
| } o; // expected-note 2 {{'o' defined here}} | ||
|
|
||
| S3 h, k; | ||
| #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} | ||
|
|
||
| template <class T> // expected-note {{declared here}} | ||
| T tmain(T argc) { // expected-note 2 {{'argc' defined here}} | ||
| const T d = T(); // expected-note 4 {{'d' defined here}} | ||
| const T da[5] = {T()}; // expected-note 2 {{'da' defined here}} | ||
| T qa[5] = {T()}; | ||
| T i; | ||
| T &j = i; // expected-note 4 {{'j' defined here}} | ||
| S3 &p = k; // expected-note 2 {{'p' defined here}} | ||
| const T &r = da[(int)i]; // expected-note 2 {{'r' defined here}} | ||
| T &q = qa[(int)i]; // expected-note 2 {{'q' defined here}} | ||
| T fl; // expected-note {{'fl' defined here}} | ||
| #pragma omp parallel for reduction // expected-error {{expected '(' after 'reduction'}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{variable of type 'float' is not valid for specified reduction operation}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{variable of type 'float' is not valid for specified reduction operation}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(&& : argc) | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(^ : T) // expected-error {{'T' does not refer to a value}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(+ : a, b, c, d, f) // expected-error {{reduction variable with incomplete type 'S1'}} expected-error 3 {{const-qualified variable cannot be reduction}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(min : a, b, c, d, f) // expected-error {{reduction variable with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 3 {{const-qualified variable cannot be reduction}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(max : qa[1]) // expected-error 2 {{expected variable name}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(+ : ba) // expected-error {{a reduction variable with array type 'const S2 [5]'}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(* : ca) // expected-error {{a reduction variable with array type 'const S3 [5]'}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(- : da) // expected-error {{a reduction variable with array type 'const int [5]'}} expected-error {{a reduction variable with array type 'const float [5]'}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(^ : fl) // expected-error {{variable of type 'float' is not valid for specified reduction operation}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(+ : o) // expected-error {{variable of type 'class S6' is not valid for specified reduction operation}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for private(i), reduction(+ : j), reduction(+ : q) // expected-error 4 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel private(k) | ||
| #pragma omp parallel for reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(+ : p), reduction(+ : p) // expected-error 3 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 3 {{previously referenced here}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(+ : r) // expected-error 2 {{const-qualified variable cannot be reduction}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel shared(i) | ||
| #pragma omp parallel reduction(min : i) | ||
| #pragma omp parallel for reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel private(fl) | ||
| #pragma omp parallel for reduction(+ : fl) | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel reduction(* : fl) | ||
| #pragma omp parallel for reduction(+ : fl) | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
|
|
||
| return T(); | ||
| } | ||
|
|
||
| int main(int argc, char **argv) { | ||
| const int d = 5; // expected-note 2 {{'d' defined here}} | ||
| const int da[5] = {0}; // expected-note {{'da' defined here}} | ||
| int qa[5] = {0}; | ||
| S4 e(4); // expected-note {{'e' defined here}} | ||
| S5 g(5); // expected-note {{'g' defined here}} | ||
| int i; | ||
| int &j = i; // expected-note 2 {{'j' defined here}} | ||
| S3 &p = k; // expected-note 2 {{'p' defined here}} | ||
| const int &r = da[i]; // expected-note {{'r' defined here}} | ||
| int &q = qa[i]; // expected-note {{'q' defined here}} | ||
| float fl; // expected-note {{'fl' defined here}} | ||
| #pragma omp parallel for reduction // expected-error {{expected '(' after 'reduction'}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(foo : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(~ : argc) // expected-error {{expected unqualified-id}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(&& : argc) | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(^ : S1) // expected-error {{'S1' does not refer to a value}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(+ : a, b, c, d, f) // expected-error {{reduction variable with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(min : a, b, c, d, f) // expected-error {{reduction variable with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(max : argv[1]) // expected-error {{expected variable name}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(+ : ba) // expected-error {{a reduction variable with array type 'const S2 [5]'}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(* : ca) // expected-error {{a reduction variable with array type 'const S3 [5]'}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(- : da) // expected-error {{a reduction variable with array type 'const int [5]'}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(^ : fl) // expected-error {{variable of type 'float' is not valid for specified reduction operation}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(& : e, g) // expected-error {{reduction variable must have an accessible, unambiguous default constructor}} expected-error {{variable of type 'S5' is not valid for specified reduction operation}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(+ : o) // expected-error {{variable of type 'class S6' is not valid for specified reduction operation}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for private(i), reduction(+ : j), reduction(+ : q) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel private(k) | ||
| #pragma omp parallel for reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel for reduction(+ : r) // expected-error {{const-qualified variable cannot be reduction}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel shared(i) | ||
| #pragma omp parallel reduction(min : i) | ||
| #pragma omp parallel for reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel private(fl) | ||
| #pragma omp parallel for reduction(+ : fl) | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
| #pragma omp parallel reduction(* : fl) | ||
| #pragma omp parallel for reduction(+ : fl) | ||
| for (int i = 0; i < 10; ++i) | ||
| foo(); | ||
|
|
||
| return tmain(argc) + tmain(fl); // expected-note {{in instantiation of function template specialization 'tmain<int>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<float>' requested here}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s | ||
|
|
||
| void foo() { | ||
| } | ||
|
|
||
| bool foobool(int argc) { | ||
| return argc; | ||
| } | ||
|
|
||
| struct S1; // expected-note {{declared here}} | ||
|
|
||
| template <class T, typename S, int N, int ST> // expected-note {{declared here}} | ||
| T tmain(T argc, S **argv) { | ||
| #pragma omp parallel for schedule // expected-error {{expected '(' after 'schedule'}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for schedule ( // expected-error {{expected 'static', 'dynamic', 'guided', 'auto' or 'runtime' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for schedule () // expected-error {{expected 'static', 'dynamic', 'guided', 'auto' or 'runtime' in OpenMP clause 'schedule'}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for schedule (auto // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for schedule (auto_dynamic // expected-error {{expected 'static', 'dynamic', 'guided', 'auto' or 'runtime' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for schedule (auto, // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for schedule (runtime, 3) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} | ||
| #pragma omp parallel for schedule (guided argc | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| // expected-error@+1 2 {{argument to 'schedule' clause must be a positive integer value}} | ||
| #pragma omp parallel for schedule (static, ST // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for schedule (dynamic, 1)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for schedule (guided, (ST > 0) ? 1 + ST : 2) | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| // expected-error@+2 2 {{directive '#pragma omp parallel for' cannot contain more than one 'schedule' clause}} | ||
| // expected-error@+1 {{argument to 'schedule' clause must be a positive integer value}} | ||
| #pragma omp parallel for schedule (static, foobool(argc)), schedule (dynamic, true), schedule (guided, -5) | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for schedule (static, S) // expected-error {{'S' does not refer to a value}} expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| // expected-error@+1 2 {{expression must have integral or unscoped enumeration type, not 'char *'}} | ||
| #pragma omp parallel for schedule (guided, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for schedule (dynamic, 1) | ||
| for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| #pragma omp parallel for schedule (static, N) // expected-error {{argument to 'schedule' clause must be a positive integer value}} | ||
| for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; | ||
| return argc; | ||
| } | ||
|
|
||
| int main(int argc, char **argv) { | ||
| #pragma omp parallel for schedule // expected-error {{expected '(' after 'schedule'}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| #pragma omp parallel for schedule ( // expected-error {{expected 'static', 'dynamic', 'guided', 'auto' or 'runtime' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| #pragma omp parallel for schedule () // expected-error {{expected 'static', 'dynamic', 'guided', 'auto' or 'runtime' in OpenMP clause 'schedule'}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| #pragma omp parallel for schedule (auto // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| #pragma omp parallel for schedule (auto_dynamic // expected-error {{expected 'static', 'dynamic', 'guided', 'auto' or 'runtime' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| #pragma omp parallel for schedule (auto, // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| #pragma omp parallel for schedule (runtime, 3) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| #pragma omp parallel for schedule (guided, 4 // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| #pragma omp parallel for schedule (static, 2+2)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| #pragma omp parallel for schedule (dynamic, foobool(1) > 0 ? 1 : 2) | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| // expected-error@+2 2 {{directive '#pragma omp parallel for' cannot contain more than one 'schedule' clause}} | ||
| // expected-error@+1 {{argument to 'schedule' clause must be a positive integer value}} | ||
| #pragma omp parallel for schedule (guided, foobool(argc)), schedule (static, true), schedule (dynamic, -5) | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| #pragma omp parallel for schedule (guided, S1) // expected-error {{'S1' does not refer to a value}} expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| // expected-error@+1 {{expression must have integral or unscoped enumeration type, not 'char *'}} | ||
| #pragma omp parallel for schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; | ||
| // expected-error@+3 {{statement after '#pragma omp parallel for' must be a for loop}} | ||
| // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}} | ||
| #pragma omp parallel for schedule(dynamic, schedule(tmain<int, char, -1, -2>(argc, argv) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| foo(); | ||
| // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}} | ||
| return tmain<int, char, 1, 0>(argc, argv); | ||
| } | ||
|
|