19#include "llvm/ADT/StringExtras.h"
20#include "llvm/Support/Casting.h"
29 case OpenACCDirectiveKind::Invalid:
33 case OpenACCDirectiveKind::ParallelLoop:
34 case OpenACCDirectiveKind::SerialLoop:
35 case OpenACCDirectiveKind::KernelsLoop:
36 case OpenACCDirectiveKind::Parallel:
37 case OpenACCDirectiveKind::Serial:
38 case OpenACCDirectiveKind::Kernels:
39 case OpenACCDirectiveKind::Loop:
40 case OpenACCDirectiveKind::Data:
41 case OpenACCDirectiveKind::EnterData:
42 case OpenACCDirectiveKind::ExitData:
43 case OpenACCDirectiveKind::HostData:
44 case OpenACCDirectiveKind::Wait:
46 return S.
Diag(StartLoc, diag::err_acc_construct_appertainment) << K;
57 case OpenACCClauseKind::Default:
58 switch (DirectiveKind) {
59 case OpenACCDirectiveKind::Parallel:
60 case OpenACCDirectiveKind::Serial:
61 case OpenACCDirectiveKind::Kernels:
62 case OpenACCDirectiveKind::ParallelLoop:
63 case OpenACCDirectiveKind::SerialLoop:
64 case OpenACCDirectiveKind::KernelsLoop:
65 case OpenACCDirectiveKind::Data:
70 case OpenACCClauseKind::If:
71 switch (DirectiveKind) {
72 case OpenACCDirectiveKind::Parallel:
73 case OpenACCDirectiveKind::Serial:
74 case OpenACCDirectiveKind::Kernels:
75 case OpenACCDirectiveKind::Data:
76 case OpenACCDirectiveKind::EnterData:
77 case OpenACCDirectiveKind::ExitData:
78 case OpenACCDirectiveKind::HostData:
79 case OpenACCDirectiveKind::Init:
80 case OpenACCDirectiveKind::Shutdown:
81 case OpenACCDirectiveKind::Set:
82 case OpenACCDirectiveKind::Update:
83 case OpenACCDirectiveKind::Wait:
84 case OpenACCDirectiveKind::ParallelLoop:
85 case OpenACCDirectiveKind::SerialLoop:
86 case OpenACCDirectiveKind::KernelsLoop:
91 case OpenACCClauseKind::Self:
92 switch (DirectiveKind) {
93 case OpenACCDirectiveKind::Parallel:
94 case OpenACCDirectiveKind::Serial:
95 case OpenACCDirectiveKind::Kernels:
96 case OpenACCDirectiveKind::Update:
97 case OpenACCDirectiveKind::ParallelLoop:
98 case OpenACCDirectiveKind::SerialLoop:
99 case OpenACCDirectiveKind::KernelsLoop:
104 case OpenACCClauseKind::NumGangs:
105 case OpenACCClauseKind::NumWorkers:
106 case OpenACCClauseKind::VectorLength:
107 switch (DirectiveKind) {
108 case OpenACCDirectiveKind::Parallel:
109 case OpenACCDirectiveKind::Kernels:
110 case OpenACCDirectiveKind::ParallelLoop:
111 case OpenACCDirectiveKind::KernelsLoop:
116 case OpenACCClauseKind::FirstPrivate:
117 switch (DirectiveKind) {
118 case OpenACCDirectiveKind::Parallel:
119 case OpenACCDirectiveKind::Serial:
120 case OpenACCDirectiveKind::ParallelLoop:
121 case OpenACCDirectiveKind::SerialLoop:
126 case OpenACCClauseKind::Private:
127 switch (DirectiveKind) {
128 case OpenACCDirectiveKind::Parallel:
129 case OpenACCDirectiveKind::Serial:
130 case OpenACCDirectiveKind::Loop:
131 case OpenACCDirectiveKind::ParallelLoop:
132 case OpenACCDirectiveKind::SerialLoop:
133 case OpenACCDirectiveKind::KernelsLoop:
138 case OpenACCClauseKind::NoCreate:
139 switch (DirectiveKind) {
140 case OpenACCDirectiveKind::Parallel:
141 case OpenACCDirectiveKind::Serial:
142 case OpenACCDirectiveKind::Kernels:
143 case OpenACCDirectiveKind::Data:
144 case OpenACCDirectiveKind::ParallelLoop:
145 case OpenACCDirectiveKind::SerialLoop:
146 case OpenACCDirectiveKind::KernelsLoop:
151 case OpenACCClauseKind::Present:
152 switch (DirectiveKind) {
153 case OpenACCDirectiveKind::Parallel:
154 case OpenACCDirectiveKind::Serial:
155 case OpenACCDirectiveKind::Kernels:
156 case OpenACCDirectiveKind::Data:
157 case OpenACCDirectiveKind::Declare:
158 case OpenACCDirectiveKind::ParallelLoop:
159 case OpenACCDirectiveKind::SerialLoop:
160 case OpenACCDirectiveKind::KernelsLoop:
166 case OpenACCClauseKind::Copy:
167 case OpenACCClauseKind::PCopy:
168 case OpenACCClauseKind::PresentOrCopy:
169 switch (DirectiveKind) {
170 case OpenACCDirectiveKind::Parallel:
171 case OpenACCDirectiveKind::Serial:
172 case OpenACCDirectiveKind::Kernels:
173 case OpenACCDirectiveKind::Data:
174 case OpenACCDirectiveKind::Declare:
175 case OpenACCDirectiveKind::ParallelLoop:
176 case OpenACCDirectiveKind::SerialLoop:
177 case OpenACCDirectiveKind::KernelsLoop:
182 case OpenACCClauseKind::CopyIn:
183 case OpenACCClauseKind::PCopyIn:
184 case OpenACCClauseKind::PresentOrCopyIn:
185 switch (DirectiveKind) {
186 case OpenACCDirectiveKind::Parallel:
187 case OpenACCDirectiveKind::Serial:
188 case OpenACCDirectiveKind::Kernels:
189 case OpenACCDirectiveKind::Data:
190 case OpenACCDirectiveKind::EnterData:
191 case OpenACCDirectiveKind::Declare:
192 case OpenACCDirectiveKind::ParallelLoop:
193 case OpenACCDirectiveKind::SerialLoop:
194 case OpenACCDirectiveKind::KernelsLoop:
199 case OpenACCClauseKind::CopyOut:
200 case OpenACCClauseKind::PCopyOut:
201 case OpenACCClauseKind::PresentOrCopyOut:
202 switch (DirectiveKind) {
203 case OpenACCDirectiveKind::Parallel:
204 case OpenACCDirectiveKind::Serial:
205 case OpenACCDirectiveKind::Kernels:
206 case OpenACCDirectiveKind::Data:
207 case OpenACCDirectiveKind::ExitData:
208 case OpenACCDirectiveKind::Declare:
209 case OpenACCDirectiveKind::ParallelLoop:
210 case OpenACCDirectiveKind::SerialLoop:
211 case OpenACCDirectiveKind::KernelsLoop:
216 case OpenACCClauseKind::Create:
217 case OpenACCClauseKind::PCreate:
218 case OpenACCClauseKind::PresentOrCreate:
219 switch (DirectiveKind) {
220 case OpenACCDirectiveKind::Parallel:
221 case OpenACCDirectiveKind::Serial:
222 case OpenACCDirectiveKind::Kernels:
223 case OpenACCDirectiveKind::Data:
224 case OpenACCDirectiveKind::EnterData:
225 case OpenACCDirectiveKind::ParallelLoop:
226 case OpenACCDirectiveKind::SerialLoop:
227 case OpenACCDirectiveKind::KernelsLoop:
233 case OpenACCClauseKind::Attach:
234 switch (DirectiveKind) {
235 case OpenACCDirectiveKind::Parallel:
236 case OpenACCDirectiveKind::Serial:
237 case OpenACCDirectiveKind::Kernels:
238 case OpenACCDirectiveKind::Data:
239 case OpenACCDirectiveKind::EnterData:
240 case OpenACCDirectiveKind::ParallelLoop:
241 case OpenACCDirectiveKind::SerialLoop:
242 case OpenACCDirectiveKind::KernelsLoop:
247 case OpenACCClauseKind::DevicePtr:
248 switch (DirectiveKind) {
249 case OpenACCDirectiveKind::Parallel:
250 case OpenACCDirectiveKind::Serial:
251 case OpenACCDirectiveKind::Kernels:
252 case OpenACCDirectiveKind::Data:
253 case OpenACCDirectiveKind::Declare:
254 case OpenACCDirectiveKind::ParallelLoop:
255 case OpenACCDirectiveKind::SerialLoop:
256 case OpenACCDirectiveKind::KernelsLoop:
261 case OpenACCClauseKind::Async:
262 switch (DirectiveKind) {
263 case OpenACCDirectiveKind::Parallel:
264 case OpenACCDirectiveKind::Serial:
265 case OpenACCDirectiveKind::Kernels:
266 case OpenACCDirectiveKind::Data:
267 case OpenACCDirectiveKind::EnterData:
268 case OpenACCDirectiveKind::ExitData:
269 case OpenACCDirectiveKind::Set:
270 case OpenACCDirectiveKind::Update:
271 case OpenACCDirectiveKind::Wait:
272 case OpenACCDirectiveKind::ParallelLoop:
273 case OpenACCDirectiveKind::SerialLoop:
274 case OpenACCDirectiveKind::KernelsLoop:
279 case OpenACCClauseKind::Wait:
280 switch (DirectiveKind) {
281 case OpenACCDirectiveKind::Parallel:
282 case OpenACCDirectiveKind::Serial:
283 case OpenACCDirectiveKind::Kernels:
284 case OpenACCDirectiveKind::Data:
285 case OpenACCDirectiveKind::EnterData:
286 case OpenACCDirectiveKind::ExitData:
287 case OpenACCDirectiveKind::Update:
288 case OpenACCDirectiveKind::ParallelLoop:
289 case OpenACCDirectiveKind::SerialLoop:
290 case OpenACCDirectiveKind::KernelsLoop:
296 case OpenACCClauseKind::Seq:
297 switch (DirectiveKind) {
298 case OpenACCDirectiveKind::Loop:
299 case OpenACCDirectiveKind::Routine:
300 case OpenACCDirectiveKind::ParallelLoop:
301 case OpenACCDirectiveKind::SerialLoop:
302 case OpenACCDirectiveKind::KernelsLoop:
308 case OpenACCClauseKind::Independent:
309 case OpenACCClauseKind::Auto:
310 switch (DirectiveKind) {
311 case OpenACCDirectiveKind::Loop:
312 case OpenACCDirectiveKind::ParallelLoop:
313 case OpenACCDirectiveKind::SerialLoop:
314 case OpenACCDirectiveKind::KernelsLoop:
320 case OpenACCClauseKind::Reduction:
321 switch (DirectiveKind) {
322 case OpenACCDirectiveKind::Parallel:
323 case OpenACCDirectiveKind::Serial:
324 case OpenACCDirectiveKind::Loop:
325 case OpenACCDirectiveKind::ParallelLoop:
326 case OpenACCDirectiveKind::SerialLoop:
327 case OpenACCDirectiveKind::KernelsLoop:
333 case OpenACCClauseKind::DeviceType:
334 case OpenACCClauseKind::DType:
335 switch (DirectiveKind) {
336 case OpenACCDirectiveKind::Parallel:
337 case OpenACCDirectiveKind::Serial:
338 case OpenACCDirectiveKind::Kernels:
339 case OpenACCDirectiveKind::Data:
340 case OpenACCDirectiveKind::Init:
341 case OpenACCDirectiveKind::Shutdown:
342 case OpenACCDirectiveKind::Set:
343 case OpenACCDirectiveKind::Update:
344 case OpenACCDirectiveKind::Loop:
345 case OpenACCDirectiveKind::Routine:
346 case OpenACCDirectiveKind::ParallelLoop:
347 case OpenACCDirectiveKind::SerialLoop:
348 case OpenACCDirectiveKind::KernelsLoop:
354 case OpenACCClauseKind::Collapse: {
355 switch (DirectiveKind) {
356 case OpenACCDirectiveKind::Loop:
357 case OpenACCDirectiveKind::ParallelLoop:
358 case OpenACCDirectiveKind::SerialLoop:
359 case OpenACCDirectiveKind::KernelsLoop:
365 case OpenACCClauseKind::Tile: {
366 switch (DirectiveKind) {
367 case OpenACCDirectiveKind::Loop:
368 case OpenACCDirectiveKind::ParallelLoop:
369 case OpenACCDirectiveKind::SerialLoop:
370 case OpenACCDirectiveKind::KernelsLoop:
377 case OpenACCClauseKind::Gang: {
378 switch (DirectiveKind) {
379 case OpenACCDirectiveKind::Loop:
380 case OpenACCDirectiveKind::ParallelLoop:
381 case OpenACCDirectiveKind::SerialLoop:
382 case OpenACCDirectiveKind::KernelsLoop:
383 case OpenACCDirectiveKind::Routine:
388 case OpenACCClauseKind::Worker: {
389 switch (DirectiveKind) {
390 case OpenACCDirectiveKind::Loop:
391 case OpenACCDirectiveKind::ParallelLoop:
392 case OpenACCDirectiveKind::SerialLoop:
393 case OpenACCDirectiveKind::KernelsLoop:
394 case OpenACCDirectiveKind::Routine:
400 case OpenACCClauseKind::Vector: {
401 switch (DirectiveKind) {
402 case OpenACCDirectiveKind::Loop:
403 case OpenACCDirectiveKind::ParallelLoop:
404 case OpenACCDirectiveKind::SerialLoop:
405 case OpenACCDirectiveKind::KernelsLoop:
406 case OpenACCDirectiveKind::Routine:
412 case OpenACCClauseKind::Finalize: {
413 switch (DirectiveKind) {
414 case OpenACCDirectiveKind::ExitData:
420 case OpenACCClauseKind::IfPresent: {
421 switch (DirectiveKind) {
422 case OpenACCDirectiveKind::HostData:
423 case OpenACCDirectiveKind::Update:
429 case OpenACCClauseKind::Delete: {
430 switch (DirectiveKind) {
431 case OpenACCDirectiveKind::ExitData:
438 case OpenACCClauseKind::Detach: {
439 switch (DirectiveKind) {
440 case OpenACCDirectiveKind::ExitData:
447 case OpenACCClauseKind::DeviceNum: {
448 switch (DirectiveKind) {
449 case OpenACCDirectiveKind::Init:
450 case OpenACCDirectiveKind::Shutdown:
451 case OpenACCDirectiveKind::Set:
458 case OpenACCClauseKind::UseDevice: {
459 switch (DirectiveKind) {
460 case OpenACCDirectiveKind::HostData:
466 case OpenACCClauseKind::DefaultAsync: {
467 switch (DirectiveKind) {
468 case OpenACCDirectiveKind::Set:
474 case OpenACCClauseKind::Device: {
475 switch (DirectiveKind) {
476 case OpenACCDirectiveKind::Update:
482 case OpenACCClauseKind::Host: {
483 switch (DirectiveKind) {
484 case OpenACCDirectiveKind::Update:
496 llvm_unreachable(
"Invalid clause kind");
499bool checkAlreadyHasClauseOfKind(
502 const auto *Itr = llvm::find_if(ExistingClauses, [&](
const OpenACCClause *
C) {
505 if (Itr != ExistingClauses.end()) {
506 S.
Diag(Clause.
getBeginLoc(), diag::err_acc_duplicate_clause_disallowed)
508 S.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
514bool checkValidAfterDeviceType(
519 if (NewClause.getDirectiveKind() == OpenACCDirectiveKind::Routine)
538 case OpenACCClauseKind::Async:
539 case OpenACCClauseKind::Wait:
540 case OpenACCClauseKind::NumGangs:
541 case OpenACCClauseKind::NumWorkers:
542 case OpenACCClauseKind::VectorLength:
547 }
else if (NewClause.getDirectiveKind() == OpenACCDirectiveKind::Loop) {
552 case OpenACCClauseKind::Collapse:
553 case OpenACCClauseKind::Gang:
554 case OpenACCClauseKind::Worker:
555 case OpenACCClauseKind::Vector:
556 case OpenACCClauseKind::Seq:
557 case OpenACCClauseKind::Independent:
558 case OpenACCClauseKind::Auto:
559 case OpenACCClauseKind::Tile:
567 case OpenACCClauseKind::Async:
568 case OpenACCClauseKind::Wait:
569 case OpenACCClauseKind::NumGangs:
570 case OpenACCClauseKind::NumWorkers:
571 case OpenACCClauseKind::VectorLength:
572 case OpenACCClauseKind::Collapse:
573 case OpenACCClauseKind::Gang:
574 case OpenACCClauseKind::Worker:
575 case OpenACCClauseKind::Vector:
576 case OpenACCClauseKind::Seq:
577 case OpenACCClauseKind::Independent:
578 case OpenACCClauseKind::Auto:
579 case OpenACCClauseKind::Tile:
584 }
else if (NewClause.getDirectiveKind() == OpenACCDirectiveKind::Data) {
588 case OpenACCClauseKind::Async:
589 case OpenACCClauseKind::Wait:
594 }
else if (NewClause.getDirectiveKind() == OpenACCDirectiveKind::Set ||
595 NewClause.getDirectiveKind() == OpenACCDirectiveKind::Init ||
596 NewClause.getDirectiveKind() == OpenACCDirectiveKind::Shutdown) {
599 }
else if (NewClause.getDirectiveKind() == OpenACCDirectiveKind::Update) {
603 case OpenACCClauseKind::Async:
604 case OpenACCClauseKind::Wait:
610 S.
Diag(NewClause.
getBeginLoc(), diag::err_acc_clause_after_device_type)
612 << NewClause.getDirectiveKind();
613 S.
Diag(DeviceTypeClause.
getBeginLoc(), diag::note_acc_previous_clause_here);
624 DK == OpenACCDirectiveKind::Loop || DK == OpenACCDirectiveKind::Wait ||
625 DK == OpenACCDirectiveKind::Init ||
626 DK == OpenACCDirectiveKind::Shutdown ||
627 DK == OpenACCDirectiveKind::Set;
630class SemaOpenACCClauseVisitor {
634 bool NotImplemented =
false;
637 NotImplemented =
true;
646 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCSeqClause>);
648 if (Itr != ExistingClauses.end()) {
649 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_cannot_combine)
652 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
662 : SemaRef(S), Ctx(S.getASTContext()), ExistingClauses(ExistingClauses) {}
666 bool diagNotImplemented() {
return NotImplemented; }
670#define VISIT_CLAUSE(CLAUSE_NAME) \
671 case OpenACCClauseKind::CLAUSE_NAME: \
672 return Visit##CLAUSE_NAME##Clause(Clause);
673#define CLAUSE_ALIAS(ALIAS, CLAUSE_NAME, DEPRECATED) \
674 case OpenACCClauseKind::ALIAS: \
676 SemaRef.Diag(Clause.getBeginLoc(), diag::warn_acc_deprecated_alias_name) \
677 << Clause.getClauseKind() << OpenACCClauseKind::CLAUSE_NAME; \
678 return Visit##CLAUSE_NAME##Clause(Clause);
679#include "clang/Basic/OpenACCClauses.def"
681 return isNotImplemented();
683 llvm_unreachable(
"Invalid clause kind");
686#define VISIT_CLAUSE(CLAUSE_NAME) \
687 OpenACCClause *Visit##CLAUSE_NAME##Clause( \
688 SemaOpenACC::OpenACCParsedClause &Clause);
689#include "clang/Basic/OpenACCClauses.def"
702 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
718 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
730 NewSizeExprs.push_back(Res.
get());
748 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
758 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCSelfClause>);
759 if (Itr != ExistingClauses.end()) {
761 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
775 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
786 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCIfClause>);
787 if (Itr != ExistingClauses.end()) {
789 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
801 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
828 auto *GangClauseItr =
829 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
830 auto *ReductionClauseItr =
831 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
833 if (GangClauseItr != ExistingClauses.end() &&
834 ReductionClauseItr != ExistingClauses.end()) {
836 diag::err_acc_gang_reduction_numgangs_conflict)
837 << OpenACCClauseKind::Reduction << OpenACCClauseKind::Gang
839 SemaRef.
Diag((*ReductionClauseItr)->getBeginLoc(),
840 diag::note_acc_previous_clause_here);
841 SemaRef.
Diag((*GangClauseItr)->getBeginLoc(),
842 diag::note_acc_previous_clause_here);
854 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
856 if (
Parallel != ExistingClauses.end()) {
858 diag::err_acc_reduction_num_gangs_conflict)
861 SemaRef.
Diag((*Parallel)->getBeginLoc(),
862 diag::note_acc_previous_clause_here);
871 auto GangClauses = llvm::make_filter_range(
872 ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
874 for (
auto *GC : GangClauses) {
875 if (cast<OpenACCGangClause>(GC)->hasExprOfKind(OpenACCGangKind::Num)) {
877 diag::err_acc_num_arg_conflict_reverse)
878 << OpenACCClauseKind::NumGangs << OpenACCClauseKind::Gang
880 SemaRef.
Diag(GC->getBeginLoc(), diag::note_acc_previous_clause_here);
891OpenACCClause *SemaOpenACCClauseVisitor::VisitNumWorkersClause(
896 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
903 auto WorkerClauses = llvm::make_filter_range(
904 ExistingClauses, llvm::IsaPred<OpenACCWorkerClause>);
906 for (
auto *WC : WorkerClauses) {
907 if (cast<OpenACCWorkerClause>(WC)->hasIntExpr()) {
909 diag::err_acc_num_arg_conflict_reverse)
910 << OpenACCClauseKind::NumWorkers << OpenACCClauseKind::Worker
912 SemaRef.
Diag(WC->getBeginLoc(), diag::note_acc_previous_clause_here);
919 "Invalid number of expressions for NumWorkers");
925OpenACCClause *SemaOpenACCClauseVisitor::VisitVectorLengthClause(
930 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
937 auto VectorClauses = llvm::make_filter_range(
938 ExistingClauses, llvm::IsaPred<OpenACCVectorClause>);
940 for (
auto *VC : VectorClauses) {
941 if (cast<OpenACCVectorClause>(VC)->hasIntExpr()) {
943 diag::err_acc_num_arg_conflict_reverse)
944 << OpenACCClauseKind::VectorLength << OpenACCClauseKind::Vector
946 SemaRef.
Diag(VC->getBeginLoc(), diag::note_acc_previous_clause_here);
953 "Invalid number of expressions for NumWorkers");
964 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
968 "Invalid number of expressions for Async");
975OpenACCClause *SemaOpenACCClauseVisitor::VisitDeviceNumClause(
980 return isNotImplemented();
985 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
989 "Invalid number of expressions for device_num");
995OpenACCClause *SemaOpenACCClauseVisitor::VisitDefaultAsyncClause(
999 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
1003 "Invalid number of expressions for default_async");
1020OpenACCClause *SemaOpenACCClauseVisitor::VisitFirstPrivateClause(
1031OpenACCClause *SemaOpenACCClauseVisitor::VisitNoCreateClause(
1049 return isNotImplemented();
1088 return isNotImplemented();
1105 return isNotImplemented();
1122 return isNotImplemented();
1148 llvm::erase_if(VarList, [&](
Expr *
E) {
1163 llvm::erase_if(VarList, [&](
Expr *
E) {
1183OpenACCClause *SemaOpenACCClauseVisitor::VisitUseDeviceClause(
1192OpenACCClause *SemaOpenACCClauseVisitor::VisitDevicePtrClause(
1199 return isNotImplemented();
1204 llvm::erase_if(VarList, [&](
Expr *
E) {
1222OpenACCClause *SemaOpenACCClauseVisitor::VisitDeviceTypeClause(
1226 return isNotImplemented();
1231 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
1248 llvm::find_if(ExistingClauses,
1249 llvm::IsaPred<OpenACCIndependentClause, OpenACCSeqClause>);
1250 if (Itr != ExistingClauses.end()) {
1253 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1261OpenACCClause *SemaOpenACCClauseVisitor::VisitIndependentClause(
1265 const auto *Itr = llvm::find_if(
1266 ExistingClauses, llvm::IsaPred<OpenACCAutoClause, OpenACCSeqClause>);
1267 if (Itr != ExistingClauses.end()) {
1270 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1279 if (isa<OpenACCAsteriskSizeExpr>(
E))
1281 return S.ActOnIntExpr(OpenACCDirectiveKind::Invalid, OpenACCClauseKind::Gang,
1286 return DK == OpenACCDirectiveKind::Loop &&
1287 AssocKind == OpenACCDirectiveKind::Invalid;
1291 return DK == OpenACCDirectiveKind::Loop &&
1292 AssocKind != OpenACCDirectiveKind::Invalid;
1299 << GK << CK << IsOrphanLoop(DK, AssocKind) << DK
1300 << HasAssocKind(DK, AssocKind) << AssocKind;
1307 << TagKind << CK << IsOrphanLoop(DK, AssocKind) << DK
1308 << HasAssocKind(DK, AssocKind) << AssocKind;
1316 case OpenACCGangKind::Static:
1317 return CheckGangStaticExpr(S,
E);
1318 case OpenACCGangKind::Num:
1322 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1323 case OpenACCGangKind::Dim: {
1331 S.ActOnIntExpr(OpenACCDirectiveKind::Invalid, OpenACCClauseKind::Gang,
1340 std::optional<llvm::APSInt> ICE =
1343 if (!ICE || *ICE <= 0 || ICE > 3) {
1345 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
1353 llvm_unreachable(
"Unknown gang kind in gang parallel check");
1365 case OpenACCGangKind::Dim:
1366 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1367 case OpenACCGangKind::Num: {
1379 : S.getActiveComputeConstructInfo().Clauses;
1382 llvm::find_if(Collection, llvm::IsaPred<OpenACCNumGangsClause>);
1384 if (Itr != Collection.end()) {
1386 <<
"num" << OpenACCClauseKind::Gang << DK
1387 << HasAssocKind(DK, AssocKind) << AssocKind
1388 << OpenACCClauseKind::NumGangs;
1390 S.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1395 case OpenACCGangKind::Static:
1396 return CheckGangStaticExpr(S,
E);
1399 llvm_unreachable(
"Unknown gang kind in gang kernels check");
1408 case OpenACCGangKind::Dim:
1409 case OpenACCGangKind::Num:
1410 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1411 case OpenACCGangKind::Static:
1412 return CheckGangStaticExpr(S,
E);
1414 llvm_unreachable(
"Unknown gang kind in gang serial check");
1419 if (DiagIfSeqClause(Clause))
1426 return isNotImplemented();
1433 case OpenACCDirectiveKind::Invalid:
1434 case OpenACCDirectiveKind::Parallel:
1437 case OpenACCDirectiveKind::Serial:
1440 DiagIntArgInvalid(SemaRef, IntExpr,
"length", OpenACCClauseKind::Vector,
1445 case OpenACCDirectiveKind::Kernels: {
1448 llvm::IsaPred<OpenACCVectorLengthClause>);
1451 <<
"length" << OpenACCClauseKind::Vector
1456 << OpenACCClauseKind::VectorLength;
1457 SemaRef.
Diag((*Itr)->getBeginLoc(),
1458 diag::note_acc_previous_clause_here);
1465 llvm_unreachable(
"Non compute construct in active compute construct");
1469 DiagIntArgInvalid(SemaRef, IntExpr,
"length", OpenACCClauseKind::Vector,
1474 OpenACCDirectiveKind::KernelsLoop) {
1475 const auto *Itr = llvm::find_if(
1476 ExistingClauses, llvm::IsaPred<OpenACCVectorLengthClause>);
1477 if (Itr != ExistingClauses.end()) {
1479 <<
"length" << OpenACCClauseKind::Vector
1484 << OpenACCClauseKind::VectorLength;
1485 SemaRef.
Diag((*Itr)->getBeginLoc(),
1486 diag::note_acc_previous_clause_here);
1501 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1502 << OpenACCClauseKind::Vector << OpenACCClauseKind::Vector
1505 diag::note_acc_previous_clause_here);
1517 if (DiagIfSeqClause(Clause))
1524 return isNotImplemented();
1532 case OpenACCDirectiveKind::Invalid:
1533 case OpenACCDirectiveKind::ParallelLoop:
1534 case OpenACCDirectiveKind::SerialLoop:
1535 case OpenACCDirectiveKind::Parallel:
1536 case OpenACCDirectiveKind::Serial:
1537 DiagIntArgInvalid(SemaRef, IntExpr, OpenACCGangKind::Num,
1542 case OpenACCDirectiveKind::KernelsLoop:
1543 case OpenACCDirectiveKind::Kernels: {
1546 llvm::IsaPred<OpenACCNumWorkersClause>);
1553 << OpenACCClauseKind::NumWorkers;
1554 SemaRef.
Diag((*Itr)->getBeginLoc(),
1555 diag::note_acc_previous_clause_here);
1562 llvm_unreachable(
"Non compute construct in active compute construct");
1567 DiagIntArgInvalid(SemaRef, IntExpr, OpenACCGangKind::Num,
1573 "Unknown combined directive kind?");
1574 const auto *Itr = llvm::find_if(ExistingClauses,
1575 llvm::IsaPred<OpenACCNumWorkersClause>);
1576 if (Itr != ExistingClauses.end()) {
1582 << OpenACCClauseKind::NumWorkers;
1583 SemaRef.
Diag((*Itr)->getBeginLoc(),
1584 diag::note_acc_previous_clause_here);
1599 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1600 << OpenACCClauseKind::Worker << OpenACCClauseKind::Worker
1603 diag::note_acc_previous_clause_here);
1613 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1614 << OpenACCClauseKind::Worker << OpenACCClauseKind::Vector
1617 diag::note_acc_previous_clause_here);
1629 if (DiagIfSeqClause(Clause))
1636 return isNotImplemented();
1643 OpenACCDirectiveKind::Invalid) ||
1646 auto ActiveComputeConstructContainer =
1650 auto *NumGangsClauseItr = llvm::find_if(
1651 ActiveComputeConstructContainer, llvm::IsaPred<OpenACCNumGangsClause>);
1653 if (NumGangsClauseItr != ActiveComputeConstructContainer.end() &&
1654 cast<OpenACCNumGangsClause>(*NumGangsClauseItr)->getIntExprs().size() >
1656 auto *ReductionClauseItr =
1657 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
1659 if (ReductionClauseItr != ExistingClauses.end()) {
1661 diag::err_acc_gang_reduction_numgangs_conflict)
1662 << OpenACCClauseKind::Gang << OpenACCClauseKind::Reduction
1665 SemaRef.
Diag((*ReductionClauseItr)->getBeginLoc(),
1666 diag::note_acc_previous_clause_here);
1667 SemaRef.
Diag((*NumGangsClauseItr)->getBeginLoc(),
1668 diag::note_acc_previous_clause_here);
1681 for (
unsigned I = 0; I < Clause.
getIntExprs().size(); ++I) {
1692 if (ExistingElemLoc[
static_cast<unsigned>(GK)].isValid()) {
1694 <<
static_cast<unsigned>(GK);
1695 SemaRef.
Diag(ExistingElemLoc[
static_cast<unsigned>(GK)],
1696 diag::note_acc_previous_expr_here);
1700 ExistingElemLoc[
static_cast<unsigned>(GK)] = ER.
get()->
getBeginLoc();
1701 GangKinds.push_back(GK);
1702 IntExprs.push_back(ER.
get());
1713 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1714 << OpenACCClauseKind::Gang << OpenACCClauseKind::Gang
1718 diag::note_acc_previous_clause_here);
1728 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1729 << OpenACCClauseKind::Gang << OpenACCClauseKind::Worker
1732 diag::note_acc_previous_clause_here);
1742 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1743 << OpenACCClauseKind::Gang << OpenACCClauseKind::Vector
1746 diag::note_acc_previous_clause_here);
1753 GangKinds, IntExprs, Clause.
getEndLoc());
1756OpenACCClause *SemaOpenACCClauseVisitor::VisitFinalizeClause(
1764OpenACCClause *SemaOpenACCClauseVisitor::VisitIfPresentClause(
1778 return isNotImplemented();
1783 llvm::find_if(ExistingClauses,
1784 llvm::IsaPred<OpenACCAutoClause, OpenACCIndependentClause>);
1785 if (Itr != ExistingClauses.end()) {
1788 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1795 Itr = llvm::find_if(ExistingClauses,
1799 if (Itr != ExistingClauses.end()) {
1800 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_cannot_combine)
1803 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1811OpenACCClause *SemaOpenACCClauseVisitor::VisitReductionClause(
1818 OpenACCDirectiveKind::Invalid) ||
1821 auto ActiveComputeConstructContainer =
1825 auto *NumGangsClauseItr = llvm::find_if(
1826 ActiveComputeConstructContainer, llvm::IsaPred<OpenACCNumGangsClause>);
1828 if (NumGangsClauseItr != ActiveComputeConstructContainer.end() &&
1829 cast<OpenACCNumGangsClause>(*NumGangsClauseItr)->getIntExprs().size() >
1831 auto *GangClauseItr =
1832 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
1834 if (GangClauseItr != ExistingClauses.end()) {
1836 diag::err_acc_gang_reduction_numgangs_conflict)
1837 << OpenACCClauseKind::Reduction << OpenACCClauseKind::Gang
1840 SemaRef.
Diag((*GangClauseItr)->getBeginLoc(),
1841 diag::note_acc_previous_clause_here);
1842 SemaRef.
Diag((*NumGangsClauseItr)->getBeginLoc(),
1843 diag::note_acc_previous_clause_here);
1871 auto NumGangsClauses = llvm::make_filter_range(
1872 ExistingClauses, llvm::IsaPred<OpenACCNumGangsClause>);
1874 for (
auto *NGC : NumGangsClauses) {
1876 cast<OpenACCNumGangsClause>(NGC)->getIntExprs().size();
1880 diag::err_acc_reduction_num_gangs_conflict)
1883 SemaRef.
Diag(NGC->getBeginLoc(), diag::note_acc_previous_clause_here);
1896 ValidVars.push_back(Res.
get());
1905OpenACCClause *SemaOpenACCClauseVisitor::VisitCollapseClause(
1912 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
1925void CollectActiveReductionClauses(
1928 for (
auto *CurClause : CurClauses) {
1929 if (
auto *RedClause = dyn_cast<OpenACCReductionClause>(CurClause);
1930 RedClause && !RedClause->getVarList().empty())
1931 ActiveClauses.push_back(RedClause);
1939 case OpenACCDirectiveKind::Parallel:
1940 case OpenACCDirectiveKind::ParallelLoop:
1941 case OpenACCDirectiveKind::Serial:
1942 case OpenACCDirectiveKind::SerialLoop:
1943 case OpenACCDirectiveKind::Kernels:
1944 case OpenACCDirectiveKind::KernelsLoop:
1945 case OpenACCDirectiveKind::Loop:
1947 case OpenACCDirectiveKind::Data:
1948 case OpenACCDirectiveKind::HostData:
1950 case OpenACCDirectiveKind::EnterData:
1951 case OpenACCDirectiveKind::ExitData:
1952 case OpenACCDirectiveKind::Wait:
1953 case OpenACCDirectiveKind::Init:
1954 case OpenACCDirectiveKind::Shutdown:
1955 case OpenACCDirectiveKind::Set:
1956 case OpenACCDirectiveKind::Update:
1957 llvm_unreachable(
"Doesn't have an associated stmt");
1959 case OpenACCDirectiveKind::Invalid:
1960 llvm_unreachable(
"Unhandled directive kind?");
1962 llvm_unreachable(
"Unhandled directive kind?");
1973 : SemaRef(S), OldActiveComputeConstructInfo(S.ActiveComputeConstructInfo),
1974 DirKind(DK), OldLoopGangClauseOnKernel(S.LoopGangClauseOnKernel),
1975 OldLoopWorkerClauseLoc(S.LoopWorkerClauseLoc),
1976 OldLoopVectorClauseLoc(S.LoopVectorClauseLoc),
1977 OldLoopWithoutSeqInfo(S.LoopWithoutSeqInfo),
1978 ActiveReductionClauses(S.ActiveReductionClauses),
1979 LoopRAII(SemaRef, PreserveLoopRAIIDepthInAssociatedStmtRAII(DirKind)) {
1985 CollectActiveReductionClauses(S.ActiveReductionClauses, Clauses);
1986 SemaRef.ActiveComputeConstructInfo.Kind = DirKind;
1987 SemaRef.ActiveComputeConstructInfo.Clauses = Clauses;
2002 SemaRef.ActiveComputeConstructInfo.Kind = DirKind;
2003 SemaRef.ActiveComputeConstructInfo.Clauses = Clauses;
2005 CollectActiveReductionClauses(S.ActiveReductionClauses, Clauses);
2016 if (Clauses.end() ==
2017 llvm::find_if(Clauses, llvm::IsaPred<OpenACCSeqClause>))
2030 auto *Itr = llvm::find_if(Clauses, llvm::IsaPred<OpenACCGangClause>);
2031 if (Itr != Clauses.end())
2035 if (UnInstClauses.empty()) {
2036 auto *Itr = llvm::find_if(Clauses, llvm::IsaPred<OpenACCWorkerClause>);
2037 if (Itr != Clauses.end())
2040 auto *Itr2 = llvm::find_if(Clauses, llvm::IsaPred<OpenACCVectorClause>);
2041 if (Itr2 != Clauses.end())
2045 CollectActiveReductionClauses(S.ActiveReductionClauses, Clauses);
2052 if (Clauses.end() ==
2053 llvm::find_if(Clauses, llvm::IsaPred<OpenACCSeqClause>))
2066 UnInstClauses.empty()) {
2068 auto *Itr = llvm::find_if(Clauses, llvm::IsaPred<OpenACCGangClause>);
2069 if (Itr != Clauses.end())
2074 if (UnInstClauses.empty()) {
2075 auto *Itr = llvm::find_if(Clauses, llvm::IsaPred<OpenACCWorkerClause>);
2076 if (Itr != Clauses.end())
2079 auto *Itr2 = llvm::find_if(Clauses, llvm::IsaPred<OpenACCVectorClause>);
2080 if (Itr2 != Clauses.end())
2091 SemaRef.LoopInfo.CurLevelHasLoopAlready =
false;
2092 SemaRef.CollapseInfo.CollapseDepthSatisfied =
true;
2093 SemaRef.TileInfo.TileDepthSatisfied =
true;
2100 auto *CollapseClauseItr =
2101 llvm::find_if(Clauses, llvm::IsaPred<OpenACCCollapseClause>);
2102 auto *UnInstCollapseClauseItr =
2103 llvm::find_if(UnInstClauses, llvm::IsaPred<OpenACCCollapseClause>);
2105 if (Clauses.end() == CollapseClauseItr)
2109 cast<OpenACCCollapseClause>(*CollapseClauseItr);
2111 SemaRef.CollapseInfo.ActiveCollapse = CollapseClause;
2121 if (UnInstCollapseClauseItr != UnInstClauses.end() &&
2122 !cast<OpenACCCollapseClause>(*UnInstCollapseClauseItr)
2124 ->isInstantiationDependent())
2127 SemaRef.CollapseInfo.CollapseDepthSatisfied =
false;
2128 SemaRef.CollapseInfo.CurCollapseCount =
2129 cast<ConstantExpr>(LoopCount)->getResultAsAPSInt();
2130 SemaRef.CollapseInfo.DirectiveKind = DirKind;
2139 if (UnInstClauses.size() > 0)
2141 auto *TileClauseItr =
2142 llvm::find_if(Clauses, llvm::IsaPred<OpenACCTileClause>);
2144 if (Clauses.end() == TileClauseItr)
2148 SemaRef.TileInfo.ActiveTile = TileClause;
2149 SemaRef.TileInfo.TileDepthSatisfied =
false;
2151 SemaRef.TileInfo.DirectiveKind = DirKind;
2162 SemaRef.ActiveComputeConstructInfo = OldActiveComputeConstructInfo;
2163 SemaRef.LoopGangClauseOnKernel = OldLoopGangClauseOnKernel;
2164 SemaRef.LoopWorkerClauseLoc = OldLoopWorkerClauseLoc;
2165 SemaRef.LoopVectorClauseLoc = OldLoopVectorClauseLoc;
2166 SemaRef.LoopWithoutSeqInfo = OldLoopWithoutSeqInfo;
2167 SemaRef.ActiveReductionClauses.swap(ActiveReductionClauses);
2189 if (
const auto *DevTypeClause =
2190 llvm::find_if(ExistingClauses,
2192 return isa<OpenACCDeviceTypeClause>(
C);
2194 DevTypeClause != ExistingClauses.end()) {
2195 if (checkValidAfterDeviceType(
2196 *
this, *cast<OpenACCDeviceTypeClause>(*DevTypeClause), Clause))
2200 SemaOpenACCClauseVisitor Visitor{*
this, ExistingClauses};
2203 "Created wrong clause?");
2205 if (Visitor.diagNotImplemented())
2216bool areVarsEqual(
Expr *VarExpr1,
Expr *VarExpr2) {
2228 if (isa<ArraySectionExpr>(VarExpr1)) {
2229 auto *Expr2AS = dyn_cast<ArraySectionExpr>(VarExpr2);
2233 auto *Expr1AS = cast<ArraySectionExpr>(VarExpr1);
2235 if (!areVarsEqual(Expr1AS->getBase(), Expr2AS->getBase()))
2243 if (isa<ArraySubscriptExpr>(VarExpr1)) {
2244 auto *Expr2AS = dyn_cast<ArraySubscriptExpr>(VarExpr2);
2248 auto *Expr1AS = cast<ArraySubscriptExpr>(VarExpr1);
2250 if (!areVarsEqual(Expr1AS->getBase(), Expr2AS->getBase()))
2260 if (isa<DeclRefExpr>(VarExpr1)) {
2261 auto *Expr2DRE = dyn_cast<DeclRefExpr>(VarExpr2);
2265 auto *Expr1DRE = cast<DeclRefExpr>(VarExpr1);
2267 return Expr1DRE->getDecl()->getMostRecentDecl() ==
2268 Expr2DRE->getDecl()->getMostRecentDecl();
2271 llvm_unreachable(
"Unknown variable type encountered");
2287 auto TypeIsValid = [](
QualType Ty) {
2288 return Ty->isDependentType() || Ty->isScalarType();
2291 if (isa<ArraySectionExpr>(VarExpr)) {
2292 Expr *ASExpr = VarExpr;
2296 if (!TypeIsValid(EltTy)) {
2302 if (!RD->isStruct() && !RD->isClass()) {
2303 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2308 if (!RD->isCompleteDefinition()) {
2309 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2313 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD);
2314 CXXRD && !CXXRD->isAggregate()) {
2315 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2321 if (!TypeIsValid(FD->getType())) {
2323 diag::err_acc_reduction_composite_member_type);
2324 Diag(FD->getLocation(), diag::note_acc_reduction_composite_member_loc);
2328 }
else if (!TypeIsValid(VarExpr->
getType())) {
2339 if (RClause->getReductionOp() == ReductionOp)
2342 for (
Expr *OldVarExpr : RClause->getVarList()) {
2343 if (OldVarExpr->isInstantiationDependent())
2346 if (areVarsEqual(VarExpr, OldVarExpr)) {
2348 << ReductionOp << RClause->getReductionOp();
2349 Diag(OldVarExpr->getExprLoc(), diag::note_acc_previous_clause_here);
2395 Diag(DirLoc, diag::warn_acc_construct_unimplemented) << K;
2410 "Only one of directive or clause kind should be provided");
2419 unsigned getDiagKind()
const {
2420 if (ClauseKind != OpenACCClauseKind::Invalid)
2422 if (DirectiveKind != OpenACCDirectiveKind::Invalid)
2430 : ICEConvertDiagnoser(
false,
2433 DirectiveKind(DK), ClauseKind(CK), IntExpr(IntExpr) {}
2442 return S.
Diag(
Loc, diag::err_acc_int_expr_requires_integer)
2443 << getDiagKind() << ClauseKind << DirectiveKind <<
T;
2448 return S.
Diag(
Loc, diag::err_acc_int_expr_incomplete_class_type)
2455 return S.
Diag(
Loc, diag::err_acc_int_expr_explicit_conversion)
2462 return S.
Diag(Conv->
getLocation(), diag::note_acc_int_expr_conversion)
2468 return S.
Diag(
Loc, diag::err_acc_int_expr_multiple_conversions) <<
T;
2473 return S.
Diag(Conv->
getLocation(), diag::note_acc_int_expr_conversion)
2480 llvm_unreachable(
"conversion functions are permitted");
2482 } IntExprDiagnoser(DK, CK, IntExpr);
2488 Loc, IntExpr, IntExprDiagnoser);
2492 IntExpr = IntExprResult.
get();
2514 Diag(VarExpr->
getExprLoc(), diag::note_acc_expected_pointer_var);
2526 return Diag(VarExpr->
getExprLoc(), diag::err_acc_var_not_pointer_type)
2527 << ClauseKind << Ty;
2538 isa<ArraySectionExpr, ArraySubscriptExpr>(CurVarExpr)) {
2539 Diag(VarExpr->
getExprLoc(), diag::err_acc_not_a_var_ref_use_device);
2545 while (isa<ArraySectionExpr, ArraySubscriptExpr>(CurVarExpr)) {
2546 if (
auto *SubScrpt = dyn_cast<ArraySubscriptExpr>(CurVarExpr))
2554 if (
const auto *DRE = dyn_cast<DeclRefExpr>(CurVarExpr)) {
2555 if (isa<VarDecl, NonTypeTemplateParmDecl>(
2556 DRE->getFoundDecl()->getCanonicalDecl()))
2568 if (
const auto *ME = dyn_cast<MemberExpr>(CurVarExpr)) {
2569 if (isa<FieldDecl>(ME->getMemberDecl()->getCanonicalDecl()))
2581 if (isa<DependentScopeDeclRefExpr>(CurVarExpr) ||
2583 isa<CXXDependentScopeMemberExpr>(CurVarExpr)))
2588 if (isa<RecoveryExpr>(CurVarExpr))
2592 Diag(VarExpr->
getExprLoc(), diag::err_acc_not_a_var_ref_use_device);
2607 if (
Base->hasPlaceholderType() &&
2608 !
Base->hasPlaceholderType(BuiltinType::ArraySection)) {
2621 LowerBound =
Result.get();
2623 if (Length && Length->getType()->isNonOverloadPlaceholderType()) {
2637 if (!
Base->isTypeDependent()) {
2644 Diag(
Base->getExprLoc(), diag::err_acc_typecheck_subarray_value)
2645 <<
Base->getSourceRange());
2649 Diag(
Base->getExprLoc(), diag::err_acc_subarray_function_type)
2650 << ResultTy <<
Base->getSourceRange();
2655 diag::err_acc_subarray_incomplete_type,
2659 if (!
Base->hasPlaceholderType(BuiltinType::ArraySection)) {
2670 return Recovery.
isUsable() ? Recovery.
get() :
nullptr;
2685 if (Length && !Length->isTypeDependent()) {
2688 Length->getExprLoc(), Length);
2697 if (!Length && (OriginalBaseTy.
isNull() ||
2702 Diag(ColonLoc, diag::err_acc_subarray_no_length) << IsArray;
2707 Length = Recovery.
isUsable() ? Recovery.
get() :
nullptr;
2718 std::optional<llvm::APSInt> BaseSize;
2721 BaseSize = ArrayTy->
getSize();
2724 auto GetBoundValue = [&](
Expr *
E) -> std::optional<llvm::APSInt> {
2726 return std::nullopt;
2730 return std::nullopt;
2734 std::optional<llvm::APSInt> LowerBoundValue = GetBoundValue(LowerBound);
2735 std::optional<llvm::APSInt> LengthValue = GetBoundValue(Length);
2738 if (LowerBoundValue.has_value()) {
2739 if (LowerBoundValue->isNegative()) {
2741 << 0 <<
toString(*LowerBoundValue, 10);
2742 LowerBoundValue.reset();
2743 LowerBound = GetRecovery(LowerBound, LowerBound->
getType());
2744 }
else if (BaseSize.has_value() &&
2745 llvm::APSInt::compareValues(*LowerBoundValue, *BaseSize) >= 0) {
2747 Diag(LowerBound->
getExprLoc(), diag::err_acc_subarray_out_of_range)
2748 << 0 <<
toString(*LowerBoundValue, 10)
2750 LowerBoundValue.reset();
2751 LowerBound = GetRecovery(LowerBound, LowerBound->
getType());
2756 if (LengthValue.has_value()) {
2757 if (LengthValue->isNegative()) {
2758 Diag(Length->getExprLoc(), diag::err_acc_subarray_negative)
2759 << 1 <<
toString(*LengthValue, 10);
2760 LengthValue.reset();
2761 Length = GetRecovery(Length, Length->getType());
2762 }
else if (BaseSize.has_value() &&
2763 llvm::APSInt::compareValues(*LengthValue, *BaseSize) > 0) {
2765 Diag(Length->getExprLoc(), diag::err_acc_subarray_out_of_range)
2768 LengthValue.reset();
2769 Length = GetRecovery(Length, Length->getType());
2774 auto AddAPSInt = [](llvm::APSInt LHS, llvm::APSInt RHS) -> llvm::APSInt {
2775 if (LHS.isSigned() == RHS.isSigned())
2778 unsigned Width = std::max(LHS.getBitWidth(), RHS.getBitWidth()) + 1;
2779 return llvm::APSInt(LHS.sext(Width) + RHS.sext(Width),
true);
2784 if (BaseSize.has_value() && LowerBoundValue.has_value() &&
2785 LengthValue.has_value() &&
2786 llvm::APSInt::compareValues(AddAPSInt(*LowerBoundValue, *LengthValue),
2789 diag::err_acc_subarray_base_plus_length_out_of_range)
2794 LowerBoundValue.reset();
2795 LowerBound = GetRecovery(LowerBound, LowerBound->
getType());
2796 LengthValue.reset();
2797 Length = GetRecovery(Length, Length->getType());
2802 if (
Base->isTypeDependent() ||
2804 (Length && Length->isInstantiationDependent()))
2807 return new (Context)
2818 "Loop argument non integer?");
2824 std::optional<llvm::APSInt> ICE =
2830 if (!ICE || *ICE <= 0) {
2832 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
2850 return CheckGangParallelExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2853 return CheckGangSerialExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2856 return CheckGangKernelsExpr(*
this, ExistingClauses, DK,
2857 ActiveComputeConstructInfo.Kind, GK,
E);
2859 switch (ActiveComputeConstructInfo.Kind) {
2863 return CheckGangParallelExpr(*
this, DK, ActiveComputeConstructInfo.Kind,
2867 return CheckGangSerialExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2871 return CheckGangKernelsExpr(*
this, ExistingClauses, DK,
2872 ActiveComputeConstructInfo.Kind, GK,
E);
2874 llvm_unreachable(
"Non compute construct in active compute construct?");
2879 llvm_unreachable(
"Invalid directive kind for a Gang clause");
2881 llvm_unreachable(
"Compute construct directive not handled?");
2893 const auto *ReductionItr =
2894 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
2896 if (ReductionItr != ExistingClauses.end()) {
2897 const auto GangZip = llvm::zip_equal(GangKinds, IntExprs);
2898 const auto GangItr = llvm::find_if(GangZip, [](
const auto &Tuple) {
2902 if (GangItr != GangZip.end()) {
2903 const Expr *DimExpr = std::get<1>(*GangItr);
2907 "Improperly formed gang argument");
2908 if (
const auto *DimVal = dyn_cast<ConstantExpr>(DimExpr);
2909 DimVal && DimVal->getResultAsAPSInt() > 1) {
2910 Diag(DimVal->getBeginLoc(), diag::err_acc_gang_reduction_conflict)
2912 Diag((*ReductionItr)->getBeginLoc(),
2913 diag::note_acc_previous_clause_here);
2920 GangKinds, IntExprs, EndLoc);
2933 const auto GangClauses = llvm::make_filter_range(
2934 ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
2936 for (
auto *GC : GangClauses) {
2937 const auto *GangClause = cast<OpenACCGangClause>(GC);
2938 for (
unsigned I = 0; I < GangClause->getNumExprs(); ++I) {
2939 std::pair<OpenACCGangKind, const Expr *> EPair = GangClause->getExpr(I);
2943 if (
const auto *DimVal = dyn_cast<ConstantExpr>(EPair.second);
2944 DimVal && DimVal->getResultAsAPSInt() > 1) {
2945 Diag(BeginLoc, diag::err_acc_gang_reduction_conflict)
2946 << 1 << DirectiveKind;
2947 Diag(GangClause->getBeginLoc(), diag::note_acc_previous_clause_here);
2955 getASTContext(), BeginLoc, LParenLoc, ReductionOp, Vars, EndLoc);
2965 "size argument non integer?");
2969 isa<OpenACCAsteriskSizeExpr>(SizeExpr))
2972 std::optional<llvm::APSInt> ICE =
2977 if (!ICE || *ICE <= 0) {
2979 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
2991 if (!LoopInfo.TopLevelLoopSeen)
2994 if (CollapseInfo.CurCollapseCount && *CollapseInfo.CurCollapseCount > 0) {
2995 Diag(WhileLoc, diag::err_acc_invalid_in_loop)
2996 << 1 << CollapseInfo.DirectiveKind
2998 assert(CollapseInfo.ActiveCollapse &&
"Collapse count without object?");
2999 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3000 diag::note_acc_active_clause_here)
3005 CollapseInfo.CurCollapseCount = std::nullopt;
3008 if (TileInfo.CurTileCount && *TileInfo.CurTileCount > 0) {
3009 Diag(WhileLoc, diag::err_acc_invalid_in_loop)
3010 << 1 << TileInfo.DirectiveKind
3012 assert(TileInfo.ActiveTile &&
"tile count without object?");
3013 Diag(TileInfo.ActiveTile->getBeginLoc(), diag::note_acc_active_clause_here)
3018 TileInfo.CurTileCount = std::nullopt;
3026 if (!LoopInfo.TopLevelLoopSeen)
3029 if (CollapseInfo.CurCollapseCount && *CollapseInfo.CurCollapseCount > 0) {
3030 Diag(DoLoc, diag::err_acc_invalid_in_loop)
3031 << 2 << CollapseInfo.DirectiveKind
3033 assert(CollapseInfo.ActiveCollapse &&
"Collapse count without object?");
3034 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3035 diag::note_acc_active_clause_here)
3040 CollapseInfo.CurCollapseCount = std::nullopt;
3043 if (TileInfo.CurTileCount && *TileInfo.CurTileCount > 0) {
3044 Diag(DoLoc, diag::err_acc_invalid_in_loop)
3046 assert(TileInfo.ActiveTile &&
"tile count without object?");
3047 Diag(TileInfo.ActiveTile->getBeginLoc(), diag::note_acc_active_clause_here)
3052 TileInfo.CurTileCount = std::nullopt;
3057 ForStmtBeginChecker &
C) {
3058 assert(
getLangOpts().OpenACC &&
"Check enabled when not OpenACC?");
3061 LoopInfo.TopLevelLoopSeen =
true;
3063 if (CollapseInfo.CurCollapseCount && *CollapseInfo.CurCollapseCount > 0) {
3071 if (LoopInfo.CurLevelHasLoopAlready) {
3072 Diag(ForLoc, diag::err_acc_clause_multiple_loops)
3074 assert(CollapseInfo.ActiveCollapse &&
"No collapse object?");
3075 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3076 diag::note_acc_active_clause_here)
3079 --(*CollapseInfo.CurCollapseCount);
3083 if (*CollapseInfo.CurCollapseCount == 0)
3084 CollapseInfo.CollapseDepthSatisfied =
true;
3088 if (TileInfo.CurTileCount && *TileInfo.CurTileCount > 0) {
3091 if (LoopInfo.CurLevelHasLoopAlready) {
3092 Diag(ForLoc, diag::err_acc_clause_multiple_loops)
3094 assert(TileInfo.ActiveTile &&
"No tile object?");
3095 Diag(TileInfo.ActiveTile->getBeginLoc(),
3096 diag::note_acc_active_clause_here)
3099 --(*TileInfo.CurTileCount);
3102 if (*TileInfo.CurTileCount == 0)
3103 TileInfo.TileDepthSatisfied =
true;
3109 LoopInfo.CurLevelHasLoopAlready =
false;
3113bool isValidLoopVariableType(
QualType LoopVarTy) {
3136 for (
const auto *TD :
3137 llvm::make_filter_range(RD->decls(), llvm::IsaPred<TypedefNameDecl>)) {
3138 const auto *TDND = cast<TypedefNameDecl>(TD)->getCanonicalDecl();
3140 if (TDND->getName() !=
"iterator_category")
3144 if (TDND->getUnderlyingType().isNull())
3148 TDND->getUnderlyingType()->getAsCXXRecordDecl();
3151 if (!ItrCategoryDecl)
3154 auto IsRandomAccessIteratorTag = [](
const CXXRecordDecl *RD) {
3155 if (RD->getName() !=
"random_access_iterator_tag")
3161 if (IsRandomAccessIteratorTag(ItrCategoryDecl))
3168 if (IsRandomAccessIteratorTag(BS.getType()->getAsCXXRecordDecl()))
3181void SemaOpenACC::ForStmtBeginChecker::check() {
3187 AlreadyChecked =
true;
3207 if (!RangeFor.has_value())
3211 const DeclStmt *RangeStmt = (*RangeFor)->getBeginStmt();
3220 if (!isValidLoopVariableType(VarType)) {
3222 <<
SemaRef.LoopWithoutSeqInfo.Kind << VarType;
3224 diag::note_acc_construct_here)
3225 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3234 if (Cond.has_value())
3236 if (
Inc.has_value())
3239const ValueDecl *SemaOpenACC::ForStmtBeginChecker::checkInit() {
3243 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3245 diag::note_acc_construct_here)
3246 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3251 auto DiagLoopVar = [&]() {
3254 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3256 diag::note_acc_construct_here)
3257 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3262 if (
const auto *ExprTemp = dyn_cast<ExprWithCleanups>(
Init))
3263 Init = ExprTemp->getSubExpr();
3264 if (
const auto *
E = dyn_cast<Expr>(
Init))
3269 if (
const auto *BO = dyn_cast<BinaryOperator>(
Init)) {
3272 if (!BO->isAssignmentOp())
3273 return DiagLoopVar();
3277 if (
const auto *DRE = dyn_cast<DeclRefExpr>(LHS))
3278 InitVar = DRE->getDecl();
3279 }
else if (
const auto *DS = dyn_cast<DeclStmt>(
Init)) {
3281 if (!DS->isSingleDecl())
3282 return DiagLoopVar();
3284 InitVar = dyn_cast<ValueDecl>(DS->getSingleDecl());
3289 if (!isa<VarDecl>(InitVar))
3290 return DiagLoopVar();
3294 !cast<VarDecl>(InitVar)->hasInit())
3295 return DiagLoopVar();
3297 }
else if (
auto *CE = dyn_cast<CXXOperatorCallExpr>(
Init)) {
3299 if (CE->getOperator() != OO_Equal)
3300 return DiagLoopVar();
3304 if (
auto *DRE = dyn_cast<DeclRefExpr>(LHS)) {
3305 InitVar = DRE->getDecl();
3306 }
else if (
auto *ME = dyn_cast<MemberExpr>(LHS)) {
3307 if (isa<CXXThisExpr>(ME->getBase()->IgnoreParenImpCasts()))
3308 InitVar = ME->getMemberDecl();
3313 return DiagLoopVar();
3319 if (!isValidLoopVariableType(VarType)) {
3322 <<
SemaRef.LoopWithoutSeqInfo.Kind << VarType;
3324 diag::note_acc_construct_here)
3325 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3332void SemaOpenACC::ForStmtBeginChecker::checkCond() {
3334 SemaRef.
Diag(ForLoc, diag::err_acc_loop_terminating_condition)
3335 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3337 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3346void SemaOpenACC::ForStmtBeginChecker::checkInc(
const ValueDecl *
Init) {
3349 SemaRef.
Diag(ForLoc, diag::err_acc_loop_not_monotonic)
3350 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3352 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3355 auto DiagIncVar = [
this] {
3356 SemaRef.
Diag((*Inc)->getBeginLoc(), diag::err_acc_loop_not_monotonic)
3357 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3359 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3363 if (
const auto *ExprTemp = dyn_cast<ExprWithCleanups>(*Inc))
3364 Inc = ExprTemp->getSubExpr();
3365 if (
const auto *
E = dyn_cast<Expr>(*Inc))
3370 if (
const auto *FE = dyn_cast<FullExpr>(
E))
3371 E = FE->getSubExpr();
3377 if (
const auto *DRE = dyn_cast<DeclRefExpr>(
E))
3378 return dyn_cast<ValueDecl>(DRE->getDecl());
3380 if (
const auto *ME = dyn_cast<MemberExpr>(
E))
3381 if (isa<CXXThisExpr>(ME->getBase()->IgnoreParenImpCasts()))
3382 return ME->getMemberDecl();
3390 if (
const auto *UO = dyn_cast<UnaryOperator>(*Inc)) {
3392 if (!UO->isIncrementDecrementOp())
3393 return DiagIncVar();
3395 }
else if (
const auto *BO = dyn_cast<BinaryOperator>(*Inc)) {
3396 switch (BO->getOpcode()) {
3398 return DiagIncVar();
3412 }
else if (
const auto *CE = dyn_cast<CXXOperatorCallExpr>(*Inc)) {
3413 switch (CE->getOperator()) {
3415 return DiagIncVar();
3433 }
else if (
const auto *ME = dyn_cast<CXXMemberCallExpr>(*Inc)) {
3440 return DiagIncVar();
3446 return DiagIncVar();
3453 const Stmt *Second,
const Stmt *OldThird,
3454 const Stmt *Third) {
3458 std::optional<const Stmt *> S;
3459 if (OldSecond == Second)
3463 std::optional<const Stmt *>
T;
3464 if (OldThird == Third)
3469 bool InitChanged =
false;
3470 if (OldFirst !=
First) {
3478 if (
const auto *DS = dyn_cast<DeclStmt>(OldFirst))
3479 if (
const VarDecl *VD = dyn_cast_if_present<VarDecl>(
3480 DS->isSingleDecl() ? DS->getSingleDecl() :
nullptr))
3481 OldVDTy = VD->getType();
3482 if (
const auto *DS = dyn_cast<DeclStmt>(
First))
3483 if (
const VarDecl *VD = dyn_cast_if_present<VarDecl>(
3484 DS->isSingleDecl() ? DS->getSingleDecl() :
nullptr))
3485 NewVDTy = VD->getType();
3492 ForStmtBeginChecker FSBC{*
this, ForLoc,
First, InitChanged, S,
T};
3493 if (!LoopInfo.TopLevelLoopSeen) {
3497 ForStmtBeginHelper(ForLoc, FSBC);
3501 const Stmt *Second,
const Stmt *Third) {
3505 ForStmtBeginChecker FSBC{*
this, ForLoc,
First,
true,
3507 if (!LoopInfo.TopLevelLoopSeen) {
3511 ForStmtBeginHelper(ForLoc, FSBC);
3515 const Stmt *OldRangeFor,
3516 const Stmt *RangeFor) {
3520 std::optional<const CXXForRangeStmt *> RF;
3522 if (OldRangeFor == RangeFor)
3525 RF = cast<CXXForRangeStmt>(RangeFor);
3527 ForStmtBeginChecker FSBC{*
this, ForLoc, RF};
3528 if (!LoopInfo.TopLevelLoopSeen) {
3531 ForStmtBeginHelper(ForLoc, FSBC);
3535 const Stmt *RangeFor) {
3539 ForStmtBeginChecker FSBC{*
this, ForLoc, cast<CXXForRangeStmt>(RangeFor)};
3540 if (!LoopInfo.TopLevelLoopSeen) {
3543 ForStmtBeginHelper(ForLoc, FSBC);
3553 isa<ForStmt, NullStmt, ForStmt, CXXForRangeStmt, WhileStmt, DoStmt>(
3558 if (isa<OpenACCConstructStmt>(CurStmt))
3563 if (
const auto *CS = dyn_cast<CompoundStmt>(CurStmt)) {
3564 for (
const auto *ChildStmt : CS->children()) {
3565 SourceLocation ChildStmtLoc = FindInterveningCodeInLoop(ChildStmt);
3567 return ChildStmtLoc;
3581 LoopInfo.CurLevelHasLoopAlready =
true;
3586 bool IsActiveCollapse = CollapseInfo.CurCollapseCount &&
3587 *CollapseInfo.CurCollapseCount > 0 &&
3588 !CollapseInfo.ActiveCollapse->hasForce();
3589 bool IsActiveTile = TileInfo.CurTileCount && *TileInfo.CurTileCount > 0;
3591 if (IsActiveCollapse || IsActiveTile) {
3594 if (OtherStmtLoc.
isValid() && IsActiveCollapse) {
3595 Diag(OtherStmtLoc, diag::err_acc_intervening_code)
3597 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3598 diag::note_acc_active_clause_here)
3602 if (OtherStmtLoc.
isValid() && IsActiveTile) {
3603 Diag(OtherStmtLoc, diag::err_acc_intervening_code)
3605 Diag(TileInfo.ActiveTile->getBeginLoc(),
3606 diag::note_acc_active_clause_here)
3616 assert(!Clauses.empty() &&
"empty clause list not supported");
3619 llvm::raw_string_ostream OS{Output};
3621 if (Clauses.size() == 1) {
3622 OS <<
'\'' << Clauses[0] <<
'\'';
3631 [&] { OS <<
", "; });
3633 OS <<
" or \'" << Clauses.back() <<
'\'';
3649 if (CollapseInfo.CurCollapseCount && *CollapseInfo.CurCollapseCount > 0) {
3650 Diag(StartLoc, diag::err_acc_invalid_in_loop)
3651 << 0 << CollapseInfo.DirectiveKind
3653 assert(CollapseInfo.ActiveCollapse &&
"Collapse count without object?");
3654 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3655 diag::note_acc_active_clause_here)
3658 if (TileInfo.CurTileCount && *TileInfo.CurTileCount > 0) {
3659 Diag(StartLoc, diag::err_acc_invalid_in_loop)
3660 << 0 << TileInfo.DirectiveKind
3662 assert(TileInfo.ActiveTile &&
"Tile count without object?");
3663 Diag(TileInfo.ActiveTile->getBeginLoc(), diag::note_acc_active_clause_here)
3671 llvm::find_if(Clauses,
3677 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3679 << GetListOfClauses(
3689 llvm::find_if(Clauses,
3692 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3694 << GetListOfClauses({
3702 llvm::find_if(Clauses,
3705 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3707 << GetListOfClauses({
3715 llvm::find_if(Clauses, llvm::IsaPred<OpenACCUseDeviceClause>) ==
3717 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3728 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3741 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3747 return diagnoseConstructAppertainment(*
this, K, StartLoc,
true);
3765 AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3772 AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3776 getASTContext(), ActiveComputeConstructInfo.Kind, StartLoc, DirLoc,
3777 EndLoc, Clauses, AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3782 AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3795 AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3799 getASTContext(), StartLoc, DirLoc, LParenLoc, Exprs.front(), MiscLoc,
3800 Exprs.drop_front(), RParenLoc, EndLoc, Clauses);
3819 llvm_unreachable(
"Unhandled case in directive handling?");
3827 llvm_unreachable(
"Unimplemented associated statement application");
3835 "these don't have associated statements, so shouldn't get here");
3858 if (!isa<CXXForRangeStmt, ForStmt>(AssocStmt.
get())) {
3861 Diag(DirectiveLoc, diag::note_acc_construct_here) << K;
3865 if (!CollapseInfo.CollapseDepthSatisfied || !TileInfo.TileDepthSatisfied) {
3866 if (!CollapseInfo.CollapseDepthSatisfied) {
3867 Diag(DirectiveLoc, diag::err_acc_insufficient_loops)
3869 assert(CollapseInfo.ActiveCollapse &&
"Collapse count without object?");
3870 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3871 diag::note_acc_active_clause_here)
3875 if (!TileInfo.TileDepthSatisfied) {
3876 Diag(DirectiveLoc, diag::err_acc_insufficient_loops)
3878 assert(TileInfo.ActiveTile &&
"Collapse count without object?");
3879 Diag(TileInfo.ActiveTile->getBeginLoc(),
3880 diag::note_acc_active_clause_here)
3886 return AssocStmt.
get();
3888 llvm_unreachable(
"Invalid associated statement application");
3898 return diagnoseConstructAppertainment(*
this, K, StartLoc,
false);
Defines some OpenACC-specific enums and functions.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
static NamedDecl * getDeclFromExpr(Expr *E)
This file declares semantic analysis for OpenACC constructs and clauses.
This file defines OpenACC AST classes for statement-level contructs.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const ConstantArrayType * getAsConstantArrayType(QualType T) const
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
CanQualType ArraySectionTy
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
static QualType getBaseOriginalType(const Expr *Base)
Return original type of the base expression for array section.
QualType getElementType() const
Represents a base class of a C++ class.
Represents a C++ conversion function within a class.
Represents a C++ struct/union/class.
llvm::APInt getSize() const
Return the constant array size as an APInt.
static ConstantExpr * Create(const ASTContext &Context, Expr *E, const APValue &Result)
bool isStdNamespace() const
DeclContext * getEnclosingNamespaceContext()
Retrieve the nearest enclosing namespace context.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
const Decl * getSingleDecl() const
SourceLocation getLocation() const
SourceLocation getBeginLoc() const LLVM_READONLY
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
This represents one expression.
bool EvaluateAsInt(EvalResult &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects, bool InConstantContext=false) const
EvaluateAsInt - Return true if this is a constant which we can fold and convert to an integer,...
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
bool containsErrors() const
Whether this expression contains subexpressions which had errors, e.g.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
std::optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
Represents a member of a struct/union/class.
static OpenACCAsteriskSizeExpr * Create(const ASTContext &C, SourceLocation Loc)
static OpenACCAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCAttachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCAutoClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
This is the base type for all OpenACC Clauses.
OpenACCClauseKind getClauseKind() const
SourceLocation getBeginLoc() const
Represents a 'collapse' clause on a 'loop' construct.
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
const Expr * getLoopCount() const
static OpenACCCombinedConstruct * Create(const ASTContext &C, OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
static OpenACCComputeConstruct * Create(const ASTContext &C, OpenACCDirectiveKind K, SourceLocation BeginLoc, SourceLocation DirectiveLoc, SourceLocation EndLoc, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
static OpenACCCopyClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyInClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsReadOnly, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCopyOutClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCCreateClause * Create(const ASTContext &C, OpenACCClauseKind Spelling, SourceLocation BeginLoc, SourceLocation LParenLoc, bool IsZero, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDataConstruct * Create(const ASTContext &C, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
static OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A 'default' clause, has the optional 'none' or 'present' argument.
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCEnterDataConstruct * Create(const ASTContext &C, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses)
static OpenACCExitDataConstruct * Create(const ASTContext &C, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses)
static OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCGangClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< OpenACCGangKind > GangKinds, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCHostClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCHostDataConstruct * Create(const ASTContext &C, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
An 'if' clause, which has a required condition expression.
static OpenACCIfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCIfPresentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCIndependentClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCInitConstruct * Create(const ASTContext &C, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses)
static OpenACCLoopConstruct * Create(const ASTContext &C, OpenACCDirectiveKind ParentKind, SourceLocation BeginLoc, SourceLocation DirLoc, SourceLocation EndLoc, ArrayRef< const OpenACCClause * > Clauses, Stmt *Loop)
static OpenACCNoCreateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCNumGangsClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCNumWorkersClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCPresentClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCReductionClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCReductionOperator Operator, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'self' clause, which has an optional condition expression, or, in the event of an 'update' directiv...
static OpenACCSelfClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *ConditionExpr, SourceLocation EndLoc)
static OpenACCSeqClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCSetConstruct * Create(const ASTContext &C, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses)
static OpenACCShutdownConstruct * Create(const ASTContext &C, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses)
static OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
llvm::ArrayRef< Expr * > getSizeExprs()
static OpenACCUpdateConstruct * Create(const ASTContext &C, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses)
static OpenACCUseDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCVectorClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCVectorLengthClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCWaitClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation EndLoc)
static OpenACCWaitConstruct * Create(const ASTContext &C, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef< Expr * > QueueIdExprs, SourceLocation RParenLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses)
static OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
A generic diagnostic builder for errors which may or may not be deferred.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
ASTContext & getASTContext() const
const LangOptions & getLangOpts() const
AssociatedStmtRAII(SemaOpenACC &, OpenACCDirectiveKind, SourceLocation, ArrayRef< const OpenACCClause * >, ArrayRef< OpenACCClause * >)
void SetTileInfoBeforeAssociatedStmt(ArrayRef< const OpenACCClause * > UnInstClauses, ArrayRef< OpenACCClause * > Clauses)
void SetCollapseInfoBeforeAssociatedStmt(ArrayRef< const OpenACCClause * > UnInstClauses, ArrayRef< OpenACCClause * > Clauses)
A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/sema...
ArrayRef< Expr * > getIntExprs()
ArrayRef< Expr * > getQueueIdExprs() const
OpenACCDirectiveKind getDirectiveKind() const
ArrayRef< OpenACCGangKind > getGangKinds() const
OpenACCReductionOperator getReductionOp() const
SourceLocation getEndLoc() const
OpenACCClauseKind getClauseKind() const
const Expr * getConditionExpr() const
SourceLocation getLParenLoc() const
ArrayRef< DeviceTypeArgument > getDeviceTypeArchitectures() const
SourceLocation getBeginLoc() const
SourceLocation getQueuesLoc() const
void setVarListDetails(ArrayRef< Expr * > VarList, bool IsReadOnly, bool IsZero)
Expr * getDevNumExpr() const
ArrayRef< Expr * > getVarList()
unsigned getNumIntExprs() const
Expr * getLoopCount() const
OpenACCDefaultClauseKind getDefaultClauseKind() const
ExprResult ActOnVar(OpenACCClauseKind CK, Expr *VarExpr)
Called when encountering a 'var' for OpenACC, ensures it is actually a declaration reference to a var...
ComputeConstructInfo & getActiveComputeConstructInfo()
bool ActOnStartStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, ArrayRef< const OpenACCClause * > Clauses)
Called after the directive, including its clauses, have been parsed and parsing has consumed the 'ann...
ExprResult BuildOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
ExprResult ActOnIntExpr(OpenACCDirectiveKind DK, OpenACCClauseKind CK, SourceLocation Loc, Expr *IntExpr)
Called when encountering an 'int-expr' for OpenACC, and manages conversions and diagnostics to 'int'.
void ActOnWhileStmt(SourceLocation WhileLoc)
SourceLocation LoopWorkerClauseLoc
If there is a current 'active' loop construct with a 'worker' clause on it (on any sort of construct)...
OpenACCClause * ActOnClause(ArrayRef< const OpenACCClause * > ExistingClauses, OpenACCParsedClause &Clause)
Called after parsing an OpenACC Clause so that it can be checked.
bool ActOnStartDeclDirective(OpenACCDirectiveKind K, SourceLocation StartLoc)
Called after the directive, including its clauses, have been parsed and parsing has consumed the 'ann...
bool CheckVarIsPointerType(OpenACCClauseKind ClauseKind, Expr *VarExpr)
Called to check the 'var' type is a variable of pointer type, necessary for 'deviceptr' and 'attach' ...
struct clang::SemaOpenACC::LoopGangOnKernelTy LoopGangClauseOnKernel
ExprResult CheckReductionVar(OpenACCDirectiveKind DirectiveKind, OpenACCReductionOperator ReductionOp, Expr *VarExpr)
Called while semantically analyzing the reduction clause, ensuring the var is the correct kind of ref...
ExprResult CheckCollapseLoopCount(Expr *LoopCount)
Checks the loop depth value for a collapse clause.
struct clang::SemaOpenACC::LoopWithoutSeqCheckingInfo LoopWithoutSeqInfo
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
Called after the directive has been completely parsed, including the declaration group or associated ...
DeclGroupRef ActOnEndDeclDirective()
Called after the directive has been completely parsed, including the declaration group or associated ...
OpenACCClause * CheckReductionClause(ArrayRef< const OpenACCClause * > ExistingClauses, OpenACCDirectiveKind DirectiveKind, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCReductionOperator ReductionOp, ArrayRef< Expr * > Vars, SourceLocation EndLoc)
SourceLocation LoopVectorClauseLoc
If there is a current 'active' loop construct with a 'vector' clause on it (on any sort of construct)...
void ActOnConstruct(OpenACCDirectiveKind K, SourceLocation DirLoc)
Called after the construct has been parsed, but clauses haven't been parsed.
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc)
ExprResult CheckGangExpr(ArrayRef< const OpenACCClause * > ExistingClauses, OpenACCDirectiveKind DK, OpenACCGangKind GK, Expr *E)
void ActOnDoStmt(SourceLocation DoLoc)
void ActOnRangeForStmtBegin(SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
void ActOnForStmtEnd(SourceLocation ForLoc, StmtResult Body)
OpenACCClause * CheckGangClause(OpenACCDirectiveKind DirKind, ArrayRef< const OpenACCClause * > ExistingClauses, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< OpenACCGangKind > GangKinds, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
StmtResult ActOnAssociatedStmt(SourceLocation DirectiveLoc, OpenACCDirectiveKind K, ArrayRef< const OpenACCClause * > Clauses, StmtResult AssocStmt)
Called when we encounter an associated statement for our construct, this should check legality of the...
void ActOnForStmtBegin(SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
ExprResult ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
Checks and creates an Array Section used in an OpenACC construct/clause.
ExprResult CheckTileSizeExpr(Expr *SizeExpr)
Checks a single size expr for a tile clause.
Sema - This implements semantic analysis and AST building for C.
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, ExpressionEvaluationContextRecord::ExpressionKind Type=ExpressionEvaluationContextRecord::EK_Other)
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
ASTContext & getASTContext() const
void PopExpressionEvaluationContext()
ExprResult DefaultLvalueConversion(Expr *E)
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
void DiscardCleanupsInEvaluationContext()
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isDependentSizedArrayType() const
bool isConstantArrayType() const
bool isPointerType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool isEnumeralType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isNonOverloadPlaceholderType() const
Test for a placeholder type other than Overload; see BuiltinType::isNonOverloadPlaceholderType.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
bool isFunctionType() const
bool isAnyPointerType() const
bool isRecordType() const
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
bool Inc(InterpState &S, CodePtr OpPC)
1) Pops a pointer from the stack 2) Load the value from the pointer 3) Writes the value increased by ...
The JSON file list parser is used to communicate input to InstallAPI.
bool isOpenACCComputeDirectiveKind(OpenACCDirectiveKind K)
bool isOpenACCCombinedDirectiveKind(OpenACCDirectiveKind K)
bool isOpenACCDataDirectiveKind(OpenACCDirectiveKind K)
@ OK_Ordinary
An ordinary object is located at an address in memory.
OpenACCClauseKind
Represents the kind of an OpenACC clause.
@ DevicePtr
'deviceptr' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Collapse
'collapse' clause, allowed on 'loop' and Combined constructs.
@ DeviceNum
'device_num' clause, allowed on 'init', 'shutdown', and 'set' constructs.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Copy
'copy' clause, allowed on Compute and Combined Constructs, plus 'data' and 'declare'.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ DeviceType
'device_type' clause, allowed on Compute, 'data', 'init', 'shutdown', 'set', update',...
@ DefaultAsync
'default_async' clause, allowed on 'set' construct.
@ Attach
'attach' clause, allowed on Compute and Combined constructs, plus 'data' and 'enter data'.
@ If
'if' clause, allowed on all the Compute Constructs, Data Constructs, Executable Constructs,...
@ Default
'default' clause, allowed on parallel, serial, kernel (and compound) constructs.
@ UseDevice
'use_device' clause, allowed on 'host_data' construct.
@ NoCreate
'no_create' clause, allowed on allowed on Compute and Combined constructs, plus 'data'.
@ Reduction
'reduction' clause, allowed on Parallel, Serial, Loop, and the combined constructs.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
@ CopyOut
'copyout' clause, allowed on Compute and Combined constructs, plus 'data', 'exit data',...
@ Host
'host' clause, allowed on 'update' construct.
@ Tile
'tile' clause, allowed on 'loop' and Combined constructs.
@ Present
'present' clause, allowed on Compute and Combined constructs, plus 'data' and 'declare'.
@ CopyIn
'copyin' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
@ Device
'device' clause, allowed on the 'update' construct.
@ Detach
'detach' clause, allowed on the 'exit data' construct.
@ Delete
'delete' clause, allowed on the 'exit data' construct.
@ Result
The result type of a method or function.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
const FunctionProtoType * T
EvalResult is a struct with detailed info about an evaluated expression.
APValue Val
Val - This is the value the expression can be folded to.
OpenACCDirectiveKind DirKind