diff options
| author | Kelvin Li <kkwli0@gmail.com> | 2015-11-24 20:50:12 +0000 |
|---|---|---|
| committer | Kelvin Li <kkwli0@gmail.com> | 2015-11-24 20:50:12 +0000 |
| commit | 099bb8c65dd7709647676487946455fb03794ff0 (patch) | |
| tree | 43630576434806fa4236e02f25e1e970c7f4cdab /clang/test/OpenMP/teams_num_teams_messages.cpp | |
| parent | 2fc2515519dab70fc38b24971c5a18c167278770 (diff) | |
| download | bcm5719-llvm-099bb8c65dd7709647676487946455fb03794ff0.tar.gz bcm5719-llvm-099bb8c65dd7709647676487946455fb03794ff0.zip | |
[OpenMP] Parsing and sema support for num_teams clause
http://reviews.llvm.org/D14802
llvm-svn: 254019
Diffstat (limited to 'clang/test/OpenMP/teams_num_teams_messages.cpp')
| -rw-r--r-- | clang/test/OpenMP/teams_num_teams_messages.cpp | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/clang/test/OpenMP/teams_num_teams_messages.cpp b/clang/test/OpenMP/teams_num_teams_messages.cpp new file mode 100644 index 00000000000..01ad54795fe --- /dev/null +++ b/clang/test/OpenMP/teams_num_teams_messages.cpp @@ -0,0 +1,111 @@ +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ferror-limit 100 -o - %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note 2 {{declared here}} + +template <typename T, int C> // expected-note {{declared here}} +T tmain(T argc) { + char **a; +#pragma omp target +#pragma omp teams num_teams(C) + foo(); +#pragma omp target +#pragma omp teams num_teams(T) // expected-error {{'T' does not refer to a value}} + foo(); +#pragma omp target +#pragma omp teams num_teams // expected-error {{expected '(' after 'num_teams'}} + foo(); +#pragma omp target +#pragma omp teams num_teams( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + foo(); +#pragma omp target +#pragma omp teams num_teams() // expected-error {{expected expression}} + foo(); +#pragma omp target +#pragma omp teams num_teams(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} + foo(); +#pragma omp target +#pragma omp teams num_teams(argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams' are ignored}} + foo(); +#pragma omp target +#pragma omp teams num_teams(argc > 0 ? a[1] : a[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} + foo(); +#pragma omp target +#pragma omp teams num_teams(argc + argc) + foo(); +#pragma omp target +#pragma omp teams num_teams(argc), num_teams (argc+1) // expected-error {{directive '#pragma omp teams' cannot contain more than one 'num_teams' clause}} + foo(); +#pragma omp target +#pragma omp teams num_teams(S1) // expected-error {{'S1' does not refer to a value}} + foo(); +#pragma omp target +#pragma omp teams num_teams(-2) // expected-error {{argument to 'num_teams' clause must be a positive integer value}} + foo(); +#pragma omp target +#pragma omp teams num_teams(-10u) + foo(); +#pragma omp target +#pragma omp teams num_teams(3.14) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'double'}} + foo(); + + return 0; +} + +int main(int argc, char **argv) { +#pragma omp target +#pragma omp teams num_teams // expected-error {{expected '(' after 'num_teams'}} + foo(); + +#pragma omp target +#pragma omp teams num_teams ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + foo(); + +#pragma omp target +#pragma omp teams num_teams () // expected-error {{expected expression}} + foo(); + +#pragma omp target +#pragma omp teams num_teams (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} + foo(); + +#pragma omp target +#pragma omp teams num_teams (argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams' are ignored}} + foo(); + +#pragma omp target +#pragma omp teams num_teams (argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} + foo(); + +#pragma omp target +#pragma omp teams num_teams (argc + argc) + foo(); + +#pragma omp target +#pragma omp teams num_teams (argc), num_teams (argc+1) // expected-error {{directive '#pragma omp teams' cannot contain more than one 'num_teams' clause}} + foo(); + +#pragma omp target +#pragma omp teams num_teams (S1) // expected-error {{'S1' does not refer to a value}} + foo(); + +#pragma omp target +#pragma omp teams num_teams (-2) // expected-error {{argument to 'num_teams' clause must be a positive integer value}} + foo(); + +#pragma omp target +#pragma omp teams num_teams (-10u) + foo(); + +#pragma omp target +#pragma omp teams num_teams (3.14) // expected-error {{expression must have integral or unscoped enumeration type, not 'double'}} + foo(); + + return tmain<int, 10>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 10>' requested here}} +} |

