736 changes: 736 additions & 0 deletions clang/test/OpenMP/parallel_master_taskloop_simd_loop_messages.cpp

Large diffs are not rendered by default.

384 changes: 384 additions & 0 deletions clang/test/OpenMP/parallel_master_taskloop_simd_misc_messages.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,384 @@
// RUN: %clang_cc1 -fsyntax-only -fopenmp -triple x86_64-unknown-unknown -verify %s -Wuninitialized

// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -triple x86_64-unknown-unknown -verify %s -Wuninitialized

void xxx(int argc) {
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
#pragma omp parallel master taskloop simd
for (int i = 0; i < 10; ++i)
argc = x; // expected-warning {{variable 'x' is uninitialized when used here}}
}

// expected-error@+1 {{unexpected OpenMP directive '#pragma omp parallel master taskloop simd'}}
#pragma omp parallel master taskloop simd

// expected-error@+1 {{unexpected OpenMP directive '#pragma omp parallel master taskloop simd'}}
#pragma omp parallel master taskloop simd foo

void test_no_clause() {
int i;
#pragma omp parallel master taskloop simd
for (i = 0; i < 16; ++i)
;

// expected-error@+2 {{statement after '#pragma omp parallel master taskloop simd' must be a for loop}}
#pragma omp parallel master taskloop simd
++i;
}

void test_branch_protected_scope() {
int i = 0;
L1:
++i;

int x[24];

#pragma omp parallel
#pragma omp parallel master taskloop simd
for (i = 0; i < 16; ++i) {
if (i == 5)
goto L1; // expected-error {{use of undeclared label 'L1'}}
else if (i == 6)
return; // expected-error {{cannot return from OpenMP region}}
else if (i == 7)
goto L2;
else if (i == 8) {
L2:
x[i]++;
}
}

if (x[0] == 0)
goto L2; // expected-error {{use of undeclared label 'L2'}}
else if (x[1] == 1)
goto L1;
}

void test_invalid_clause() {
int i, a;
// expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
#pragma omp parallel master taskloop simd foo bar
for (i = 0; i < 16; ++i)
;
// expected-error@+1 {{directive '#pragma omp parallel master taskloop simd' cannot contain more than one 'nogroup' clause}}
#pragma omp parallel master taskloop simd nogroup nogroup
for (i = 0; i < 16; ++i)
;
// expected-error@+1 {{unexpected OpenMP clause 'in_reduction' in directive '#pragma omp parallel master taskloop simd'}}
#pragma omp parallel master taskloop simd in_reduction(+:a)
for (i = 0; i < 16; ++i)
;
}

void test_non_identifiers() {
int i, x;

#pragma omp parallel
// expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
#pragma omp parallel master taskloop simd;
for (i = 0; i < 16; ++i)
;
// expected-warning@+2 {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
#pragma omp parallel
#pragma omp parallel master taskloop simd linear(x);
for (i = 0; i < 16; ++i)
;

#pragma omp parallel
// expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
#pragma omp parallel master taskloop simd private(x);
for (i = 0; i < 16; ++i)
;

#pragma omp parallel
// expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
#pragma omp parallel master taskloop simd, private(x);
for (i = 0; i < 16; ++i)
;
}

extern int foo();

void test_collapse() {
int i;
#pragma omp parallel
// expected-error@+1 {{expected '('}}
#pragma omp parallel master taskloop simd collapse
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
#pragma omp parallel master taskloop simd collapse(
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{expected expression}}
#pragma omp parallel master taskloop simd collapse()
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
#pragma omp parallel master taskloop simd collapse(,
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
#pragma omp parallel master taskloop simd collapse(, )
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-warning@+2 {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
// expected-error@+1 {{expected '('}}
#pragma omp parallel master taskloop simd collapse 4)
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+2 {{expected ')'}}
// expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
#pragma omp parallel master taskloop simd collapse(4
for (i = 0; i < 16; ++i)
; // expected-error {{expected 4 for loops after '#pragma omp parallel master taskloop simd', but found only 1}}
#pragma omp parallel
// expected-error@+2 {{expected ')'}}
// expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
#pragma omp parallel master taskloop simd collapse(4,
for (i = 0; i < 16; ++i)
; // expected-error {{expected 4 for loops after '#pragma omp parallel master taskloop simd', but found only 1}}
#pragma omp parallel
// expected-error@+2 {{expected ')'}}
// expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
#pragma omp parallel master taskloop simd collapse(4, )
for (i = 0; i < 16; ++i)
; // expected-error {{expected 4 for loops after '#pragma omp parallel master taskloop simd', but found only 1}}
#pragma omp parallel
// expected-note@+1 {{as specified in 'collapse' clause}}
#pragma omp parallel master taskloop simd collapse(4)
for (i = 0; i < 16; ++i)
; // expected-error {{expected 4 for loops after '#pragma omp parallel master taskloop simd', but found only 1}}
#pragma omp parallel
// expected-error@+2 {{expected ')'}}
// expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
#pragma omp parallel master taskloop simd collapse(4 4)
for (i = 0; i < 16; ++i)
; // expected-error {{expected 4 for loops after '#pragma omp parallel master taskloop simd', but found only 1}}
#pragma omp parallel
// expected-error@+2 {{expected ')'}}
// expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
#pragma omp parallel master taskloop simd collapse(4, , 4)
for (i = 0; i < 16; ++i)
; // expected-error {{expected 4 for loops after '#pragma omp parallel master taskloop simd', but found only 1}}
#pragma omp parallel
#pragma omp parallel master taskloop simd collapse(4)
for (int i1 = 0; i1 < 16; ++i1)
for (int i2 = 0; i2 < 16; ++i2)
for (int i3 = 0; i3 < 16; ++i3)
for (int i4 = 0; i4 < 16; ++i4)
foo();
#pragma omp parallel
// expected-error@+2 {{expected ')'}}
// expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
#pragma omp parallel master taskloop simd collapse(4, 8)
for (i = 0; i < 16; ++i)
; // expected-error {{expected 4 for loops after '#pragma omp parallel master taskloop simd', but found only 1}}
#pragma omp parallel
// expected-error@+1 {{expression is not an integer constant expression}}
#pragma omp parallel master taskloop simd collapse(2.5)
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{expression is not an integer constant expression}}
#pragma omp parallel master taskloop simd collapse(foo())
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
#pragma omp parallel master taskloop simd collapse(-5)
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
#pragma omp parallel master taskloop simd collapse(0)
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
#pragma omp parallel master taskloop simd collapse(5 - 5)
for (i = 0; i < 16; ++i)
;
}

void test_private() {
int i;
#pragma omp parallel
// expected-error@+2 {{expected expression}}
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
#pragma omp parallel master taskloop simd private(
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
// expected-error@+1 2 {{expected expression}}
#pragma omp parallel master taskloop simd private(,
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 2 {{expected expression}}
#pragma omp parallel master taskloop simd private(, )
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{expected expression}}
#pragma omp parallel master taskloop simd private()
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{expected expression}}
#pragma omp parallel master taskloop simd private(int)
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{expected variable name}}
#pragma omp parallel master taskloop simd private(0)
for (i = 0; i < 16; ++i)
;

int x, y, z;
#pragma omp parallel
#pragma omp parallel master taskloop simd private(x)
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
#pragma omp parallel master taskloop simd private(x, y)
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
#pragma omp parallel master taskloop simd private(x, y, z)
for (i = 0; i < 16; ++i) {
x = y * i + z;
}
}

void test_lastprivate() {
int i;
#pragma omp parallel
// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
// expected-error@+1 {{expected expression}}
#pragma omp parallel master taskloop simd lastprivate(
for (i = 0; i < 16; ++i)
;

#pragma omp parallel
// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
// expected-error@+1 2 {{expected expression}}
#pragma omp parallel master taskloop simd lastprivate(,
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 2 {{expected expression}}
#pragma omp parallel master taskloop simd lastprivate(, )
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{expected expression}}
#pragma omp parallel master taskloop simd lastprivate()
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{expected expression}}
#pragma omp parallel master taskloop simd lastprivate(int)
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{expected variable name}}
#pragma omp parallel master taskloop simd lastprivate(0)
for (i = 0; i < 16; ++i)
;

int x, y, z;
#pragma omp parallel
#pragma omp parallel master taskloop simd lastprivate(x)
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
#pragma omp parallel master taskloop simd lastprivate(x, y)
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
#pragma omp parallel master taskloop simd lastprivate(x, y, z)
for (i = 0; i < 16; ++i)
;
}

void test_firstprivate() {
int i;
#pragma omp parallel
// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
// expected-error@+1 {{expected expression}}
#pragma omp parallel master taskloop simd firstprivate(
for (i = 0; i < 16; ++i)
;

#pragma omp parallel
// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
// expected-error@+1 2 {{expected expression}}
#pragma omp parallel master taskloop simd firstprivate(,
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 2 {{expected expression}}
#pragma omp parallel master taskloop simd firstprivate(, )
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{expected expression}}
#pragma omp parallel master taskloop simd firstprivate()
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{expected expression}}
#pragma omp parallel master taskloop simd firstprivate(int)
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
// expected-error@+1 {{expected variable name}}
#pragma omp parallel master taskloop simd firstprivate(0)
for (i = 0; i < 16; ++i)
;

int x, y, z;
#pragma omp parallel
#pragma omp parallel master taskloop simd lastprivate(x) firstprivate(x)
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
#pragma omp parallel master taskloop simd lastprivate(x, y) firstprivate(x, y)
for (i = 0; i < 16; ++i)
;
#pragma omp parallel
#pragma omp parallel master taskloop simd lastprivate(x, y, z) firstprivate(x, y, z)
for (i = 0; i < 16; ++i)
;
}

void test_loop_messages() {
float a[100], b[100], c[100];
#pragma omp parallel
// expected-error@+2 {{variable must be of integer or pointer type}}
#pragma omp parallel master taskloop simd
for (float fi = 0; fi < 10.0; fi++) {
c[(int)fi] = a[(int)fi] + b[(int)fi];
}
#pragma omp parallel
// expected-error@+2 {{variable must be of integer or pointer type}}
#pragma omp parallel master taskloop simd
for (double fi = 0; fi < 10.0; fi++) {
c[(int)fi] = a[(int)fi] + b[(int)fi];
}

// expected-warning@+2 {{OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed}}
#pragma omp parallel master taskloop simd
for (__int128 ii = 0; ii < 10; ii++) {
c[ii] = a[ii] + b[ii];
}
}

103 changes: 103 additions & 0 deletions clang/test/OpenMP/parallel_master_taskloop_simd_num_tasks_messages.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized

// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized

void foo() {
}

bool foobool(int argc) {
return argc;
}

struct S1; // expected-note {{declared here}}

template <class T, class S> // expected-note {{declared here}}
int tmain(T argc, S **argv) {
T z;
#pragma omp parallel master taskloop simd num_tasks // expected-error {{expected '(' after 'num_tasks'}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks () // expected-error {{expected expression}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks (argc > 0 ? argv[1][0] : argv[2][argc] + z)
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks (foobool(argc)), num_tasks (true) // expected-error {{directive '#pragma omp parallel master taskloop simd' cannot contain more than one 'num_tasks' clause}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks (S) // expected-error {{'S' does not refer to a value}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks(0) // expected-error {{argument to 'num_tasks' clause must be a strictly positive integer value}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks(-1) // expected-error {{argument to 'num_tasks' clause must be a strictly positive integer value}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks(argc) grainsize(argc) // expected-error {{'grainsize' and 'num_tasks' clause are mutually exclusive and may not appear on the same directive}} expected-note {{'num_tasks' clause is specified here}}
for (int i = 0; i < 10; ++i)
foo();

return 0;
}

int main(int argc, char **argv) {
int z;
#pragma omp parallel master taskloop simd num_tasks // expected-error {{expected '(' after 'num_tasks'}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks () // expected-error {{expected expression}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks (argc > 0 ? argv[1][0] : argv[2][argc] - z)
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks (foobool(argc)), num_tasks (true) // expected-error {{directive '#pragma omp parallel master taskloop simd' cannot contain more than one 'num_tasks' clause}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks (S1) // expected-error {{'S1' does not refer to a value}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks(0) // expected-error {{argument to 'num_tasks' clause must be a strictly positive integer value}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks(-1) // expected-error {{argument to 'num_tasks' clause must be a strictly positive integer value}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd num_tasks(argc) grainsize(argc) // expected-error {{'grainsize' and 'num_tasks' clause are mutually exclusive and may not appear on the same directive}} expected-note {{'num_tasks' clause is specified here}}
for (int i = 0; i < 10; ++i)
foo();

return tmain(argc, argv);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized

// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized

void foo() {
}

bool foobool(int argc) {
return argc;
}

struct S1; // expected-note {{declared here}}

template <class T, class S> // expected-note {{declared here}}
int tmain(T argc, S **argv) {
T z;
#pragma omp parallel master taskloop simd priority // expected-error {{expected '(' after 'priority'}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority () // expected-error {{expected expression}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority (argc > 0 ? argv[1][0] : argv[2][argc] + z)
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority (foobool(argc)), priority (true) // expected-error {{directive '#pragma omp parallel master taskloop simd' cannot contain more than one 'priority' clause}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority (S) // expected-error {{'S' does not refer to a value}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority(0)
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority(-1) // expected-error {{argument to 'priority' clause must be a non-negative integer value}}
for (int i = 0; i < 10; ++i)
foo();

return 0;
}

int main(int argc, char **argv) {
int z;
#pragma omp parallel master taskloop simd priority // expected-error {{expected '(' after 'priority'}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority () // expected-error {{expected expression}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority (argc > 0 ? argv[1][0] : argv[2][argc] - z)
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority (foobool(argc)), priority (true) // expected-error {{directive '#pragma omp parallel master taskloop simd' cannot contain more than one 'priority' clause}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority (S1) // expected-error {{'S1' does not refer to a value}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority(0)
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel master taskloop simd priority(-1) // expected-error {{argument to 'priority' clause must be a non-negative integer value}}
for (int i = 0; i < 10; ++i)
foo();

return tmain(argc, argv);
}
418 changes: 418 additions & 0 deletions clang/test/OpenMP/parallel_master_taskloop_simd_private_codegen.cpp

Large diffs are not rendered by default.

259 changes: 259 additions & 0 deletions clang/test/OpenMP/parallel_master_taskloop_simd_private_messages.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized

// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized

typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_default_mem_alloc;
extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
extern const omp_allocator_handle_t omp_const_mem_alloc;
extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
extern const omp_allocator_handle_t omp_pteam_mem_alloc;
extern const omp_allocator_handle_t omp_thread_mem_alloc;

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 {
int a;
S4(); // expected-note {{implicitly declared private here}}

public:
S4(int v) : a(v) {
#pragma omp parallel master taskloop simd private(a) private(this->a)
for (int k = 0; k < v; ++k)
++this->a;
}
};
class S5 {
int a;
S5() : a(0) {} // expected-note {{implicitly declared private here}}

public:
S5(int v) : a(v) {}
S5 &operator=(S5 &s) {
#pragma omp parallel master taskloop simd private(a) private(this->a) private(s.a) // expected-error {{expected variable name or data member of current class}}
for (int k = 0; k < s.a; ++k)
++s.a;
return *this;
}
};

template <typename T>
class S6 {
public:
T a;

S6() : a(0) {}
S6(T v) : a(v) {
#pragma omp parallel master taskloop simd private(a) private(this->a) allocate(omp_thread_mem_alloc: a) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'parallel master taskloop simd' directive}}
for (int k = 0; k < v; ++k)
++this->a;
}
S6 &operator=(S6 &s) {
#pragma omp parallel master taskloop simd private(a) private(this->a) private(s.a) // expected-error {{expected variable name or data member of current class}}
for (int k = 0; k < s.a; ++k)
++s.a;
return *this;
}
};

template <typename T>
class S7 : public T {
T a;
S7() : a(0) {}

public:
S7(T v) : a(v) {
#pragma omp parallel master taskloop simd private(a) private(this->a) private(T::a)
for (int k = 0; k < a.a; ++k)
++this->a.a;
}
S7 &operator=(S7 &s) {
#pragma omp parallel master taskloop simd private(a) private(this->a) private(s.a) private(s.T::a) // expected-error 2 {{expected variable name or data member of current class}}
for (int k = 0; k < s.a.a; ++k)
++s.a.a;
return *this;
}
};

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, z;
int &j = i;
#pragma omp parallel master taskloop simd private // expected-error {{expected '(' after 'private'}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private() // expected-error {{expected expression}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(argv[1]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(e, g, z)
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd shared(i)
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel
{
int v = 0;
int i;
#pragma omp parallel master taskloop simd private(i)
for (int k = 0; k < argc; ++k) {
i = k;
v += i;
}
}
#pragma omp parallel shared(i)
#pragma omp parallel private(i)
#pragma omp parallel master taskloop simd private(j)
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(i)
for (int k = 0; k < argc; ++k)
++k;
return 0;
}

void bar(S4 a[2]) {
#pragma omp parallel
#pragma omp parallel master taskloop simd private(a)
for (int i = 0; i < 2; ++i)
foo();
}

namespace A {
double x;
#pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
}
namespace B {
using A::x;
}

int main(int argc, char **argv) {
S4 e(4);
S5 g(5);
S6<float> s6(0.0) , s6_0(1.0); // expected-note {{in instantiation of member function 'S6<float>::S6' requested here}}
S7<S6<float> > s7(0.0) , s7_0(1.0);
int i, z;
int &j = i;
#pragma omp parallel master taskloop simd private // expected-error {{expected '(' after 'private'}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private() // expected-error {{expected expression}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(argc)
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(argv[1]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(B::x) // expected-error {{threadprivate or thread local variable cannot be private}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd shared(i)
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel
{
int i;
#pragma omp parallel master taskloop simd private(i)
for (int k = 0; k < argc; ++k)
++k;
}
#pragma omp parallel shared(i)
#pragma omp parallel private(i)
#pragma omp parallel master taskloop simd private(j)
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel master taskloop simd private(i, z)
for (int k = 0; k < argc; ++k)
++k;
static int si;
#pragma omp parallel master taskloop simd private(si) // OK
for(int k = 0; k < argc; ++k)
si = k + 1;

s6 = s6_0; // expected-note {{in instantiation of member function 'S6<float>::operator=' requested here}}
s7 = s7_0; // expected-note {{in instantiation of member function 'S7<S6<float> >::operator=' requested here}}
return foomain(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<int, char>' requested here}}
}

234 changes: 234 additions & 0 deletions clang/test/OpenMP/parallel_master_taskloop_simd_reduction_codegen.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
// RUN: %clang_cc1 -fopenmp -x c++ %s -verify -debug-info-kind=limited -emit-llvm -o - -triple powerpc64le-unknown-linux-gnu -std=c++98 | FileCheck %s

// RUN: %clang_cc1 -fopenmp-simd -x c++ %s -verify -debug-info-kind=limited -emit-llvm -o - -triple powerpc64le-unknown-linux-gnu -std=c++98 | FileCheck --check-prefix SIMD-ONLY0 %s
// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
// expected-no-diagnostics

struct S {
float a;
S() : a(0.0f) {}
~S() {}
};

#pragma omp declare reduction(+:S:omp_out.a += omp_in.a) initializer(omp_priv = omp_orig)

float g;

int a;
#pragma omp threadprivate(a)
int main (int argc, char *argv[])
{
int i, n;
float a[100], b[100], sum, e[argc + 100];
S c[100];
float &d = g;

/* Some initializations */
n = 100;
for (i=0; i < n; i++)
a[i] = b[i] = i * 1.0;
sum = 0.0;

#pragma omp parallel master taskloop simd reduction(+:sum, c[:n], d, e)
for (i=0; i < n; i++) {
sum = sum + (a[i] * b[i]);
c[i].a = i*i;
d += i*i;
e[i] = i;
}

}

// CHECK-LABEL: @main(
// CHECK: [[RETVAL:%.*]] = alloca i32,
// CHECK: [[ARGC_ADDR:%.*]] = alloca i32,
// CHECK: [[ARGV_ADDR:%.*]] = alloca i8**,
// CHECK: [[I:%.*]] = alloca i32,
// CHECK: [[N:%.*]] = alloca i32,
// CHECK: [[A:%.*]] = alloca [100 x float],
// CHECK: [[B:%.*]] = alloca [100 x float],
// CHECK: [[SUM:%.*]] = alloca float,
// CHECK: [[SAVED_STACK:%.*]] = alloca i8*,
// CHECK: [[C:%.*]] = alloca [100 x %struct.S],
// CHECK: [[D:%.*]] = alloca float*,
// CHECK: store i32 0, i32* [[RETVAL]],
// CHECK: store i32 [[ARGC:%.*]], i32* [[ARGC_ADDR]],
// CHECK: store i8** [[ARGV:%.*]], i8*** [[ARGV_ADDR]],
// CHECK: [[TMP1:%.*]] = load i32, i32* [[ARGC_ADDR]],
// CHECK: [[ADD:%.*]] = add nsw i32 [[TMP1]], 100
// CHECK: [[TMP2:%.*]] = zext i32 [[ADD]] to i64
// CHECK: [[VLA:%.+]] = alloca float, i64 %

// CHECK: [[SUM_ADDR:%.*]] = alloca float*,
// CHECK: [[AGG_CAPTURED:%.*]] = alloca [[STRUCT_ANON:%.*]],
// CHECK: [[DOTRD_INPUT_:%.*]] = alloca [4 x %struct.kmp_task_red_input_t],
// CHECK: alloca i32,
// CHECK: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32,
// CHECK: [[DOTCAPTURE_EXPR_9:%.*]] = alloca i32,
// CHECK: [[RES:%.+]] = call {{.*}}i32 @__kmpc_master(
// CHECK-NEXT: [[IS_MASTER:%.+]] = icmp ne i32 [[RES]], 0
// CHECK-NEXT: br i1 [[IS_MASTER]], label {{%?}}[[THEN:.+]], label {{%?}}[[EXIT:[^,]+]]
// CHECK: [[THEN]]
// CHECK: call void @__kmpc_taskgroup(%struct.ident_t*
// CHECK-DAG: [[TMP21:%.*]] = bitcast float* %{{.+}} to i8*
// CHECK-DAG: store i8* [[TMP21]], i8** [[TMP20:%[^,]+]],
// CHECK-DAG: [[TMP20]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T:%.+]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_:%.+]], i32 0, i32 0
// CHECK-DAG: [[TMP22:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 1
// CHECK-DAG: store i64 4, i64* [[TMP22]],
// CHECK-DAG: [[TMP23:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 2
// CHECK-DAG: store i8* bitcast (void (i8*)* @[[RED_INIT1:.+]] to i8*), i8** [[TMP23]],
// CHECK-DAG: [[TMP24:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 3
// CHECK-DAG: store i8* null, i8** [[TMP24]],
// CHECK-DAG: [[TMP25:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 4
// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* @[[RED_COMB1:.+]] to i8*), i8** [[TMP25]],
// CHECK-DAG: [[TMP26:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_]], i32 0, i32 5
// CHECK-DAG: [[TMP27:%.*]] = bitcast i32* [[TMP26]] to i8*
// CHECK-DAG: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP27]], i8 0, i64 4, i1 false)
// CHECK-DAG: [[ARRAYIDX5:%.*]] = getelementptr inbounds [100 x %struct.S], [100 x %struct.S]* [[C:%.+]], i64 0, i64 0
// CHECK-DAG: [[LB_ADD_LEN:%.*]] = add nsw i64 -1, %
// CHECK-DAG: [[ARRAYIDX6:%.*]] = getelementptr inbounds [100 x %struct.S], [100 x %struct.S]* [[C]], i64 0, i64 [[LB_ADD_LEN]]
// CHECK-DAG: [[TMP31:%.*]] = bitcast %struct.S* [[ARRAYIDX5]] to i8*
// CHECK-DAG: store i8* [[TMP31]], i8** [[TMP28:%[^,]+]],
// CHECK-DAG: [[TMP28]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4:%.+]], i32 0, i32 0
// CHECK-DAG: [[TMP32:%.*]] = ptrtoint %struct.S* [[ARRAYIDX6]] to i64
// CHECK-DAG: [[TMP33:%.*]] = ptrtoint %struct.S* [[ARRAYIDX5]] to i64
// CHECK-DAG: [[TMP34:%.*]] = sub i64 [[TMP32]], [[TMP33]]
// CHECK-DAG: [[TMP35:%.*]] = sdiv exact i64 [[TMP34]], ptrtoint (float* getelementptr (float, float* null, i32 1) to i64)
// CHECK-DAG: [[TMP36:%.*]] = add nuw i64 [[TMP35]], 1
// CHECK-DAG: [[TMP37:%.*]] = mul nuw i64 [[TMP36]], ptrtoint (float* getelementptr (float, float* null, i32 1) to i64)
// CHECK-DAG: store i64 [[TMP37]], i64* [[TMP38:%[^,]+]],
// CHECK-DAG: [[TMP38]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 1
// CHECK-DAG: [[TMP39:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 2
// CHECK-DAG: store i8* bitcast (void (i8*)* @[[RED_INIT2:.+]] to i8*), i8** [[TMP39]],
// CHECK-DAG: [[TMP40:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 3
// CHECK-DAG: store i8* bitcast (void (i8*)* @[[RED_FINI2:.+]] to i8*), i8** [[TMP40]],
// CHECK-DAG: [[TMP41:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 4
// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* @[[RED_COMB2:.+]] to i8*), i8** [[TMP41]],
// CHECK-DAG: [[TMP42:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_4]], i32 0, i32 5
// CHECK-DAG: store i32 1, i32* [[TMP42]],
// CHECK-DAG: [[TMP44:%.*]] = load float*, float** [[D:%.+]],
// CHECK-DAG: [[TMP45:%.*]] = bitcast float* [[TMP44]] to i8*
// CHECK-DAG: store i8* [[TMP45]], i8** [[TMP43:%[^,]+]],
// CHECK-DAG: [[TMP43]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7:%.+]], i32 0, i32 0
// CHECK-DAG: [[TMP46:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 1
// CHECK-DAG: store i64 4, i64* [[TMP46]],
// CHECK-DAG: [[TMP47:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 2
// CHECK-DAG: store i8* bitcast (void (i8*)* @[[RED_INIT3:.+]] to i8*), i8** [[TMP47]],
// CHECK-DAG: [[TMP48:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 3
// CHECK-DAG: store i8* null, i8** [[TMP48]],
// CHECK-DAG: [[TMP49:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 4
// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* @[[RED_COMB3:.+]] to i8*), i8** [[TMP49]],
// CHECK-DAG: [[TMP50:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_7]], i32 0, i32 5
// CHECK-DAG: [[TMP51:%.*]] = bitcast i32* [[TMP50]] to i8*
// CHECK-DAG: call void @llvm.memset.p0i8.i64(i8* align 8 [[TMP51]], i8 0, i64 4, i1 false)
// CHECK-DAG: [[TMP53:%.*]] = bitcast float* [[VLA:%.+]] to i8*
// CHECK-DAG: store i8* [[TMP53]], i8** [[TMP52:%[^,]+]],
// CHECK-DAG: [[TMP52]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8:%.+]], i32 0, i32 0
// CHECK-DAG: [[TMP54:%.*]] = mul nuw i64 [[TMP2:%.+]], 4
// CHECK-DAG: [[TMP55:%.*]] = udiv exact i64 [[TMP54]], ptrtoint (float* getelementptr (float, float* null, i32 1) to i64)
// CHECK-DAG: store i64 [[TMP54]], i64* [[TMP56:%[^,]+]],
// CHECK-DAG: [[TMP56]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 1
// CHECK-DAG: [[TMP57:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 2
// CHECK-DAG: store i8* bitcast (void (i8*)* @[[RED_INIT4:.+]] to i8*), i8** [[TMP57]],
// CHECK-DAG: [[TMP58:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 3
// CHECK-DAG: store i8* null, i8** [[TMP58]],
// CHECK-DAG: [[TMP59:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 4
// CHECK-DAG: store i8* bitcast (void (i8*, i8*)* @[[RED_COMB4:.+]] to i8*), i8** [[TMP59]],
// CHECK-DAG: [[TMP60:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_RED_INPUT_T]], %struct.kmp_task_red_input_t* [[DOTRD_INPUT_GEP_8]], i32 0, i32 5
// CHECK-DAG: store i32 1, i32* [[TMP60]],
// CHECK-DAG: [[DOTRD_INPUT_GEP_]] = getelementptr inbounds [4 x %struct.kmp_task_red_input_t], [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]], i64 0, i64
// CHECK-DAG: [[DOTRD_INPUT_GEP_4]] = getelementptr inbounds [4 x %struct.kmp_task_red_input_t], [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]], i64 0, i64
// CHECK-DAG: [[DOTRD_INPUT_GEP_7]] = getelementptr inbounds [4 x %struct.kmp_task_red_input_t], [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]], i64 0, i64
// CHECK-DAG: [[DOTRD_INPUT_GEP_8]] = getelementptr inbounds [4 x %struct.kmp_task_red_input_t], [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]], i64 0, i64
// CHECK: [[TMP61:%.*]] = bitcast [4 x %struct.kmp_task_red_input_t]* [[DOTRD_INPUT_]] to i8*
// CHECK: [[TMP62:%.*]] = call i8* @__kmpc_task_reduction_init(i32 [[TMP0:%.+]], i32 4, i8* [[TMP61]])
// CHECK: [[TMP63:%.*]] = load i32, i32* [[N:%.+]],
// CHECK: store i32 [[TMP63]], i32* [[DOTCAPTURE_EXPR_]],
// CHECK: [[TMP64:%.*]] = load i32, i32* [[DOTCAPTURE_EXPR_]],
// CHECK: [[SUB:%.*]] = sub nsw i32 [[TMP64]], 0
// CHECK: [[SUB10:%.*]] = sub nsw i32 [[SUB]], 1
// CHECK: [[ADD11:%.*]] = add nsw i32 [[SUB10]], 1
// CHECK: [[DIV:%.*]] = sdiv i32 [[ADD11]], 1
// CHECK: [[SUB12:%.*]] = sub nsw i32 [[DIV]], 1
// CHECK: store i32 [[SUB12]], i32* [[DOTCAPTURE_EXPR_9]],
// CHECK: [[TMP65:%.*]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* %{{.+}}, i32 [[TMP0]], i32 1, i64 888, i64 72, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates*)* @[[TASK:.+]] to i32 (i32, i8*)*))
// CHECK: call void @__kmpc_taskloop(%struct.ident_t* %{{.+}}, i32 [[TMP0]], i8* [[TMP65]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 1, i32 0, i64 0, i8* null)
// CHECK: call void @__kmpc_end_taskgroup(%struct.ident_t*
// CHECK: call {{.*}}void @__kmpc_end_master(
// CHECK-NEXT: br label {{%?}}[[EXIT]]
// CHECK: [[EXIT]]

// CHECK: define internal void @[[RED_INIT1]](i8* %0)
// CHECK: store float 0.000000e+00, float* %
// CHECK: ret void

// CHECK: define internal void @[[RED_COMB1]](i8* %0, i8* %1)
// CHECK: fadd float %
// CHECK: store float %{{.+}}, float* %
// CHECK: ret void

// CHECK: define internal void @[[RED_INIT2]](i8* %0)
// CHECK: call i8* @__kmpc_threadprivate_cached(
// CHECK: [[ORIG_PTR_ADDR:%.+]] = call i8* @__kmpc_threadprivate_cached(
// CHECK: [[ORIG_PTR_REF:%.+]] = bitcast i8* [[ORIG_PTR_ADDR]] to i8**
// CHECK: load i8*, i8** [[ORIG_PTR_REF]],
// CHECK: call void [[OMP_INIT1:@.+]](
// CHECK: ret void

// CHECK: define internal void [[OMP_COMB1:@.+]](%struct.S* noalias %0, %struct.S* noalias %1)
// CHECK: fadd float %

// CHECK: define internal void [[OMP_INIT1]](%struct.S* noalias %0, %struct.S* noalias %1)
// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(

// CHECK: define internal void @[[RED_FINI2]](i8* %0)
// CHECK: call i8* @__kmpc_threadprivate_cached(
// CHECK: call void @
// CHECK: ret void

// CHECK: define internal void @[[RED_COMB2]](i8* %0, i8* %1)
// CHECK: call i8* @__kmpc_threadprivate_cached(
// CHECK: call void [[OMP_COMB1]](
// CHECK: ret void

// CHECK: define internal void @[[RED_INIT3]](i8* %0)
// CHECK: store float 0.000000e+00, float* %
// CHECK: ret void

// CHECK: define internal void @[[RED_COMB3]](i8* %0, i8* %1)
// CHECK: fadd float %
// CHECK: store float %{{.+}}, float* %
// CHECK: ret void

// CHECK: define internal void @[[RED_INIT4]](i8* %0)
// CHECK: call i8* @__kmpc_threadprivate_cached(
// CHECK: store float 0.000000e+00, float* %
// CHECK: ret void

// CHECK: define internal void @[[RED_COMB4]](i8* %0, i8* %1)
// CHECK: call i8* @__kmpc_threadprivate_cached(
// CHECK: fadd float %
// CHECK: store float %{{.+}}, float* %
// CHECK: ret void

// CHECK-NOT: call i8* @__kmpc_threadprivate_cached(
// CHECK: call i8* @__kmpc_task_reduction_get_th_data(
// CHECK: call i8* @__kmpc_threadprivate_cached(
// CHECK: call i8* @__kmpc_threadprivate_cached(
// CHECK: call i8* @__kmpc_task_reduction_get_th_data(
// CHECK-NOT: call i8* @__kmpc_threadprivate_cached(
// CHECK: call i8* @__kmpc_task_reduction_get_th_data(
// CHECK: call i8* @__kmpc_threadprivate_cached(
// CHECK: call i8* @__kmpc_task_reduction_get_th_data(
// CHECK-NOT: call i8* @__kmpc_threadprivate_cached(

// CHECK-DAG: distinct !DISubprogram(linkageName: "[[TASK]]", scope: !
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_INIT1]]"
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_COMB1]]"
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_INIT2]]"
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_FINI2]]"
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_COMB2]]"
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_INIT3]]"
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_COMB3]]"
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_INIT4]]"
// CHECK-DAG: !DISubprogram(linkageName: "[[RED_COMB4]]"
352 changes: 352 additions & 0 deletions clang/test/OpenMP/parallel_master_taskloop_simd_reduction_messages.cpp

Large diffs are not rendered by default.

106 changes: 106 additions & 0 deletions clang/test/OpenMP/parallel_master_taskloop_simd_safelen_messages.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp -std=c++98 %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s -Wuninitialized

// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wuninitialized

void foo() {
}

#if __cplusplus >= 201103L
// expected-note@+2 4 {{declared here}}
#endif
bool foobool(int argc) {
return argc;
}

struct S1; // expected-note {{declared here}}

template <class T, typename S, int N, int ST> // expected-note {{declared here}}
T tmain(T argc, S **argv) { //expected-note 2 {{declared here}}
#pragma omp parallel master taskloop simd safelen // expected-error {{expected '(' after 'safelen'}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp parallel master taskloop simd safelen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp parallel master taskloop simd safelen () // expected-error {{expected expression}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
// expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
// expected-error@+2 2 {{expression is not an integral constant expression}}
// expected-note@+1 2 {{read of non-const variable 'argc' is not allowed in a constant expression}}
#pragma omp parallel master taskloop simd safelen (argc
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
// expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
#pragma omp parallel master taskloop simd safelen (ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp parallel master taskloop simd safelen (1)) // expected-warning {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp parallel master taskloop simd safelen ((ST > 0) ? 1 + ST : 2)
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
// expected-error@+6 2 {{directive '#pragma omp parallel master taskloop simd' cannot contain more than one 'safelen' clause}}
// expected-error@+5 {{argument to 'safelen' clause must be a strictly positive integer value}}
// expected-error@+4 2 {{expression is not an integral constant expression}}
#if __cplusplus >= 201103L
// expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}}
#endif
#pragma omp parallel master taskloop simd safelen (foobool(argc)), safelen (true), safelen (-5)
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp parallel master taskloop simd safelen (S) // expected-error {{'S' does not refer to a value}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#if __cplusplus <= 199711L
// expected-error@+4 2 {{expression is not an integral constant expression}}
#else
// expected-error@+2 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
#endif
#pragma omp parallel master taskloop simd safelen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp parallel master taskloop simd safelen (4)
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp parallel master taskloop simd safelen (N) // expected-error {{argument to 'safelen' clause must be a strictly positive integer value}}
for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
return argc;
}

int main(int argc, char **argv) {
#pragma omp parallel master taskloop simd safelen // expected-error {{expected '(' after 'safelen'}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
#pragma omp parallel master taskloop simd safelen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
#pragma omp parallel master taskloop simd safelen () // expected-error {{expected expression}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
#pragma omp parallel master taskloop simd safelen (4 // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
#pragma omp parallel master taskloop simd safelen (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
// expected-error@+4 {{expression is not an integral constant expression}}
#if __cplusplus >= 201103L
// expected-note@+2 {{non-constexpr function 'foobool' cannot be used in a constant expression}}
#endif
#pragma omp parallel master taskloop simd safelen (foobool(1) > 0 ? 1 : 2)
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
// expected-error@+6 {{expression is not an integral constant expression}}
#if __cplusplus >= 201103L
// expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}}
#endif
// expected-error@+2 2 {{directive '#pragma omp parallel master taskloop simd' cannot contain more than one 'safelen' clause}}
// expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}}
#pragma omp parallel master taskloop simd safelen (foobool(argc)), safelen (true), safelen (-5)
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
#pragma omp parallel master taskloop simd safelen (S1) // expected-error {{'S1' does not refer to a value}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
#if __cplusplus <= 199711L
// expected-error@+4 {{expression is not an integral constant expression}}
#else
// expected-error@+2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
#endif
#pragma omp parallel master taskloop simd safelen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
// expected-error@+3 {{statement after '#pragma omp parallel master taskloop simd' must be a for loop}}
// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
#pragma omp parallel master taskloop simd safelen(safelen(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
foo();
// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 12, 4>' requested here}}
return tmain<int, char, 12, 4>(argc, argv);
}

106 changes: 106 additions & 0 deletions clang/test/OpenMP/parallel_master_taskloop_simd_simdlen_messages.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp -std=c++98 %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s -Wuninitialized

// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wuninitialized

void foo() {
}

#if __cplusplus >= 201103L
// expected-note@+2 4 {{declared here}}
#endif
bool foobool(int argc) {
return argc;
}

struct S1; // expected-note {{declared here}}

template <class T, typename S, int N, int ST> // expected-note {{declared here}}
T tmain(T argc, S **argv) { //expected-note 2 {{declared here}}
#pragma omp parallel master taskloop simd simdlen // expected-error {{expected '(' after 'simdlen'}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp parallel master taskloop simd simdlen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp parallel master taskloop simd simdlen () // expected-error {{expected expression}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
// expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
// expected-error@+2 2 {{expression is not an integral constant expression}}
// expected-note@+1 2 {{read of non-const variable 'argc' is not allowed in a constant expression}}
#pragma omp parallel master taskloop simd simdlen (argc
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
// expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
#pragma omp parallel master taskloop simd simdlen (ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp parallel master taskloop simd simdlen (1)) // expected-warning {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp parallel master taskloop simd simdlen ((ST > 0) ? 1 + ST : 2)
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
// expected-error@+6 2 {{directive '#pragma omp parallel master taskloop simd' cannot contain more than one 'simdlen' clause}}
// expected-error@+5 {{argument to 'simdlen' clause must be a strictly positive integer value}}
// expected-error@+4 2 {{expression is not an integral constant expression}}
#if __cplusplus >= 201103L
// expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}}
#endif
#pragma omp parallel master taskloop simd simdlen (foobool(argc)), simdlen (true), simdlen (-5)
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp parallel master taskloop simd simdlen (S) // expected-error {{'S' does not refer to a value}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#if __cplusplus <= 199711L
// expected-error@+4 2 {{expression is not an integral constant expression}}
#else
// expected-error@+2 2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
#endif
#pragma omp parallel master taskloop simd simdlen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp parallel master taskloop simd simdlen (4)
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
#pragma omp parallel master taskloop simd simdlen (N) // expected-error {{argument to 'simdlen' clause must be a strictly positive integer value}}
for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
return argc;
}

int main(int argc, char **argv) {
#pragma omp parallel master taskloop simd simdlen // expected-error {{expected '(' after 'simdlen'}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
#pragma omp parallel master taskloop simd simdlen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
#pragma omp parallel master taskloop simd simdlen () // expected-error {{expected expression}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
#pragma omp parallel master taskloop simd simdlen (4 // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
#pragma omp parallel master taskloop simd simdlen (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp parallel master taskloop simd' are ignored}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
// expected-error@+4 {{expression is not an integral constant expression}}
#if __cplusplus >= 201103L
// expected-note@+2 {{non-constexpr function 'foobool' cannot be used in a constant expression}}
#endif
#pragma omp parallel master taskloop simd simdlen (foobool(1) > 0 ? 1 : 2)
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
// expected-error@+6 {{expression is not an integral constant expression}}
#if __cplusplus >= 201103L
// expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}}
#endif
// expected-error@+2 2 {{directive '#pragma omp parallel master taskloop simd' cannot contain more than one 'simdlen' clause}}
// expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}}
#pragma omp parallel master taskloop simd simdlen (foobool(argc)), simdlen (true), simdlen (-5)
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
#pragma omp parallel master taskloop simd simdlen (S1) // expected-error {{'S1' does not refer to a value}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
#if __cplusplus <= 199711L
// expected-error@+4 {{expression is not an integral constant expression}}
#else
// expected-error@+2 {{integral constant expression must have integral or unscoped enumeration type, not 'char *'}}
#endif
#pragma omp parallel master taskloop simd simdlen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
// expected-error@+3 {{statement after '#pragma omp parallel master taskloop simd' must be a for loop}}
// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
#pragma omp parallel master taskloop simd simdlen(simdlen(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
foo();
// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 12, 4>' requested here}}
return tmain<int, char, 12, 4>(argc, argv);
}

9 changes: 9 additions & 0 deletions clang/tools/libclang/CIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2052,6 +2052,8 @@ class EnqueueVisitor : public ConstStmtVisitor<EnqueueVisitor, void> {
VisitOMPMasterTaskLoopSimdDirective(const OMPMasterTaskLoopSimdDirective *D);
void VisitOMPParallelMasterTaskLoopDirective(
const OMPParallelMasterTaskLoopDirective *D);
void VisitOMPParallelMasterTaskLoopSimdDirective(
const OMPParallelMasterTaskLoopSimdDirective *D);
void VisitOMPDistributeDirective(const OMPDistributeDirective *D);
void VisitOMPDistributeParallelForDirective(
const OMPDistributeParallelForDirective *D);
Expand Down Expand Up @@ -2911,6 +2913,11 @@ void EnqueueVisitor::VisitOMPParallelMasterTaskLoopDirective(
VisitOMPLoopDirective(D);
}

void EnqueueVisitor::VisitOMPParallelMasterTaskLoopSimdDirective(
const OMPParallelMasterTaskLoopSimdDirective *D) {
VisitOMPLoopDirective(D);
}

void EnqueueVisitor::VisitOMPDistributeDirective(
const OMPDistributeDirective *D) {
VisitOMPLoopDirective(D);
Expand Down Expand Up @@ -5489,6 +5496,8 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) {
return cxstring::createRef("OMPMasterTaskLoopSimdDirective");
case CXCursor_OMPParallelMasterTaskLoopDirective:
return cxstring::createRef("OMPParallelMasterTaskLoopDirective");
case CXCursor_OMPParallelMasterTaskLoopSimdDirective:
return cxstring::createRef("OMPParallelMasterTaskLoopSimdDirective");
case CXCursor_OMPDistributeDirective:
return cxstring::createRef("OMPDistributeDirective");
case CXCursor_OMPDistributeParallelForDirective:
Expand Down
3 changes: 3 additions & 0 deletions clang/tools/libclang/CXCursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,9 @@ CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent,
case Stmt::OMPParallelMasterTaskLoopDirectiveClass:
K = CXCursor_OMPParallelMasterTaskLoopDirective;
break;
case Stmt::OMPParallelMasterTaskLoopSimdDirectiveClass:
K = CXCursor_OMPParallelMasterTaskLoopSimdDirective;
break;
case Stmt::OMPDistributeDirectiveClass:
K = CXCursor_OMPDistributeDirective;
break;
Expand Down