llvm-project/clang/test/SemaOpenACC/compute-construct-wait-clause.c
Erich Keane 42f4e505a3
[OpenACC] Loop construct basic Sema and AST work (#93742)
This patch implements the 'loop' construct AST, as well as the basic
appertainment rule. Additionally, it sets up the 'parent' compute
construct, which is necessary for codegen/other diagnostics.

A 'loop' can apply to a for or range-for loop, otherwise it has no other
restrictions (though some of its clauses do).
2024-06-05 06:21:48 -07:00

43 lines
1.3 KiB
C

// RUN: %clang_cc1 %s -fopenacc -verify
struct NotConvertible{} NC;
short getS();
int getI();
void uses() {
int arr[5];
#pragma acc parallel wait
while(1);
#pragma acc serial wait()
while(1);
#pragma acc kernels wait(getS(), getI())
while(1);
#pragma acc parallel wait(devnum:getS(): getI())
while(1);
#pragma acc parallel wait(devnum:getS(): queues: getI()) wait(devnum:getI(): queues: getS(), getI(), 5)
while(1);
// expected-error@+1{{OpenACC clause 'wait' requires expression of integer type ('struct NotConvertible' invalid)}}
#pragma acc parallel wait(devnum:NC : 5)
while(1);
// expected-error@+1{{OpenACC clause 'wait' requires expression of integer type ('struct NotConvertible' invalid)}}
#pragma acc parallel wait(devnum:5 : NC)
while(1);
// expected-error@+3{{OpenACC clause 'wait' requires expression of integer type ('int[5]' invalid)}}
// expected-error@+2{{OpenACC clause 'wait' requires expression of integer type ('int[5]' invalid)}}
// expected-error@+1{{OpenACC clause 'wait' requires expression of integer type ('struct NotConvertible' invalid)}}
#pragma acc parallel wait(devnum:arr : queues: arr, NC, 5)
while(1);
// expected-error@+1{{OpenACC 'wait' clause is not valid on 'loop' directive}}
#pragma acc loop wait
for(;;);
}