| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| // 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> | ||
| struct S { | ||
| operator T() { return T(); } | ||
| static T TS; | ||
| #pragma omp threadprivate(TS) | ||
| }; | ||
|
|
||
| // CHECK: template <class T = int> struct S { | ||
| // CHECK: static int TS; | ||
| // CHECK-NEXT: #pragma omp threadprivate(S<int>::TS) | ||
| // CHECK-NEXT: } | ||
| // CHECK: template <class T = long> struct S { | ||
| // CHECK: static long TS; | ||
| // CHECK-NEXT: #pragma omp threadprivate(S<long>::TS) | ||
| // CHECK-NEXT: } | ||
| // CHECK: template <class T> struct S { | ||
| // CHECK: static T TS; | ||
| // CHECK-NEXT: #pragma omp threadprivate(S::TS) | ||
| // CHECK: }; | ||
|
|
||
| template <typename T, int C> | ||
| T tmain(T argc, T *argv) { | ||
| T b = argc, c, d, e, f, g; | ||
| static T a; | ||
| S<T> s; | ||
| #pragma omp parallel sections | ||
| { | ||
| a = 2; | ||
| } | ||
| #pragma omp parallel sections default(none), private(argc, b) firstprivate(argv) shared(d) if (argc > 0) num_threads(C) copyin(S < T > ::TS) proc_bind(master) reduction(+ : c) reduction(max : e) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (C) num_threads(s) proc_bind(close) reduction(^ : e, f) reduction(&& : g) lastprivate(b, c) | ||
| { | ||
| foo(); | ||
| #pragma omp section | ||
| foo(); | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| // CHECK: template <typename T = int, int C = 5> int tmain(int argc, int *argv) { | ||
| // CHECK-NEXT: int b = argc, c, d, e, f, g; | ||
| // CHECK-NEXT: static int a; | ||
| // CHECK-NEXT: S<int> s; | ||
| // CHECK-NEXT: #pragma omp parallel sections | ||
| // CHECK-NEXT: { | ||
| // CHECK-NEXT: a = 2; | ||
| // CHECK-NEXT: } | ||
| // CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(argc > 0) num_threads(5) copyin(S<int>::TS) proc_bind(master) reduction(+: c) reduction(max: e) | ||
| // CHECK-NEXT: { | ||
| // CHECK-NEXT: foo(); | ||
| // CHECK-NEXT: } | ||
| // CHECK-NEXT: #pragma omp parallel sections if(5) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) | ||
| // CHECK-NEXT: { | ||
| // CHECK-NEXT: foo(); | ||
| // CHECK-NEXT: #pragma omp section | ||
| // CHECK-NEXT: foo(); | ||
| // CHECK-NEXT: } | ||
| // CHECK: template <typename T = long, int C = 1> long tmain(long argc, long *argv) { | ||
| // CHECK-NEXT: long b = argc, c, d, e, f, g; | ||
| // CHECK-NEXT: static long a; | ||
| // CHECK-NEXT: S<long> s; | ||
| // CHECK-NEXT: #pragma omp parallel sections | ||
| // CHECK-NEXT: { | ||
| // CHECK-NEXT: a = 2; | ||
| // CHECK-NEXT: } | ||
| // CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(argc > 0) num_threads(1) copyin(S<long>::TS) proc_bind(master) reduction(+: c) reduction(max: e) | ||
| // CHECK-NEXT: { | ||
| // CHECK-NEXT: foo(); | ||
| // CHECK-NEXT: } | ||
| // CHECK-NEXT: #pragma omp parallel sections if(1) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) | ||
| // CHECK-NEXT: { | ||
| // CHECK-NEXT: foo(); | ||
| // CHECK-NEXT: #pragma omp section | ||
| // CHECK-NEXT: foo(); | ||
| // CHECK-NEXT: } | ||
| // CHECK: template <typename T, int C> T tmain(T argc, T *argv) { | ||
| // CHECK-NEXT: T b = argc, c, d, e, f, g; | ||
| // CHECK-NEXT: static T a; | ||
| // CHECK-NEXT: S<T> s; | ||
| // CHECK-NEXT: #pragma omp parallel sections | ||
| // CHECK-NEXT: { | ||
| // CHECK-NEXT: a = 2; | ||
| // CHECK-NEXT: } | ||
| // CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(argc > 0) num_threads(C) copyin(S<T>::TS) proc_bind(master) reduction(+: c) reduction(max: e) | ||
| // CHECK-NEXT: { | ||
| // CHECK-NEXT: foo(); | ||
| // CHECK-NEXT: } | ||
| // CHECK-NEXT: #pragma omp parallel sections if(C) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) | ||
| // CHECK-NEXT: { | ||
| // CHECK-NEXT: foo(); | ||
| // CHECK-NEXT: #pragma omp section | ||
| // CHECK-NEXT: foo(); | ||
| // CHECK-NEXT: } | ||
|
|
||
| enum Enum {}; | ||
|
|
||
| int main(int argc, char **argv) { | ||
| long x; | ||
| int b = argc, c, d, e, f, g; | ||
| static int a; | ||
| #pragma omp threadprivate(a) | ||
| Enum ee; | ||
| // CHECK: Enum ee; | ||
| #pragma omp parallel sections | ||
| // CHECK-NEXT: #pragma omp parallel sections | ||
| { | ||
| a = 2; | ||
| } | ||
| // CHECK-NEXT: { | ||
| // CHECK-NEXT: a = 2; | ||
| // CHECK-NEXT: } | ||
| #pragma omp parallel sections default(none), private(argc, b) firstprivate(argv) if (argc > 0) num_threads(ee) copyin(a) proc_bind(spread) reduction(| : c, d) reduction(* : e) lastprivate(argv) | ||
| // CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) if(argc > 0) num_threads(ee) copyin(a) proc_bind(spread) reduction(|: c,d) reduction(*: e) lastprivate(argv) | ||
| { | ||
| foo(); | ||
| #pragma omp section | ||
| foo(); | ||
| #pragma omp section | ||
| foo(); | ||
| } | ||
| // CHECK-NEXT: { | ||
| // CHECK-NEXT: foo(); | ||
| // CHECK-NEXT: #pragma omp section | ||
| // CHECK-NEXT: foo(); | ||
| // CHECK-NEXT: #pragma omp section | ||
| // CHECK-NEXT: foo(); | ||
| // CHECK-NEXT: } | ||
| return tmain<int, 5>(b, &b) + tmain<long, 1>(x, &x); | ||
| } | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| // 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 sections copyin // expected-error {{expected '(' after 'copyin'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections copyin() // expected-error {{expected expression}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections copyin(l) // expected-error {{copyin variable must have an accessible, unambiguous copy assignment operator}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections copyin(S1) // expected-error {{'S1' does not refer to a value}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections copyin(argv[1]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections copyin(i) // expected-error {{copyin variable must be threadprivate}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections copyin(m) // expected-error {{copyin variable must have an accessible, unambiguous copy assignment operator}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections copyin(ST < int > ::s) // expected-error {{copyin variable must be threadprivate}} | ||
| { | ||
| foo(); | ||
| } | ||
|
|
||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 -o - %s | ||
|
|
||
| void foo(); | ||
|
|
||
| int main(int argc, char **argv) { | ||
| #pragma omp parallel sections default // expected-error {{expected '(' after 'default'}} | ||
| { | ||
| #pragma omp parallel sections default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| #pragma omp parallel sections default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} | ||
| { | ||
| #pragma omp parallel sections default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| #pragma omp parallel sections default(shared), default(shared) // expected-error {{directive '#pragma omp parallel sections' cannot contain more than one 'default' clause}} | ||
| { | ||
| #pragma omp parallel sections default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} | ||
| { | ||
| foo(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #pragma omp parallel sections default(none) | ||
| { | ||
| ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} | ||
| } | ||
|
|
||
| #pragma omp parallel sections default(none) | ||
| { | ||
| #pragma omp parallel sections default(shared) | ||
| { | ||
| ++argc; | ||
| } | ||
| } | ||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,295 @@ | ||
| // 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 sections firstprivate // expected-error {{expected '(' after 'firstprivate'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate() // expected-error {{expected expression}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(argc) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(S1) // expected-error {{'S1' does not refer to a value}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(a, b) // expected-error {{firstprivate variable with incomplete type 'S1'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(argv[1]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections linear(i) // expected-error {{unexpected OpenMP clause 'linear' in directive '#pragma omp parallel sections'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel | ||
| { | ||
| int v = 0; | ||
| int i; | ||
| #pragma omp parallel sections firstprivate(i) | ||
| { | ||
| foo(); | ||
| } | ||
| v += i; | ||
| } | ||
| #pragma omp parallel shared(i) | ||
| #pragma omp parallel private(i) | ||
| #pragma omp parallel sections firstprivate(j) // expected-error {{arguments of OpenMP clause 'firstprivate' cannot be of reference type}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(i) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel private(i) | ||
| #pragma omp parallel sections firstprivate(i) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel reduction(+ : i) | ||
| #pragma omp parallel sections firstprivate(i) | ||
| { | ||
| 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 sections firstprivate // expected-error {{expected '(' after 'firstprivate'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate() // expected-error {{expected expression}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(argc) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(S1) // expected-error {{'S1' does not refer to a value}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(argv[1]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(2 * 2) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(ba) // OK | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(ca) // OK | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(da) // OK | ||
| { | ||
| foo(); | ||
| } | ||
| int xa; | ||
| #pragma omp parallel sections firstprivate(xa) // OK | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(S2::S2s) // OK | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(S2::S2sc) // OK | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections safelen(5) // expected-error {{unexpected OpenMP clause 'safelen' in directive '#pragma omp parallel sections'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(m) // OK | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel shared(xa) | ||
| #pragma omp parallel sections firstprivate(xa) // OK: may be firstprivate | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(j) // expected-error {{arguments of OpenMP clause 'firstprivate' cannot be of reference type}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(n) firstprivate(n) // OK | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel | ||
| { | ||
| int v = 0; | ||
| int i; | ||
| #pragma omp parallel sections firstprivate(i) | ||
| { | ||
| foo(); | ||
| } | ||
| v += i; | ||
| } | ||
| #pragma omp parallel private(i) | ||
| #pragma omp parallel sections firstprivate(i) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel reduction(+ : i) | ||
| #pragma omp parallel sections firstprivate(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,113 @@ | ||
| // 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) { | ||
| #pragma omp parallel sections if // expected-error {{expected '(' after 'if'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if () // expected-error {{expected expression}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (argc > 0 ? argv[1] : argv[2]) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel sections' cannot contain more than one 'if' clause}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (S) // expected-error {{'S' does not refer to a value}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if(argc) | ||
| { | ||
| foo(); | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| int main(int argc, char **argv) { | ||
| #pragma omp parallel sections if // expected-error {{expected '(' after 'if'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if () // expected-error {{expected expression}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (argc > 0 ? argv[1] : argv[2]) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel sections' cannot contain more than one 'if' clause}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (S1) // expected-error {{'S1' does not refer to a value}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
|
|
||
| return tmain(argc, argv); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,269 @@ | ||
| // 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 sections lastprivate // expected-error {{expected '(' after 'lastprivate'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate() // expected-error {{expected expression}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(argc) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(S1) // expected-error {{'S1' does not refer to a value}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(argv[1]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(e, g) // expected-error 2 {{lastprivate variable must have an accessible, unambiguous default constructor}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections linear(i) // expected-error {{unexpected OpenMP clause 'linear' in directive '#pragma omp parallel sections'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel | ||
| { | ||
| int v = 0; | ||
| int i; | ||
| #pragma omp parallel sections lastprivate(i) | ||
| { | ||
| foo(); | ||
| } | ||
| v += i; | ||
| } | ||
| #pragma omp parallel shared(i) | ||
| #pragma omp parallel private(i) | ||
| #pragma omp parallel sections lastprivate(j) // expected-error {{arguments of OpenMP clause 'lastprivate' cannot be of reference type}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(i) | ||
| { | ||
| foo(); | ||
| } | ||
| 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 sections lastprivate // expected-error {{expected '(' after 'lastprivate'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate() // expected-error {{expected expression}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(argc) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(S1) // expected-error {{'S1' does not refer to a value}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 3 {{shared variable cannot be lastprivate}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(argv[1]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(2 * 2) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(ba) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(ca) // expected-error {{shared variable cannot be lastprivate}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(da) // expected-error {{shared variable cannot be lastprivate}} | ||
| { | ||
| foo(); | ||
| } | ||
| int xa; | ||
| #pragma omp parallel sections lastprivate(xa) // OK | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(S2::S2sc) // expected-error {{shared variable cannot be lastprivate}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections safelen(5) // expected-error {{unexpected OpenMP clause 'safelen' in directive '#pragma omp parallel sections'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(e, g) // expected-error 2 {{lastprivate variable must have an accessible, unambiguous default constructor}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(m) // expected-error {{lastprivate variable must have an accessible, unambiguous copy assignment operator}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(i) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel private(xa) | ||
| #pragma omp parallel sections lastprivate(xa) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel reduction(+ : xa) | ||
| #pragma omp parallel sections lastprivate(xa) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(j) // expected-error {{arguments of OpenMP clause 'lastprivate' cannot be of reference type}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections firstprivate(m) lastprivate(m) // expected-error {{lastprivate variable must have an accessible, unambiguous copy assignment operator}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(n) firstprivate(n) // OK | ||
| { | ||
| 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,86 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 -std=c++11 -o - %s | ||
|
|
||
| void foo() { | ||
| } | ||
|
|
||
| #pragma omp parallel sections // expected-error {{unexpected OpenMP directive '#pragma omp parallel sections'}} | ||
|
|
||
| int main(int argc, char **argv) { | ||
| #pragma omp parallel sections {// expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections( // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections[ // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections] // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections) // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections } // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| #pragma omp parallel sections unknown() | ||
| { | ||
| foo(); | ||
| #pragma omp section | ||
| L1: | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections | ||
| { | ||
| ; | ||
| } | ||
| #pragma omp parallel sections | ||
| { | ||
| goto L1; // expected-error {{use of undeclared label 'L1'}} | ||
| } | ||
|
|
||
| for (int i = 0; i < 10; ++i) { | ||
| switch (argc) { | ||
| case (0): | ||
| #pragma omp parallel sections | ||
| { | ||
| foo(); | ||
| break; // expected-error {{'break' statement not in loop or switch statement}} | ||
| continue; // expected-error {{'continue' statement not in loop statement}} | ||
| } | ||
| default: | ||
| break; | ||
| } | ||
| } | ||
| #pragma omp parallel sections default(none) | ||
| { | ||
| ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} | ||
| } | ||
|
|
||
| goto L2; // expected-error {{use of undeclared label 'L2'}} | ||
| #pragma omp parallel sections | ||
| { | ||
| L2: | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections | ||
| { | ||
| return 1; // expected-error {{cannot return from OpenMP region}} | ||
| } | ||
|
|
||
| [[]] // expected-error {{an attribute list cannot appear here}} | ||
| #pragma omp parallel sections | ||
| { | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,260 @@ | ||
| // RUN: %clang_cc1 -fsyntax-only -fopenmp=libiomp5 -verify %s | ||
|
|
||
| void foo(); | ||
|
|
||
| // expected-error@+1 {{unexpected OpenMP directive '#pragma omp parallel sections'}} | ||
| #pragma omp parallel sections | ||
|
|
||
| // expected-error@+1 {{unexpected OpenMP directive '#pragma omp parallel sections'}} | ||
| #pragma omp parallel sections foo | ||
|
|
||
| void test_no_clause() { | ||
| int i; | ||
| #pragma omp parallel sections | ||
| { | ||
| foo(); | ||
| } | ||
|
|
||
| // expected-error@+2 {{the statement for '#pragma omp parallel sections' must be a compound statement}} | ||
| #pragma omp parallel sections | ||
| ++i; | ||
|
|
||
| #pragma omp parallel sections | ||
| { | ||
| foo(); | ||
| foo(); // expected-error {{statement in 'omp parallel sections' directive must be enclosed into a section region}} | ||
| } | ||
|
|
||
| } | ||
|
|
||
| void test_branch_protected_scope() { | ||
| int i = 0; | ||
| L1: | ||
| ++i; | ||
|
|
||
| int x[24]; | ||
|
|
||
| #pragma omp parallel sections | ||
| { | ||
| 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]++; | ||
| } | ||
| #pragma omp section | ||
| 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 L3; | ||
| else if (i == 8) { | ||
| L3: | ||
| x[i]++; | ||
| } | ||
| } | ||
|
|
||
| if (x[0] == 0) | ||
| goto L2; // expected-error {{use of undeclared label 'L2'}} | ||
| else if (x[1] == 1) | ||
| goto L1; | ||
| goto L3; // expected-error {{use of undeclared label 'L3'}} | ||
| } | ||
|
|
||
| void test_invalid_clause() { | ||
| int i; | ||
| // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| #pragma omp parallel sections foo bar | ||
| { | ||
| foo(); | ||
| // expected-error@+1 {{unexpected OpenMP clause 'nowait' in directive '#pragma omp section'}} | ||
| #pragma omp section nowait | ||
| ; | ||
| } | ||
| } | ||
|
|
||
| void test_non_identifiers() { | ||
| int i, x; | ||
|
|
||
| // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| #pragma omp parallel sections; | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-error@+2 {{unexpected OpenMP clause 'linear' in directive '#pragma omp parallel sections'}} | ||
| // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| #pragma omp parallel sections linear(x); | ||
| { | ||
| foo(); | ||
| } | ||
|
|
||
| // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| #pragma omp parallel sections private(x); | ||
| { | ||
| foo(); | ||
| } | ||
|
|
||
| // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| #pragma omp parallel sections, private(x); | ||
| { | ||
| foo(); | ||
| } | ||
| } | ||
|
|
||
| void test_private() { | ||
| int i; | ||
| // expected-error@+2 {{expected expression}} | ||
| // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} | ||
| #pragma omp parallel sections private( | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} | ||
| // expected-error@+1 2 {{expected expression}} | ||
| #pragma omp parallel sections private(, | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-error@+1 2 {{expected expression}} | ||
| #pragma omp parallel sections private(, ) | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel sections private() | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel sections private(int) | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-error@+1 {{expected variable name}} | ||
| #pragma omp parallel sections private(0) | ||
| { | ||
| foo(); | ||
| } | ||
|
|
||
| int x, y, z; | ||
| #pragma omp parallel sections private(x) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(x, y) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(x, y, z) | ||
| { | ||
| foo(); | ||
| } | ||
| } | ||
|
|
||
| void test_lastprivate() { | ||
| int i; | ||
| // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel sections lastprivate( | ||
| { | ||
| foo(); | ||
| } | ||
|
|
||
| // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} | ||
| // expected-error@+1 2 {{expected expression}} | ||
| #pragma omp parallel sections lastprivate(, | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-error@+1 2 {{expected expression}} | ||
| #pragma omp parallel sections lastprivate(, ) | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel sections lastprivate() | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel sections lastprivate(int) | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-error@+1 {{expected variable name}} | ||
| #pragma omp parallel sections lastprivate(0) | ||
| { | ||
| foo(); | ||
| } | ||
|
|
||
| int x, y, z; | ||
| #pragma omp parallel sections lastprivate(x) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(x, y) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(x, y, z) | ||
| { | ||
| foo(); | ||
| } | ||
| } | ||
|
|
||
| void test_firstprivate() { | ||
| int i; | ||
| // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel sections firstprivate( | ||
| { | ||
| foo(); | ||
| } | ||
|
|
||
| // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}} | ||
| // expected-error@+1 2 {{expected expression}} | ||
| #pragma omp parallel sections firstprivate(, | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-error@+1 2 {{expected expression}} | ||
| #pragma omp parallel sections firstprivate(, ) | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel sections firstprivate() | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-error@+1 {{expected expression}} | ||
| #pragma omp parallel sections firstprivate(int) | ||
| { | ||
| foo(); | ||
| } | ||
| // expected-error@+1 {{expected variable name}} | ||
| #pragma omp parallel sections firstprivate(0) | ||
| { | ||
| foo(); | ||
| } | ||
|
|
||
| int x, y, z; | ||
| #pragma omp parallel sections lastprivate(x) firstprivate(x) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(x, y) firstprivate(x, y) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections lastprivate(x, y, z) firstprivate(x, y, z) | ||
| { | ||
| foo(); | ||
| } | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| // 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) { | ||
| #pragma omp parallel sections num_threads // expected-error {{expected '(' after 'num_threads'}} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads () // expected-error {{expected expression}} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads ((argc > 0) ? argv[1] : argv[2]) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'char *'}} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads (foobool(argc)), num_threads (true), num_threads (-5) // expected-error 2 {{directive '#pragma omp parallel sections' cannot contain more than one 'num_threads' clause}} expected-error {{argument to 'num_threads' clause must be a positive integer value}} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads (S) // expected-error {{'S' does not refer to a value}} | ||
| {foo();} | ||
| #pragma omp parallel sections 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 *'}} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads (argc) | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads (N) // expected-error {{argument to 'num_threads' clause must be a positive integer value}} | ||
| {foo();} | ||
|
|
||
| return argc; | ||
| } | ||
|
|
||
| int main(int argc, char **argv) { | ||
| #pragma omp parallel sections num_threads // expected-error {{expected '(' after 'num_threads'}} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads () // expected-error {{expected expression}} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads (argc > 0 ? argv[1] : argv[2]) // expected-error {{integral }} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads (foobool(argc)), num_threads (true), num_threads (-5) // expected-error 2 {{directive '#pragma omp parallel sections' cannot contain more than one 'num_threads' clause}} expected-error {{argument to 'num_threads' clause must be a positive integer value}} | ||
| {foo();} | ||
| #pragma omp parallel sections num_threads (S1) // expected-error {{'S1' does not refer to a value}} | ||
| {foo();} | ||
| #pragma omp parallel sections 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 *'}} | ||
| {foo();} | ||
| #pragma omp parallel sections 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}} | ||
| {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,204 @@ | ||
| // 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 sections private // expected-error {{expected '(' after 'private'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private() // expected-error {{expected expression}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(argc) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(S1) // expected-error {{'S1' does not refer to a value}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(a, b) // expected-error {{private variable with incomplete type 'S1'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(argv[1]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(e, g) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(h) // expected-error {{threadprivate or thread local variable cannot be private}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections copyprivate(i) // expected-error {{unexpected OpenMP clause 'copyprivate' in directive '#pragma omp parallel sections'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel | ||
| { | ||
| int v = 0; | ||
| int i; | ||
| #pragma omp parallel sections private(i) | ||
| { | ||
| foo(); | ||
| } | ||
| v += i; | ||
| } | ||
| #pragma omp parallel shared(i) | ||
| #pragma omp parallel private(i) | ||
| #pragma omp parallel sections private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(i) | ||
| { | ||
| foo(); | ||
| } | ||
| 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 sections private // expected-error {{expected '(' after 'private'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private() // expected-error {{expected expression}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(argc) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(S1) // expected-error {{'S1' does not refer to a value}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(a, b) // expected-error {{private variable with incomplete type 'S1'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(argv[1]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(e, g) // expected-error 2 {{private variable must have an accessible, unambiguous default constructor}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(h) // expected-error {{threadprivate or thread local variable cannot be private}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections copyprivate(i) // expected-error {{unexpected OpenMP clause 'copyprivate' in directive '#pragma omp parallel sections'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel | ||
| { | ||
| int i; | ||
| #pragma omp parallel sections private(i) | ||
| { | ||
| foo(); | ||
| } | ||
| } | ||
| #pragma omp parallel shared(i) | ||
| #pragma omp parallel private(i) | ||
| #pragma omp parallel sections private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(i) | ||
| { | ||
| foo(); | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 -o - %s | ||
|
|
||
| void foo(); | ||
|
|
||
| int main(int argc, char **argv) { | ||
| #pragma omp parallel sections proc_bind // expected-error {{expected '(' after 'proc_bind'}} | ||
| { foo(); } | ||
| #pragma omp parallel sections proc_bind( // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { foo(); } | ||
| #pragma omp parallel sections proc_bind() // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}} | ||
| { foo(); } | ||
| #pragma omp parallel sections proc_bind(master // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { foo(); } | ||
| #pragma omp parallel sections proc_bind(close), proc_bind(spread) // expected-error {{directive '#pragma omp parallel sections' cannot contain more than one 'proc_bind' clause}} | ||
| { foo(); } | ||
| #pragma omp parallel sections proc_bind(x) // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}} | ||
| { foo(); } | ||
|
|
||
| #pragma omp parallel sections proc_bind(master) | ||
| { ++argc; } | ||
|
|
||
| #pragma omp parallel sections proc_bind(close) | ||
| { | ||
| #pragma omp parallel sections proc_bind(spread) | ||
| { ++argc; } | ||
| } | ||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,358 @@ | ||
| // 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 sections reduction // expected-error {{expected '(' after 'reduction'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{variable of type 'float' is not valid for specified reduction operation}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections 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}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(&& : argc) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(^ : T) // expected-error {{'T' does not refer to a value}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(+ : a, b, c, d, f) // expected-error {{reduction variable with incomplete type 'S1'}} expected-error 3 {{const-qualified variable cannot be reduction}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections 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}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(max : qa[1]) // expected-error 2 {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(+ : ba) // expected-error {{a reduction variable with array type 'const S2 [5]'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(* : ca) // expected-error {{a reduction variable with array type 'const S3 [5]'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(- : da) // expected-error {{a reduction variable with array type 'const int [5]'}} expected-error {{a reduction variable with array type 'const float [5]'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(^ : fl) // expected-error {{variable of type 'float' is not valid for specified reduction operation}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(+ : o) // expected-error {{variable of type 'class S6' is not valid for specified reduction operation}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(i), reduction(+ : j), reduction(+ : q) // expected-error 4 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel private(k) | ||
| #pragma omp parallel sections reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(+ : p), reduction(+ : p) // expected-error 3 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 3 {{previously referenced here}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(+ : r) // expected-error 2 {{const-qualified variable cannot be reduction}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel shared(i) | ||
| #pragma omp parallel reduction(min : i) | ||
| #pragma omp parallel sections reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel private(fl) | ||
| #pragma omp parallel sections reduction(+ : fl) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel reduction(* : fl) | ||
| #pragma omp parallel sections reduction(+ : fl) | ||
| { | ||
| 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 sections reduction // expected-error {{expected '(' after 'reduction'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(foo : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(~ : argc) // expected-error {{expected unqualified-id}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(&& : argc) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(^ : S1) // expected-error {{'S1' does not refer to a value}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(+ : a, b, c, d, f) // expected-error {{reduction variable with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections 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}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(max : argv[1]) // expected-error {{expected variable name}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(+ : ba) // expected-error {{a reduction variable with array type 'const S2 [5]'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(* : ca) // expected-error {{a reduction variable with array type 'const S3 [5]'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(- : da) // expected-error {{a reduction variable with array type 'const int [5]'}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(^ : fl) // expected-error {{variable of type 'float' is not valid for specified reduction operation}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections 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}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(+ : o) // expected-error {{variable of type 'class S6' is not valid for specified reduction operation}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections private(i), reduction(+ : j), reduction(+ : q) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel private(k) | ||
| #pragma omp parallel sections reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel sections reduction(+ : r) // expected-error {{const-qualified variable cannot be reduction}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel shared(i) | ||
| #pragma omp parallel reduction(min : i) | ||
| #pragma omp parallel sections reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel private(fl) | ||
| #pragma omp parallel sections reduction(+ : fl) | ||
| { | ||
| foo(); | ||
| } | ||
| #pragma omp parallel reduction(* : fl) | ||
| #pragma omp parallel sections reduction(+ : fl) | ||
| { | ||
| 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,110 @@ | ||
| // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s | ||
|
|
||
| void foo() { | ||
| } | ||
|
|
||
| bool foobool(int argc) { | ||
| return argc; | ||
| } | ||
|
|
||
| struct S1; // expected-note {{declared here}} | ||
| extern S1 a; | ||
| class S2 { | ||
| mutable int a; | ||
|
|
||
| public: | ||
| S2() : a(0) {} | ||
| S2(S2 &s2) : a(s2.a) {} | ||
| }; | ||
| const S2 b; | ||
| const S2 ba[5]; | ||
| class S3 { | ||
| int a; | ||
|
|
||
| public: | ||
| S3() : a(0) {} | ||
| S3(S3 &s3) : a(s3.a) {} | ||
| }; | ||
| const S3 c; | ||
| const S3 ca[5]; | ||
| extern const int f; | ||
| class S4 { | ||
| int a; | ||
| S4(); | ||
| S4(const S4 &s4); | ||
|
|
||
| public: | ||
| S4(int v) : a(v) {} | ||
| }; | ||
| class S5 { | ||
| int a; | ||
| S5() : a(0) {} | ||
| S5(const S5 &s5) : a(s5.a) {} | ||
|
|
||
| public: | ||
| S5(int v) : a(v) {} | ||
| }; | ||
|
|
||
| S3 h; | ||
| #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}} | ||
|
|
||
| int main(int argc, char **argv) { | ||
| const int d = 5; | ||
| const int da[5] = {0}; | ||
| S4 e(4); | ||
| S5 g(5); | ||
| int i; | ||
| int &j = i; | ||
| #pragma omp parallel sections shared // expected-error {{expected '(' after 'shared'}} | ||
| { foo(); } | ||
| #pragma omp parallel sections shared( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { foo(); } | ||
| #pragma omp parallel sections shared() // expected-error {{expected expression}} | ||
| { foo(); } | ||
| #pragma omp parallel sections shared(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { foo(); } | ||
| #pragma omp parallel sections shared(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
| { foo(); } | ||
| #pragma omp parallel sections shared(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} | ||
| { foo(); } | ||
| #pragma omp parallel sections shared(argc) | ||
| { foo(); } | ||
| #pragma omp parallel sections shared(S1) // expected-error {{'S1' does not refer to a value}} | ||
| { foo(); } | ||
| #pragma omp parallel sections shared(a, b, c, d, f) | ||
| { foo(); } | ||
| #pragma omp parallel sections shared(argv[1]) // expected-error {{expected variable name}} | ||
| { foo(); } | ||
| #pragma omp parallel sections shared(ba) | ||
| { foo(); } | ||
| #pragma omp parallel sections shared(ca) | ||
| { foo(); } | ||
| #pragma omp parallel sections shared(da) | ||
| { foo(); } | ||
| #pragma omp parallel sections shared(e, g) | ||
| { foo(); } | ||
| #pragma omp parallel sections shared(h) // expected-error {{threadprivate or thread local variable cannot be shared}} | ||
| { foo(); } | ||
| #pragma omp parallel sections private(i), shared(i) // expected-error {{private variable cannot be shared}} expected-note {{defined as private}} | ||
| { foo(); } | ||
| #pragma omp parallel sections firstprivate(i), shared(i) // expected-error {{firstprivate variable cannot be shared}} expected-note {{defined as firstprivate}} | ||
| { foo(); } | ||
| #pragma omp parallel sections private(i) | ||
| { | ||
| #pragma omp parallel sections shared(i) | ||
| { | ||
| #pragma omp parallel sections shared(j) | ||
| { foo(); } | ||
| } | ||
| } | ||
| #pragma omp parallel sections firstprivate(i) | ||
| { | ||
| #pragma omp parallel sections shared(i) | ||
| { | ||
| #pragma omp parallel sections shared(j) | ||
| { foo(); } | ||
| } | ||
| } | ||
|
|
||
| return 0; | ||
| } |