diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2019-10-08 17:47:52 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-10-08 17:47:52 +0000 |
| commit | 70d2e5427ed31889456fac933c3e596b4bb5a762 (patch) | |
| tree | dcfe2df9dc95b4378d98eb75885b73c7eb5f4708 /clang/test | |
| parent | 190a17bbd1c24f677ba0fdca6df97d9cd208e131 (diff) | |
| download | bcm5719-llvm-70d2e5427ed31889456fac933c3e596b4bb5a762.tar.gz bcm5719-llvm-70d2e5427ed31889456fac933c3e596b4bb5a762.zip | |
[OPENMP50]Do not allow multiple same context traits in the same context
selector.
According to OpenMP 5.0, 2.3.2 Context Selectors, Restrictions, each
trait-selector-name can only be specified once. Added check for this
restriction.
llvm-svn: 374093
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/OpenMP/declare_variant_ast_print.c | 6 | ||||
| -rw-r--r-- | clang/test/OpenMP/declare_variant_ast_print.cpp | 6 | ||||
| -rw-r--r-- | clang/test/OpenMP/declare_variant_messages.c | 6 | ||||
| -rw-r--r-- | clang/test/OpenMP/declare_variant_messages.cpp | 12 |
4 files changed, 16 insertions, 14 deletions
diff --git a/clang/test/OpenMP/declare_variant_ast_print.c b/clang/test/OpenMP/declare_variant_ast_print.c index 0174c07aebe..7f359e07b70 100644 --- a/clang/test/OpenMP/declare_variant_ast_print.c +++ b/clang/test/OpenMP/declare_variant_ast_print.c @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -verify -fopenmp -x c -std=c99 -ast-print %s -o - | FileCheck %s +// RUN: %clang_cc1 -verify -fopenmp -x c -std=c99 -ast-print %s -o - -Wno-openmp-clauses | FileCheck %s -// RUN: %clang_cc1 -verify -fopenmp-simd -x c -std=c99 -ast-print %s -o - | FileCheck %s +// RUN: %clang_cc1 -verify -fopenmp-simd -x c -std=c99 -ast-print %s -o - -Wno-openmp-clauses | FileCheck %s // expected-no-diagnostics @@ -9,6 +9,7 @@ int foo(void); #pragma omp declare variant(foo) match(xxx={}, yyy={ccc}) #pragma omp declare variant(foo) match(xxx={vvv}) #pragma omp declare variant(foo) match(implementation={vendor(llvm)}) +#pragma omp declare variant(foo) match(implementation={vendor(llvm), xxx}) #pragma omp declare variant(foo) match(implementation={vendor(unknown)}) #pragma omp declare variant(foo) match(implementation={vendor(score(5): ibm, xxx)}) int bar(void); @@ -18,4 +19,5 @@ int bar(void); // CHECK-NEXT: #pragma omp declare variant(foo) match(implementation={vendor(score(5):xxx)}) // CHECK-NEXT: #pragma omp declare variant(foo) match(implementation={vendor(unknown)}) // CHECK-NEXT: #pragma omp declare variant(foo) match(implementation={vendor(llvm)}) +// CHECK-NEXT: #pragma omp declare variant(foo) match(implementation={vendor(llvm)}) // CHECK-NEXT: int bar(); diff --git a/clang/test/OpenMP/declare_variant_ast_print.cpp b/clang/test/OpenMP/declare_variant_ast_print.cpp index 879014b6132..7b3b9ccd7bb 100644 --- a/clang/test/OpenMP/declare_variant_ast_print.cpp +++ b/clang/test/OpenMP/declare_variant_ast_print.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++14 -fexceptions -fcxx-exceptions %s -ast-print -o - -Wno-source-uses-openmp | FileCheck %s +// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++14 -fexceptions -fcxx-exceptions %s -ast-print -o - -Wno-source-uses-openmp -Wno-openmp-clauses | FileCheck %s -// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -std=c++14 -fexceptions -fcxx-exceptions %s -ast-print -o - -Wno-source-uses-openmp | FileCheck %s +// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -std=c++14 -fexceptions -fcxx-exceptions %s -ast-print -o - -Wno-source-uses-openmp -Wno-openmp-clauses | FileCheck %s // expected-no-diagnostics @@ -23,7 +23,7 @@ T foofoo() { return T(); } // CHECK-NEXT: int bar(); #pragma omp declare variant(foofoo <int>) match(xxx = {}) #pragma omp declare variant(foofoo <int>) match(xxx = {vvv}) -#pragma omp declare variant(foofoo <int>) match(implementation={vendor(llvm)}) +#pragma omp declare variant(foofoo <int>) match(implementation={vendor(llvm), xxx}) #pragma omp declare variant(foofoo <int>) match(implementation={vendor(unknown)}) #pragma omp declare variant(foofoo <int>) match(implementation={vendor(score(5): ibm)}) int bar(); diff --git a/clang/test/OpenMP/declare_variant_messages.c b/clang/test/OpenMP/declare_variant_messages.c index c6737f5cb11..21541cbbac3 100644 --- a/clang/test/OpenMP/declare_variant_messages.c +++ b/clang/test/OpenMP/declare_variant_messages.c @@ -21,9 +21,9 @@ int foo(void); #pragma omp declare variant(foo) match(xxx=) // expected-error {{expected '{' after '='}} #pragma omp declare variant(foo) match(xxx=yyy) // expected-error {{expected '{' after '='}} #pragma omp declare variant(foo) match(xxx=yyy}) // expected-error {{expected '{' after '='}} -#pragma omp declare variant(foo) match(xxx={) // expected-error {{expected '}'}} expected-note {{to match this '{'}} +#pragma omp declare variant(foo) match(xxx={) // expected-error {{expected '}' or ',' after ')'}} expected-error {{expected '}'}} expected-note {{to match this '{'}} #pragma omp declare variant(foo) match(xxx={}) -#pragma omp declare variant(foo) match(xxx={vvv}) +#pragma omp declare variant(foo) match(xxx={vvv, vvv}) #pragma omp declare variant(foo) match(xxx={vvv} xxx) // expected-error {{expected ','}} expected-error {{expected '=' after 'xxx' context selector set name on 'omp declare variant' directive}} expected-error {{context selector set 'xxx' is used already in the same 'omp declare variant' directive}} expected-note {{previously context selector set 'xxx' used here}} #pragma omp declare variant(foo) match(xxx={vvv}) xxx // expected-warning {{extra tokens at the end of '#pragma omp declare variant' are ignored}} #pragma omp declare variant(foo) match(implementation={xxx}) // expected-warning {{unknown context selector in 'implementation' context selector set of 'omp declare variant' directive, ignored}} @@ -34,7 +34,7 @@ int foo(void); #pragma omp declare variant(foo) match(implementation={vendor(score( ibm)}) // expected-error {{expected ')' or ',' after 'vendor name'}} expected-error {{expected ')'}} expected-error {{use of undeclared identifier 'ibm'}} expected-error {{expected vendor identifier in 'vendor' context selector of 'implementation' selector set of 'omp declare variant' directive}} expected-warning {{missing ':' after context selector score clause - ignoring}} expected-note {{to match this '('}} #pragma omp declare variant(foo) match(implementation={vendor(score(2 ibm)}) // expected-error {{expected ')' or ',' after 'vendor name'}} expected-error 2 {{expected ')'}} expected-error {{expected vendor identifier in 'vendor' context selector of 'implementation' selector set of 'omp declare variant' directive}} expected-warning {{missing ':' after context selector score clause - ignoring}} expected-note 2 {{to match this '('}} #pragma omp declare variant(foo) match(implementation={vendor(score(foo()) ibm)}) // expected-warning {{missing ':' after context selector score clause - ignoring}} expected-error {{expression is not an integer constant expression}} -#pragma omp declare variant(foo) match(implementation={vendor(score(5): ibm)}) +#pragma omp declare variant(foo) match(implementation={vendor(score(5): ibm), vendor(llvm)}) // expected-error {{context trait selector 'vendor' is used already in the same 'implementation' context selector set of 'omp declare variant' directive}} expected-note {{previously context trait selector 'vendor' used here}} int bar(void); // expected-error@+2 {{'#pragma omp declare variant' can only be applied to functions}} diff --git a/clang/test/OpenMP/declare_variant_messages.cpp b/clang/test/OpenMP/declare_variant_messages.cpp index e986cd6b80c..2265c347385 100644 --- a/clang/test/OpenMP/declare_variant_messages.cpp +++ b/clang/test/OpenMP/declare_variant_messages.cpp @@ -24,9 +24,9 @@ T foofoo(); // expected-note 2 {{declared here}} #pragma omp declare variant(foofoo <int>) match(xxx =) // expected-error {{expected '{' after '='}} #pragma omp declare variant(foofoo <int>) match(xxx = yyy) // expected-error {{expected '{' after '='}} #pragma omp declare variant(foofoo <int>) match(xxx = yyy }) // expected-error {{expected '{' after '='}} -#pragma omp declare variant(foofoo <int>) match(xxx = {) // expected-error {{expected '}'}} expected-note {{to match this '{'}} +#pragma omp declare variant(foofoo <int>) match(xxx = {) // expected-error {{expected '}' or ',' after ')'}} expected-error {{expected '}'}} expected-note {{to match this '{'}} #pragma omp declare variant(foofoo <int>) match(xxx = {}) -#pragma omp declare variant(foofoo <int>) match(xxx = {vvv}) +#pragma omp declare variant(foofoo <int>) match(xxx = {vvv, vvv}) #pragma omp declare variant(foofoo <int>) match(xxx = {vvv} xxx) // expected-error {{expected ','}} expected-error {{expected '=' after 'xxx' context selector set name on 'omp declare variant' directive}} expected-error {{context selector set 'xxx' is used already in the same 'omp declare variant' directive}} expected-note {{previously context selector set 'xxx' used here}} #pragma omp declare variant(foofoo <int>) match(xxx = {vvv}) xxx // expected-warning {{extra tokens at the end of '#pragma omp declare variant' are ignored}} #pragma omp declare variant(foofoo <int>) match(implementation={xxx}) // expected-warning {{unknown context selector in 'implementation' context selector set of 'omp declare variant' directive, ignored}} @@ -37,7 +37,7 @@ T foofoo(); // expected-note 2 {{declared here}} #pragma omp declare variant(foofoo <int>) match(implementation={vendor(score( ibm)}) // expected-error {{expected ')' or ',' after 'vendor name'}} expected-error {{expected ')'}} expected-error {{use of undeclared identifier 'ibm'}} expected-error {{expected vendor identifier in 'vendor' context selector of 'implementation' selector set of 'omp declare variant' directive}} expected-warning {{missing ':' after context selector score clause - ignoring}} expected-note {{to match this '('}} #pragma omp declare variant(foofoo <int>) match(implementation={vendor(score(2 ibm)}) // expected-error {{expected ')' or ',' after 'vendor name'}} expected-error 2 {{expected ')'}} expected-error {{expected vendor identifier in 'vendor' context selector of 'implementation' selector set of 'omp declare variant' directive}} expected-warning {{missing ':' after context selector score clause - ignoring}} expected-note 2 {{to match this '('}} #pragma omp declare variant(foofoo <int>) match(implementation={vendor(score(foofoo <int>()) ibm)}) // expected-warning {{missing ':' after context selector score clause - ignoring}} expected-error {{expression is not an integral constant expression}} expected-note {{non-constexpr function 'foofoo<int>' cannot be used in a constant expression}} -#pragma omp declare variant(foofoo <int>) match(implementation={vendor(score(5): ibm)}) +#pragma omp declare variant(foofoo <int>) match(implementation={vendor(score(5): ibm), vendor(llvm)}) // expected-error {{context trait selector 'vendor' is used already in the same 'implementation' context selector set of 'omp declare variant' directive}} expected-note {{previously context trait selector 'vendor' used here}} int bar(); #pragma omp declare variant // expected-error {{expected '(' after 'declare variant'}} @@ -53,9 +53,9 @@ int bar(); #pragma omp declare variant(foofoo <T>) match() // expected-error {{expected context selector in 'match' clause on 'omp declare variant' directive}} #pragma omp declare variant(foofoo <T>) match(xxx) // expected-error {{expected '=' after 'xxx' context selector set name on 'omp declare variant' directive}} #pragma omp declare variant(foofoo <T>) match(xxx =) // expected-error {{expected '{' after '='}} -#pragma omp declare variant(foofoo <T>) match(xxx = {) // expected-error {{expected '}'}} expected-note {{to match this '{'}} +#pragma omp declare variant(foofoo <T>) match(xxx = {) // expected-error {{expected '}' or ',' after ')'}} expected-error {{expected '}'}} expected-note {{to match this '{'}} #pragma omp declare variant(foofoo <T>) match(xxx = {}) -#pragma omp declare variant(foofoo <T>) match(xxx = {vvv}) +#pragma omp declare variant(foofoo <T>) match(xxx = {vvv, vvv}) #pragma omp declare variant(foofoo <T>) match(user = {score(<expr>) : condition(<expr>)}) #pragma omp declare variant(foofoo <T>) match(user = {score(<expr>) : condition(<expr>)}) #pragma omp declare variant(foofoo <T>) match(user = {condition(<expr>)}) @@ -66,7 +66,7 @@ int bar(); #pragma omp declare variant(foofoo <int>) match(implementation={vendor(score( ibm)}) // expected-error {{expected ')' or ',' after 'vendor name'}} expected-error {{expected ')'}} expected-error {{use of undeclared identifier 'ibm'}} expected-error {{expected vendor identifier in 'vendor' context selector of 'implementation' selector set of 'omp declare variant' directive}} expected-warning {{missing ':' after context selector score clause - ignoring}} expected-note {{to match this '('}} #pragma omp declare variant(foofoo <int>) match(implementation={vendor(score(C ibm)}) // expected-error {{expected ')' or ',' after 'vendor name'}} expected-error 2 {{expected ')'}} expected-error {{expected vendor identifier in 'vendor' context selector of 'implementation' selector set of 'omp declare variant' directive}} expected-warning {{missing ':' after context selector score clause - ignoring}} expected-note 2 {{to match this '('}} #pragma omp declare variant(foofoo <int>) match(implementation={vendor(score(foofoo <int>()) ibm)}) // expected-warning {{missing ':' after context selector score clause - ignoring}} expected-error {{expression is not an integral constant expression}} expected-note {{non-constexpr function 'foofoo<int>' cannot be used in a constant expression}} -#pragma omp declare variant(foofoo <int>) match(implementation={vendor(score(C+5): ibm)}) +#pragma omp declare variant(foofoo <int>) match(implementation={vendor(score(C+5): ibm), vendor(llvm)}) // expected-error {{context trait selector 'vendor' is used already in the same 'implementation' context selector set of 'omp declare variant' directive}} expected-note {{previously context trait selector 'vendor' used here}} template <typename T, int C> T barbar(); |

