Skip to content

Commit 85ea1aa

Browse files
committed
[OpenACC] Fix device_type clause appertainment
Seemingly I forgot to implement the appertainment checks when doing the original device_type implementation, so we fell through to the 'not implemented' section of the diagnostics. This patch corrects the appertainment, so that we disallow it correctly.
1 parent ca0dae0 commit 85ea1aa

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

clang/lib/Sema/SemaOpenACC.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,27 @@ bool doesClauseApplyToDirective(OpenACCDirectiveKind DirectiveKind,
246246
return false;
247247
}
248248

249+
case OpenACCClauseKind::DeviceType:
250+
case OpenACCClauseKind::DType:
251+
switch (DirectiveKind) {
252+
case OpenACCDirectiveKind::Parallel:
253+
case OpenACCDirectiveKind::Serial:
254+
case OpenACCDirectiveKind::Kernels:
255+
case OpenACCDirectiveKind::Data:
256+
case OpenACCDirectiveKind::Init:
257+
case OpenACCDirectiveKind::Shutdown:
258+
case OpenACCDirectiveKind::Set:
259+
case OpenACCDirectiveKind::Update:
260+
case OpenACCDirectiveKind::Loop:
261+
case OpenACCDirectiveKind::Routine:
262+
case OpenACCDirectiveKind::ParallelLoop:
263+
case OpenACCDirectiveKind::SerialLoop:
264+
case OpenACCDirectiveKind::KernelsLoop:
265+
return true;
266+
default:
267+
return false;
268+
}
269+
249270
default:
250271
// Do nothing so we can go to the 'unimplemented' diagnostic instead.
251272
return true;

clang/test/SemaOpenACC/compute-construct-device_type-clause.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ void uses() {
3434
#pragma acc kernels dtype(MACRO)
3535
while(1);
3636

37+
// expected-error@+2{{OpenACC 'device_type' clause is not valid on 'enter data' directive}}
38+
// expected-warning@+1{{OpenACC construct 'enter data' not yet implemented}}
39+
#pragma acc enter data device_type(I)
40+
// expected-error@+2{{OpenACC 'dtype' clause is not valid on 'enter data' directive}}
41+
// expected-warning@+1{{OpenACC construct 'enter data' not yet implemented}}
42+
#pragma acc enter data dtype(I)
43+
3744

3845
// Only 'async', 'wait', num_gangs', 'num_workers', 'vector_length' allowed after 'device_type'.
3946

0 commit comments

Comments
 (0)