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:
480 llvm_unreachable(
"Invalid clause kind");
483bool checkAlreadyHasClauseOfKind(
486 const auto *Itr = llvm::find_if(ExistingClauses, [&](
const OpenACCClause *
C) {
489 if (Itr != ExistingClauses.end()) {
490 S.
Diag(Clause.
getBeginLoc(), diag::err_acc_duplicate_clause_disallowed)
492 S.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
498bool checkValidAfterDeviceType(
505 NewClause.getDirectiveKind() != OpenACCDirectiveKind::Loop &&
506 NewClause.getDirectiveKind() != OpenACCDirectiveKind::Data)
525 case OpenACCClauseKind::Async:
526 case OpenACCClauseKind::Wait:
527 case OpenACCClauseKind::NumGangs:
528 case OpenACCClauseKind::NumWorkers:
529 case OpenACCClauseKind::VectorLength:
534 }
else if (NewClause.getDirectiveKind() == OpenACCDirectiveKind::Loop) {
539 case OpenACCClauseKind::Collapse:
540 case OpenACCClauseKind::Gang:
541 case OpenACCClauseKind::Worker:
542 case OpenACCClauseKind::Vector:
543 case OpenACCClauseKind::Seq:
544 case OpenACCClauseKind::Independent:
545 case OpenACCClauseKind::Auto:
546 case OpenACCClauseKind::Tile:
554 case OpenACCClauseKind::Async:
555 case OpenACCClauseKind::Wait:
556 case OpenACCClauseKind::NumGangs:
557 case OpenACCClauseKind::NumWorkers:
558 case OpenACCClauseKind::VectorLength:
559 case OpenACCClauseKind::Collapse:
560 case OpenACCClauseKind::Gang:
561 case OpenACCClauseKind::Worker:
562 case OpenACCClauseKind::Vector:
563 case OpenACCClauseKind::Seq:
564 case OpenACCClauseKind::Independent:
565 case OpenACCClauseKind::Auto:
566 case OpenACCClauseKind::Tile:
571 }
else if (NewClause.getDirectiveKind() == OpenACCDirectiveKind::Data) {
575 case OpenACCClauseKind::Async:
576 case OpenACCClauseKind::Wait:
582 S.
Diag(NewClause.
getBeginLoc(), diag::err_acc_clause_after_device_type)
584 << NewClause.getDirectiveKind();
585 S.
Diag(DeviceTypeClause.
getBeginLoc(), diag::note_acc_previous_clause_here);
596 DK == OpenACCDirectiveKind::Loop || DK == OpenACCDirectiveKind::Wait ||
597 DK == OpenACCDirectiveKind::Init ||
598 DK == OpenACCDirectiveKind::Shutdown ||
599 DK == OpenACCDirectiveKind::Set;
602class SemaOpenACCClauseVisitor {
606 bool NotImplemented =
false;
609 NotImplemented =
true;
618 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCSeqClause>);
620 if (Itr != ExistingClauses.end()) {
621 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_cannot_combine)
624 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
634 : SemaRef(S), Ctx(S.getASTContext()), ExistingClauses(ExistingClauses) {}
638 bool diagNotImplemented() {
return NotImplemented; }
642#define VISIT_CLAUSE(CLAUSE_NAME) \
643 case OpenACCClauseKind::CLAUSE_NAME: \
644 return Visit##CLAUSE_NAME##Clause(Clause);
645#define CLAUSE_ALIAS(ALIAS, CLAUSE_NAME, DEPRECATED) \
646 case OpenACCClauseKind::ALIAS: \
648 SemaRef.Diag(Clause.getBeginLoc(), diag::warn_acc_deprecated_alias_name) \
649 << Clause.getClauseKind() << OpenACCClauseKind::CLAUSE_NAME; \
650 return Visit##CLAUSE_NAME##Clause(Clause);
651#include "clang/Basic/OpenACCClauses.def"
653 return isNotImplemented();
655 llvm_unreachable(
"Invalid clause kind");
658#define VISIT_CLAUSE(CLAUSE_NAME) \
659 OpenACCClause *Visit##CLAUSE_NAME##Clause( \
660 SemaOpenACC::OpenACCParsedClause &Clause);
661#include "clang/Basic/OpenACCClauses.def"
674 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
690 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
702 NewSizeExprs.push_back(Res.
get());
720 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
731 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCSelfClause>);
732 if (Itr != ExistingClauses.end()) {
734 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
748 return isNotImplemented();
757 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
765 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCIfClause>);
766 if (Itr != ExistingClauses.end()) {
768 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
780 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
807 auto *GangClauseItr =
808 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
809 auto *ReductionClauseItr =
810 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
812 if (GangClauseItr != ExistingClauses.end() &&
813 ReductionClauseItr != ExistingClauses.end()) {
815 diag::err_acc_gang_reduction_numgangs_conflict)
816 << OpenACCClauseKind::Reduction << OpenACCClauseKind::Gang
818 SemaRef.
Diag((*ReductionClauseItr)->getBeginLoc(),
819 diag::note_acc_previous_clause_here);
820 SemaRef.
Diag((*GangClauseItr)->getBeginLoc(),
821 diag::note_acc_previous_clause_here);
833 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
835 if (
Parallel != ExistingClauses.end()) {
837 diag::err_acc_reduction_num_gangs_conflict)
840 SemaRef.
Diag((*Parallel)->getBeginLoc(),
841 diag::note_acc_previous_clause_here);
850 auto GangClauses = llvm::make_filter_range(
851 ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
853 for (
auto *GC : GangClauses) {
854 if (cast<OpenACCGangClause>(GC)->hasExprOfKind(OpenACCGangKind::Num)) {
856 diag::err_acc_num_arg_conflict_reverse)
857 << OpenACCClauseKind::NumGangs << OpenACCClauseKind::Gang
859 SemaRef.
Diag(GC->getBeginLoc(), diag::note_acc_previous_clause_here);
870OpenACCClause *SemaOpenACCClauseVisitor::VisitNumWorkersClause(
875 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
882 auto WorkerClauses = llvm::make_filter_range(
883 ExistingClauses, llvm::IsaPred<OpenACCWorkerClause>);
885 for (
auto *WC : WorkerClauses) {
886 if (cast<OpenACCWorkerClause>(WC)->hasIntExpr()) {
888 diag::err_acc_num_arg_conflict_reverse)
889 << OpenACCClauseKind::NumWorkers << OpenACCClauseKind::Worker
891 SemaRef.
Diag(WC->getBeginLoc(), diag::note_acc_previous_clause_here);
898 "Invalid number of expressions for NumWorkers");
904OpenACCClause *SemaOpenACCClauseVisitor::VisitVectorLengthClause(
909 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
916 auto VectorClauses = llvm::make_filter_range(
917 ExistingClauses, llvm::IsaPred<OpenACCVectorClause>);
919 for (
auto *VC : VectorClauses) {
920 if (cast<OpenACCVectorClause>(VC)->hasIntExpr()) {
922 diag::err_acc_num_arg_conflict_reverse)
923 << OpenACCClauseKind::VectorLength << OpenACCClauseKind::Vector
925 SemaRef.
Diag(VC->getBeginLoc(), diag::note_acc_previous_clause_here);
932 "Invalid number of expressions for NumWorkers");
945 return isNotImplemented();
950 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
954 "Invalid number of expressions for Async");
961OpenACCClause *SemaOpenACCClauseVisitor::VisitDeviceNumClause(
966 return isNotImplemented();
971 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
975 "Invalid number of expressions for device_num");
981OpenACCClause *SemaOpenACCClauseVisitor::VisitDefaultAsyncClause(
985 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
989 "Invalid number of expressions for default_async");
1006OpenACCClause *SemaOpenACCClauseVisitor::VisitFirstPrivateClause(
1017OpenACCClause *SemaOpenACCClauseVisitor::VisitNoCreateClause(
1035 return isNotImplemented();
1052 return isNotImplemented();
1069 return isNotImplemented();
1086 return isNotImplemented();
1112 llvm::erase_if(VarList, [&](
Expr *
E) {
1127 llvm::erase_if(VarList, [&](
Expr *
E) {
1147OpenACCClause *SemaOpenACCClauseVisitor::VisitUseDeviceClause(
1156OpenACCClause *SemaOpenACCClauseVisitor::VisitDevicePtrClause(
1163 return isNotImplemented();
1168 llvm::erase_if(VarList, [&](
Expr *
E) {
1186 return isNotImplemented();
1193OpenACCClause *SemaOpenACCClauseVisitor::VisitDeviceTypeClause(
1200 return isNotImplemented();
1205 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
1222 llvm::find_if(ExistingClauses,
1223 llvm::IsaPred<OpenACCIndependentClause, OpenACCSeqClause>);
1224 if (Itr != ExistingClauses.end()) {
1227 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1235OpenACCClause *SemaOpenACCClauseVisitor::VisitIndependentClause(
1239 const auto *Itr = llvm::find_if(
1240 ExistingClauses, llvm::IsaPred<OpenACCAutoClause, OpenACCSeqClause>);
1241 if (Itr != ExistingClauses.end()) {
1244 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1253 if (isa<OpenACCAsteriskSizeExpr>(
E))
1255 return S.ActOnIntExpr(OpenACCDirectiveKind::Invalid, OpenACCClauseKind::Gang,
1260 return DK == OpenACCDirectiveKind::Loop &&
1261 AssocKind == OpenACCDirectiveKind::Invalid;
1265 return DK == OpenACCDirectiveKind::Loop &&
1266 AssocKind != OpenACCDirectiveKind::Invalid;
1273 << GK << CK << IsOrphanLoop(DK, AssocKind) << DK
1274 << HasAssocKind(DK, AssocKind) << AssocKind;
1281 << TagKind << CK << IsOrphanLoop(DK, AssocKind) << DK
1282 << HasAssocKind(DK, AssocKind) << AssocKind;
1290 case OpenACCGangKind::Static:
1291 return CheckGangStaticExpr(S,
E);
1292 case OpenACCGangKind::Num:
1296 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1297 case OpenACCGangKind::Dim: {
1305 S.ActOnIntExpr(OpenACCDirectiveKind::Invalid, OpenACCClauseKind::Gang,
1314 std::optional<llvm::APSInt> ICE =
1317 if (!ICE || *ICE <= 0 || ICE > 3) {
1319 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
1327 llvm_unreachable(
"Unknown gang kind in gang parallel check");
1339 case OpenACCGangKind::Dim:
1340 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1341 case OpenACCGangKind::Num: {
1353 : S.getActiveComputeConstructInfo().Clauses;
1356 llvm::find_if(Collection, llvm::IsaPred<OpenACCNumGangsClause>);
1358 if (Itr != Collection.end()) {
1360 <<
"num" << OpenACCClauseKind::Gang << DK
1361 << HasAssocKind(DK, AssocKind) << AssocKind
1362 << OpenACCClauseKind::NumGangs;
1364 S.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1369 case OpenACCGangKind::Static:
1370 return CheckGangStaticExpr(S,
E);
1373 llvm_unreachable(
"Unknown gang kind in gang kernels check");
1382 case OpenACCGangKind::Dim:
1383 case OpenACCGangKind::Num:
1384 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1385 case OpenACCGangKind::Static:
1386 return CheckGangStaticExpr(S,
E);
1388 llvm_unreachable(
"Unknown gang kind in gang serial check");
1393 if (DiagIfSeqClause(Clause))
1400 return isNotImplemented();
1407 case OpenACCDirectiveKind::Invalid:
1408 case OpenACCDirectiveKind::Parallel:
1411 case OpenACCDirectiveKind::Serial:
1414 DiagIntArgInvalid(SemaRef, IntExpr,
"length", OpenACCClauseKind::Vector,
1419 case OpenACCDirectiveKind::Kernels: {
1422 llvm::IsaPred<OpenACCVectorLengthClause>);
1425 <<
"length" << OpenACCClauseKind::Vector
1430 << OpenACCClauseKind::VectorLength;
1431 SemaRef.
Diag((*Itr)->getBeginLoc(),
1432 diag::note_acc_previous_clause_here);
1439 llvm_unreachable(
"Non compute construct in active compute construct");
1443 DiagIntArgInvalid(SemaRef, IntExpr,
"length", OpenACCClauseKind::Vector,
1448 OpenACCDirectiveKind::KernelsLoop) {
1449 const auto *Itr = llvm::find_if(
1450 ExistingClauses, llvm::IsaPred<OpenACCVectorLengthClause>);
1451 if (Itr != ExistingClauses.end()) {
1453 <<
"length" << OpenACCClauseKind::Vector
1458 << OpenACCClauseKind::VectorLength;
1459 SemaRef.
Diag((*Itr)->getBeginLoc(),
1460 diag::note_acc_previous_clause_here);
1475 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1476 << OpenACCClauseKind::Vector << OpenACCClauseKind::Vector
1479 diag::note_acc_previous_clause_here);
1491 if (DiagIfSeqClause(Clause))
1498 return isNotImplemented();
1506 case OpenACCDirectiveKind::Invalid:
1507 case OpenACCDirectiveKind::ParallelLoop:
1508 case OpenACCDirectiveKind::SerialLoop:
1509 case OpenACCDirectiveKind::Parallel:
1510 case OpenACCDirectiveKind::Serial:
1511 DiagIntArgInvalid(SemaRef, IntExpr, OpenACCGangKind::Num,
1516 case OpenACCDirectiveKind::KernelsLoop:
1517 case OpenACCDirectiveKind::Kernels: {
1520 llvm::IsaPred<OpenACCNumWorkersClause>);
1527 << OpenACCClauseKind::NumWorkers;
1528 SemaRef.
Diag((*Itr)->getBeginLoc(),
1529 diag::note_acc_previous_clause_here);
1536 llvm_unreachable(
"Non compute construct in active compute construct");
1541 DiagIntArgInvalid(SemaRef, IntExpr, OpenACCGangKind::Num,
1547 "Unknown combined directive kind?");
1548 const auto *Itr = llvm::find_if(ExistingClauses,
1549 llvm::IsaPred<OpenACCNumWorkersClause>);
1550 if (Itr != ExistingClauses.end()) {
1556 << OpenACCClauseKind::NumWorkers;
1557 SemaRef.
Diag((*Itr)->getBeginLoc(),
1558 diag::note_acc_previous_clause_here);
1573 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1574 << OpenACCClauseKind::Worker << OpenACCClauseKind::Worker
1577 diag::note_acc_previous_clause_here);
1587 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1588 << OpenACCClauseKind::Worker << OpenACCClauseKind::Vector
1591 diag::note_acc_previous_clause_here);
1603 if (DiagIfSeqClause(Clause))
1610 return isNotImplemented();
1617 OpenACCDirectiveKind::Invalid) ||
1620 auto ActiveComputeConstructContainer =
1624 auto *NumGangsClauseItr = llvm::find_if(
1625 ActiveComputeConstructContainer, llvm::IsaPred<OpenACCNumGangsClause>);
1627 if (NumGangsClauseItr != ActiveComputeConstructContainer.end() &&
1628 cast<OpenACCNumGangsClause>(*NumGangsClauseItr)->getIntExprs().size() >
1630 auto *ReductionClauseItr =
1631 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
1633 if (ReductionClauseItr != ExistingClauses.end()) {
1635 diag::err_acc_gang_reduction_numgangs_conflict)
1636 << OpenACCClauseKind::Gang << OpenACCClauseKind::Reduction
1639 SemaRef.
Diag((*ReductionClauseItr)->getBeginLoc(),
1640 diag::note_acc_previous_clause_here);
1641 SemaRef.
Diag((*NumGangsClauseItr)->getBeginLoc(),
1642 diag::note_acc_previous_clause_here);
1655 for (
unsigned I = 0; I < Clause.
getIntExprs().size(); ++I) {
1666 if (ExistingElemLoc[
static_cast<unsigned>(GK)].isValid()) {
1668 <<
static_cast<unsigned>(GK);
1669 SemaRef.
Diag(ExistingElemLoc[
static_cast<unsigned>(GK)],
1670 diag::note_acc_previous_expr_here);
1674 ExistingElemLoc[
static_cast<unsigned>(GK)] = ER.
get()->
getBeginLoc();
1675 GangKinds.push_back(GK);
1676 IntExprs.push_back(ER.
get());
1687 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1688 << OpenACCClauseKind::Gang << OpenACCClauseKind::Gang
1692 diag::note_acc_previous_clause_here);
1702 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1703 << OpenACCClauseKind::Gang << OpenACCClauseKind::Worker
1706 diag::note_acc_previous_clause_here);
1716 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1717 << OpenACCClauseKind::Gang << OpenACCClauseKind::Vector
1720 diag::note_acc_previous_clause_here);
1727 GangKinds, IntExprs, Clause.
getEndLoc());
1730OpenACCClause *SemaOpenACCClauseVisitor::VisitFinalizeClause(
1738OpenACCClause *SemaOpenACCClauseVisitor::VisitIfPresentClause(
1752 return isNotImplemented();
1757 llvm::find_if(ExistingClauses,
1758 llvm::IsaPred<OpenACCAutoClause, OpenACCIndependentClause>);
1759 if (Itr != ExistingClauses.end()) {
1762 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1769 Itr = llvm::find_if(ExistingClauses,
1773 if (Itr != ExistingClauses.end()) {
1774 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_cannot_combine)
1777 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1785OpenACCClause *SemaOpenACCClauseVisitor::VisitReductionClause(
1792 OpenACCDirectiveKind::Invalid) ||
1795 auto ActiveComputeConstructContainer =
1799 auto *NumGangsClauseItr = llvm::find_if(
1800 ActiveComputeConstructContainer, llvm::IsaPred<OpenACCNumGangsClause>);
1802 if (NumGangsClauseItr != ActiveComputeConstructContainer.end() &&
1803 cast<OpenACCNumGangsClause>(*NumGangsClauseItr)->getIntExprs().size() >
1805 auto *GangClauseItr =
1806 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
1808 if (GangClauseItr != ExistingClauses.end()) {
1810 diag::err_acc_gang_reduction_numgangs_conflict)
1811 << OpenACCClauseKind::Reduction << OpenACCClauseKind::Gang
1814 SemaRef.
Diag((*GangClauseItr)->getBeginLoc(),
1815 diag::note_acc_previous_clause_here);
1816 SemaRef.
Diag((*NumGangsClauseItr)->getBeginLoc(),
1817 diag::note_acc_previous_clause_here);
1845 auto NumGangsClauses = llvm::make_filter_range(
1846 ExistingClauses, llvm::IsaPred<OpenACCNumGangsClause>);
1848 for (
auto *NGC : NumGangsClauses) {
1850 cast<OpenACCNumGangsClause>(NGC)->getIntExprs().size();
1854 diag::err_acc_reduction_num_gangs_conflict)
1857 SemaRef.
Diag(NGC->getBeginLoc(), diag::note_acc_previous_clause_here);
1870 ValidVars.push_back(Res.
get());
1879OpenACCClause *SemaOpenACCClauseVisitor::VisitCollapseClause(
1886 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
1899void CollectActiveReductionClauses(
1902 for (
auto *CurClause : CurClauses) {
1903 if (
auto *RedClause = dyn_cast<OpenACCReductionClause>(CurClause);
1904 RedClause && !RedClause->getVarList().empty())
1905 ActiveClauses.push_back(RedClause);
1913 case OpenACCDirectiveKind::Parallel:
1914 case OpenACCDirectiveKind::ParallelLoop:
1915 case OpenACCDirectiveKind::Serial:
1916 case OpenACCDirectiveKind::SerialLoop:
1917 case OpenACCDirectiveKind::Kernels:
1918 case OpenACCDirectiveKind::KernelsLoop:
1919 case OpenACCDirectiveKind::Loop:
1921 case OpenACCDirectiveKind::Data:
1922 case OpenACCDirectiveKind::HostData:
1924 case OpenACCDirectiveKind::EnterData:
1925 case OpenACCDirectiveKind::ExitData:
1926 case OpenACCDirectiveKind::Wait:
1927 case OpenACCDirectiveKind::Init:
1928 case OpenACCDirectiveKind::Shutdown:
1929 case OpenACCDirectiveKind::Set:
1930 case OpenACCDirectiveKind::Update:
1931 llvm_unreachable(
"Doesn't have an associated stmt");
1933 case OpenACCDirectiveKind::Invalid:
1934 llvm_unreachable(
"Unhandled directive kind?");
1936 llvm_unreachable(
"Unhandled directive kind?");
1947 : SemaRef(S), OldActiveComputeConstructInfo(S.ActiveComputeConstructInfo),
1948 DirKind(DK), OldLoopGangClauseOnKernel(S.LoopGangClauseOnKernel),
1949 OldLoopWorkerClauseLoc(S.LoopWorkerClauseLoc),
1950 OldLoopVectorClauseLoc(S.LoopVectorClauseLoc),
1951 OldLoopWithoutSeqInfo(S.LoopWithoutSeqInfo),
1952 ActiveReductionClauses(S.ActiveReductionClauses),
1953 LoopRAII(SemaRef, PreserveLoopRAIIDepthInAssociatedStmtRAII(DirKind)) {
1959 CollectActiveReductionClauses(S.ActiveReductionClauses, Clauses);
1960 SemaRef.ActiveComputeConstructInfo.Kind = DirKind;
1961 SemaRef.ActiveComputeConstructInfo.Clauses = Clauses;
1976 SemaRef.ActiveComputeConstructInfo.Kind = DirKind;
1977 SemaRef.ActiveComputeConstructInfo.Clauses = Clauses;
1979 CollectActiveReductionClauses(S.ActiveReductionClauses, Clauses);
1990 if (Clauses.end() ==
1991 llvm::find_if(Clauses, llvm::IsaPred<OpenACCSeqClause>))
2004 auto *Itr = llvm::find_if(Clauses, llvm::IsaPred<OpenACCGangClause>);
2005 if (Itr != Clauses.end())
2009 if (UnInstClauses.empty()) {
2010 auto *Itr = llvm::find_if(Clauses, llvm::IsaPred<OpenACCWorkerClause>);
2011 if (Itr != Clauses.end())
2014 auto *Itr2 = llvm::find_if(Clauses, llvm::IsaPred<OpenACCVectorClause>);
2015 if (Itr2 != Clauses.end())
2019 CollectActiveReductionClauses(S.ActiveReductionClauses, Clauses);
2026 if (Clauses.end() ==
2027 llvm::find_if(Clauses, llvm::IsaPred<OpenACCSeqClause>))
2040 UnInstClauses.empty()) {
2042 auto *Itr = llvm::find_if(Clauses, llvm::IsaPred<OpenACCGangClause>);
2043 if (Itr != Clauses.end())
2048 if (UnInstClauses.empty()) {
2049 auto *Itr = llvm::find_if(Clauses, llvm::IsaPred<OpenACCWorkerClause>);
2050 if (Itr != Clauses.end())
2053 auto *Itr2 = llvm::find_if(Clauses, llvm::IsaPred<OpenACCVectorClause>);
2054 if (Itr2 != Clauses.end())
2065 SemaRef.LoopInfo.CurLevelHasLoopAlready =
false;
2066 SemaRef.CollapseInfo.CollapseDepthSatisfied =
true;
2067 SemaRef.TileInfo.TileDepthSatisfied =
true;
2074 auto *CollapseClauseItr =
2075 llvm::find_if(Clauses, llvm::IsaPred<OpenACCCollapseClause>);
2076 auto *UnInstCollapseClauseItr =
2077 llvm::find_if(UnInstClauses, llvm::IsaPred<OpenACCCollapseClause>);
2079 if (Clauses.end() == CollapseClauseItr)
2083 cast<OpenACCCollapseClause>(*CollapseClauseItr);
2085 SemaRef.CollapseInfo.ActiveCollapse = CollapseClause;
2095 if (UnInstCollapseClauseItr != UnInstClauses.end() &&
2096 !cast<OpenACCCollapseClause>(*UnInstCollapseClauseItr)
2098 ->isInstantiationDependent())
2101 SemaRef.CollapseInfo.CollapseDepthSatisfied =
false;
2102 SemaRef.CollapseInfo.CurCollapseCount =
2103 cast<ConstantExpr>(LoopCount)->getResultAsAPSInt();
2104 SemaRef.CollapseInfo.DirectiveKind = DirKind;
2113 if (UnInstClauses.size() > 0)
2115 auto *TileClauseItr =
2116 llvm::find_if(Clauses, llvm::IsaPred<OpenACCTileClause>);
2118 if (Clauses.end() == TileClauseItr)
2122 SemaRef.TileInfo.ActiveTile = TileClause;
2123 SemaRef.TileInfo.TileDepthSatisfied =
false;
2125 SemaRef.TileInfo.DirectiveKind = DirKind;
2136 SemaRef.ActiveComputeConstructInfo = OldActiveComputeConstructInfo;
2137 SemaRef.LoopGangClauseOnKernel = OldLoopGangClauseOnKernel;
2138 SemaRef.LoopWorkerClauseLoc = OldLoopWorkerClauseLoc;
2139 SemaRef.LoopVectorClauseLoc = OldLoopVectorClauseLoc;
2140 SemaRef.LoopWithoutSeqInfo = OldLoopWithoutSeqInfo;
2141 SemaRef.ActiveReductionClauses.swap(ActiveReductionClauses);
2163 if (
const auto *DevTypeClause =
2164 llvm::find_if(ExistingClauses,
2166 return isa<OpenACCDeviceTypeClause>(
C);
2168 DevTypeClause != ExistingClauses.end()) {
2169 if (checkValidAfterDeviceType(
2170 *
this, *cast<OpenACCDeviceTypeClause>(*DevTypeClause), Clause))
2174 SemaOpenACCClauseVisitor Visitor{*
this, ExistingClauses};
2177 "Created wrong clause?");
2179 if (Visitor.diagNotImplemented())
2190bool areVarsEqual(
Expr *VarExpr1,
Expr *VarExpr2) {
2202 if (isa<ArraySectionExpr>(VarExpr1)) {
2203 auto *Expr2AS = dyn_cast<ArraySectionExpr>(VarExpr2);
2207 auto *Expr1AS = cast<ArraySectionExpr>(VarExpr1);
2209 if (!areVarsEqual(Expr1AS->getBase(), Expr2AS->getBase()))
2217 if (isa<ArraySubscriptExpr>(VarExpr1)) {
2218 auto *Expr2AS = dyn_cast<ArraySubscriptExpr>(VarExpr2);
2222 auto *Expr1AS = cast<ArraySubscriptExpr>(VarExpr1);
2224 if (!areVarsEqual(Expr1AS->getBase(), Expr2AS->getBase()))
2234 if (isa<DeclRefExpr>(VarExpr1)) {
2235 auto *Expr2DRE = dyn_cast<DeclRefExpr>(VarExpr2);
2239 auto *Expr1DRE = cast<DeclRefExpr>(VarExpr1);
2241 return Expr1DRE->getDecl()->getMostRecentDecl() ==
2242 Expr2DRE->getDecl()->getMostRecentDecl();
2245 llvm_unreachable(
"Unknown variable type encountered");
2261 auto TypeIsValid = [](
QualType Ty) {
2262 return Ty->isDependentType() || Ty->isScalarType();
2265 if (isa<ArraySectionExpr>(VarExpr)) {
2266 Expr *ASExpr = VarExpr;
2270 if (!TypeIsValid(EltTy)) {
2276 if (!RD->isStruct() && !RD->isClass()) {
2277 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2282 if (!RD->isCompleteDefinition()) {
2283 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2287 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD);
2288 CXXRD && !CXXRD->isAggregate()) {
2289 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2295 if (!TypeIsValid(FD->getType())) {
2297 diag::err_acc_reduction_composite_member_type);
2298 Diag(FD->getLocation(), diag::note_acc_reduction_composite_member_loc);
2302 }
else if (!TypeIsValid(VarExpr->
getType())) {
2313 if (RClause->getReductionOp() == ReductionOp)
2316 for (
Expr *OldVarExpr : RClause->getVarList()) {
2317 if (OldVarExpr->isInstantiationDependent())
2320 if (areVarsEqual(VarExpr, OldVarExpr)) {
2322 << ReductionOp << RClause->getReductionOp();
2323 Diag(OldVarExpr->getExprLoc(), diag::note_acc_previous_clause_here);
2369 Diag(DirLoc, diag::warn_acc_construct_unimplemented) << K;
2384 "Only one of directive or clause kind should be provided");
2393 unsigned getDiagKind()
const {
2394 if (ClauseKind != OpenACCClauseKind::Invalid)
2396 if (DirectiveKind != OpenACCDirectiveKind::Invalid)
2404 : ICEConvertDiagnoser(
false,
2407 DirectiveKind(DK), ClauseKind(CK), IntExpr(IntExpr) {}
2416 return S.
Diag(
Loc, diag::err_acc_int_expr_requires_integer)
2417 << getDiagKind() << ClauseKind << DirectiveKind <<
T;
2422 return S.
Diag(
Loc, diag::err_acc_int_expr_incomplete_class_type)
2429 return S.
Diag(
Loc, diag::err_acc_int_expr_explicit_conversion)
2436 return S.
Diag(Conv->
getLocation(), diag::note_acc_int_expr_conversion)
2442 return S.
Diag(
Loc, diag::err_acc_int_expr_multiple_conversions) <<
T;
2447 return S.
Diag(Conv->
getLocation(), diag::note_acc_int_expr_conversion)
2454 llvm_unreachable(
"conversion functions are permitted");
2456 } IntExprDiagnoser(DK, CK, IntExpr);
2462 Loc, IntExpr, IntExprDiagnoser);
2466 IntExpr = IntExprResult.
get();
2488 Diag(VarExpr->
getExprLoc(), diag::note_acc_expected_pointer_var);
2500 return Diag(VarExpr->
getExprLoc(), diag::err_acc_var_not_pointer_type)
2501 << ClauseKind << Ty;
2512 isa<ArraySectionExpr, ArraySubscriptExpr>(CurVarExpr)) {
2513 Diag(VarExpr->
getExprLoc(), diag::err_acc_not_a_var_ref_use_device);
2519 while (isa<ArraySectionExpr, ArraySubscriptExpr>(CurVarExpr)) {
2520 if (
auto *SubScrpt = dyn_cast<ArraySubscriptExpr>(CurVarExpr))
2528 if (
const auto *DRE = dyn_cast<DeclRefExpr>(CurVarExpr)) {
2529 if (isa<VarDecl, NonTypeTemplateParmDecl>(
2530 DRE->getFoundDecl()->getCanonicalDecl()))
2542 if (
const auto *ME = dyn_cast<MemberExpr>(CurVarExpr)) {
2543 if (isa<FieldDecl>(ME->getMemberDecl()->getCanonicalDecl()))
2555 if (isa<DependentScopeDeclRefExpr>(CurVarExpr) ||
2557 isa<CXXDependentScopeMemberExpr>(CurVarExpr)))
2562 if (isa<RecoveryExpr>(CurVarExpr))
2566 Diag(VarExpr->
getExprLoc(), diag::err_acc_not_a_var_ref_use_device);
2581 if (
Base->hasPlaceholderType() &&
2582 !
Base->hasPlaceholderType(BuiltinType::ArraySection)) {
2595 LowerBound =
Result.get();
2597 if (Length && Length->getType()->isNonOverloadPlaceholderType()) {
2611 if (!
Base->isTypeDependent()) {
2618 Diag(
Base->getExprLoc(), diag::err_acc_typecheck_subarray_value)
2619 <<
Base->getSourceRange());
2623 Diag(
Base->getExprLoc(), diag::err_acc_subarray_function_type)
2624 << ResultTy <<
Base->getSourceRange();
2629 diag::err_acc_subarray_incomplete_type,
2633 if (!
Base->hasPlaceholderType(BuiltinType::ArraySection)) {
2644 return Recovery.
isUsable() ? Recovery.
get() :
nullptr;
2659 if (Length && !Length->isTypeDependent()) {
2662 Length->getExprLoc(), Length);
2671 if (!Length && (OriginalBaseTy.
isNull() ||
2676 Diag(ColonLoc, diag::err_acc_subarray_no_length) << IsArray;
2681 Length = Recovery.
isUsable() ? Recovery.
get() :
nullptr;
2692 std::optional<llvm::APSInt> BaseSize;
2695 BaseSize = ArrayTy->
getSize();
2698 auto GetBoundValue = [&](
Expr *
E) -> std::optional<llvm::APSInt> {
2700 return std::nullopt;
2704 return std::nullopt;
2708 std::optional<llvm::APSInt> LowerBoundValue = GetBoundValue(LowerBound);
2709 std::optional<llvm::APSInt> LengthValue = GetBoundValue(Length);
2712 if (LowerBoundValue.has_value()) {
2713 if (LowerBoundValue->isNegative()) {
2715 << 0 <<
toString(*LowerBoundValue, 10);
2716 LowerBoundValue.reset();
2717 LowerBound = GetRecovery(LowerBound, LowerBound->
getType());
2718 }
else if (BaseSize.has_value() &&
2719 llvm::APSInt::compareValues(*LowerBoundValue, *BaseSize) >= 0) {
2721 Diag(LowerBound->
getExprLoc(), diag::err_acc_subarray_out_of_range)
2722 << 0 <<
toString(*LowerBoundValue, 10)
2724 LowerBoundValue.reset();
2725 LowerBound = GetRecovery(LowerBound, LowerBound->
getType());
2730 if (LengthValue.has_value()) {
2731 if (LengthValue->isNegative()) {
2732 Diag(Length->getExprLoc(), diag::err_acc_subarray_negative)
2733 << 1 <<
toString(*LengthValue, 10);
2734 LengthValue.reset();
2735 Length = GetRecovery(Length, Length->getType());
2736 }
else if (BaseSize.has_value() &&
2737 llvm::APSInt::compareValues(*LengthValue, *BaseSize) > 0) {
2739 Diag(Length->getExprLoc(), diag::err_acc_subarray_out_of_range)
2742 LengthValue.reset();
2743 Length = GetRecovery(Length, Length->getType());
2748 auto AddAPSInt = [](llvm::APSInt LHS, llvm::APSInt RHS) -> llvm::APSInt {
2749 if (LHS.isSigned() == RHS.isSigned())
2752 unsigned Width = std::max(LHS.getBitWidth(), RHS.getBitWidth()) + 1;
2753 return llvm::APSInt(LHS.sext(Width) + RHS.sext(Width),
true);
2758 if (BaseSize.has_value() && LowerBoundValue.has_value() &&
2759 LengthValue.has_value() &&
2760 llvm::APSInt::compareValues(AddAPSInt(*LowerBoundValue, *LengthValue),
2763 diag::err_acc_subarray_base_plus_length_out_of_range)
2768 LowerBoundValue.reset();
2769 LowerBound = GetRecovery(LowerBound, LowerBound->
getType());
2770 LengthValue.reset();
2771 Length = GetRecovery(Length, Length->getType());
2776 if (
Base->isTypeDependent() ||
2778 (Length && Length->isInstantiationDependent()))
2781 return new (Context)
2792 "Loop argument non integer?");
2798 std::optional<llvm::APSInt> ICE =
2804 if (!ICE || *ICE <= 0) {
2806 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
2824 return CheckGangParallelExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2827 return CheckGangSerialExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2830 return CheckGangKernelsExpr(*
this, ExistingClauses, DK,
2831 ActiveComputeConstructInfo.Kind, GK,
E);
2833 switch (ActiveComputeConstructInfo.Kind) {
2837 return CheckGangParallelExpr(*
this, DK, ActiveComputeConstructInfo.Kind,
2841 return CheckGangSerialExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2845 return CheckGangKernelsExpr(*
this, ExistingClauses, DK,
2846 ActiveComputeConstructInfo.Kind, GK,
E);
2848 llvm_unreachable(
"Non compute construct in active compute construct?");
2853 llvm_unreachable(
"Invalid directive kind for a Gang clause");
2855 llvm_unreachable(
"Compute construct directive not handled?");
2867 const auto *ReductionItr =
2868 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
2870 if (ReductionItr != ExistingClauses.end()) {
2871 const auto GangZip = llvm::zip_equal(GangKinds, IntExprs);
2872 const auto GangItr = llvm::find_if(GangZip, [](
const auto &Tuple) {
2876 if (GangItr != GangZip.end()) {
2877 const Expr *DimExpr = std::get<1>(*GangItr);
2881 "Improperly formed gang argument");
2882 if (
const auto *DimVal = dyn_cast<ConstantExpr>(DimExpr);
2883 DimVal && DimVal->getResultAsAPSInt() > 1) {
2884 Diag(DimVal->getBeginLoc(), diag::err_acc_gang_reduction_conflict)
2886 Diag((*ReductionItr)->getBeginLoc(),
2887 diag::note_acc_previous_clause_here);
2894 GangKinds, IntExprs, EndLoc);
2907 const auto GangClauses = llvm::make_filter_range(
2908 ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
2910 for (
auto *GC : GangClauses) {
2911 const auto *GangClause = cast<OpenACCGangClause>(GC);
2912 for (
unsigned I = 0; I < GangClause->getNumExprs(); ++I) {
2913 std::pair<OpenACCGangKind, const Expr *> EPair = GangClause->getExpr(I);
2917 if (
const auto *DimVal = dyn_cast<ConstantExpr>(EPair.second);
2918 DimVal && DimVal->getResultAsAPSInt() > 1) {
2919 Diag(BeginLoc, diag::err_acc_gang_reduction_conflict)
2920 << 1 << DirectiveKind;
2921 Diag(GangClause->getBeginLoc(), diag::note_acc_previous_clause_here);
2929 getASTContext(), BeginLoc, LParenLoc, ReductionOp, Vars, EndLoc);
2939 "size argument non integer?");
2943 isa<OpenACCAsteriskSizeExpr>(SizeExpr))
2946 std::optional<llvm::APSInt> ICE =
2951 if (!ICE || *ICE <= 0) {
2953 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
2965 if (!LoopInfo.TopLevelLoopSeen)
2968 if (CollapseInfo.CurCollapseCount && *CollapseInfo.CurCollapseCount > 0) {
2969 Diag(WhileLoc, diag::err_acc_invalid_in_loop)
2970 << 1 << CollapseInfo.DirectiveKind
2972 assert(CollapseInfo.ActiveCollapse &&
"Collapse count without object?");
2973 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
2974 diag::note_acc_active_clause_here)
2979 CollapseInfo.CurCollapseCount = std::nullopt;
2982 if (TileInfo.CurTileCount && *TileInfo.CurTileCount > 0) {
2983 Diag(WhileLoc, diag::err_acc_invalid_in_loop)
2984 << 1 << TileInfo.DirectiveKind
2986 assert(TileInfo.ActiveTile &&
"tile count without object?");
2987 Diag(TileInfo.ActiveTile->getBeginLoc(), diag::note_acc_active_clause_here)
2992 TileInfo.CurTileCount = std::nullopt;
3000 if (!LoopInfo.TopLevelLoopSeen)
3003 if (CollapseInfo.CurCollapseCount && *CollapseInfo.CurCollapseCount > 0) {
3004 Diag(DoLoc, diag::err_acc_invalid_in_loop)
3005 << 2 << CollapseInfo.DirectiveKind
3007 assert(CollapseInfo.ActiveCollapse &&
"Collapse count without object?");
3008 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3009 diag::note_acc_active_clause_here)
3014 CollapseInfo.CurCollapseCount = std::nullopt;
3017 if (TileInfo.CurTileCount && *TileInfo.CurTileCount > 0) {
3018 Diag(DoLoc, diag::err_acc_invalid_in_loop)
3020 assert(TileInfo.ActiveTile &&
"tile count without object?");
3021 Diag(TileInfo.ActiveTile->getBeginLoc(), diag::note_acc_active_clause_here)
3026 TileInfo.CurTileCount = std::nullopt;
3031 ForStmtBeginChecker &
C) {
3032 assert(
getLangOpts().OpenACC &&
"Check enabled when not OpenACC?");
3035 LoopInfo.TopLevelLoopSeen =
true;
3037 if (CollapseInfo.CurCollapseCount && *CollapseInfo.CurCollapseCount > 0) {
3045 if (LoopInfo.CurLevelHasLoopAlready) {
3046 Diag(ForLoc, diag::err_acc_clause_multiple_loops)
3048 assert(CollapseInfo.ActiveCollapse &&
"No collapse object?");
3049 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3050 diag::note_acc_active_clause_here)
3053 --(*CollapseInfo.CurCollapseCount);
3057 if (*CollapseInfo.CurCollapseCount == 0)
3058 CollapseInfo.CollapseDepthSatisfied =
true;
3062 if (TileInfo.CurTileCount && *TileInfo.CurTileCount > 0) {
3065 if (LoopInfo.CurLevelHasLoopAlready) {
3066 Diag(ForLoc, diag::err_acc_clause_multiple_loops)
3068 assert(TileInfo.ActiveTile &&
"No tile object?");
3069 Diag(TileInfo.ActiveTile->getBeginLoc(),
3070 diag::note_acc_active_clause_here)
3073 --(*TileInfo.CurTileCount);
3076 if (*TileInfo.CurTileCount == 0)
3077 TileInfo.TileDepthSatisfied =
true;
3083 LoopInfo.CurLevelHasLoopAlready =
false;
3087bool isValidLoopVariableType(
QualType LoopVarTy) {
3110 for (
const auto *TD :
3111 llvm::make_filter_range(RD->decls(), llvm::IsaPred<TypedefNameDecl>)) {
3112 const auto *TDND = cast<TypedefNameDecl>(TD)->getCanonicalDecl();
3114 if (TDND->getName() !=
"iterator_category")
3118 if (TDND->getUnderlyingType().isNull())
3122 TDND->getUnderlyingType()->getAsCXXRecordDecl();
3125 if (!ItrCategoryDecl)
3128 auto IsRandomAccessIteratorTag = [](
const CXXRecordDecl *RD) {
3129 if (RD->getName() !=
"random_access_iterator_tag")
3135 if (IsRandomAccessIteratorTag(ItrCategoryDecl))
3142 if (IsRandomAccessIteratorTag(BS.getType()->getAsCXXRecordDecl()))
3155void SemaOpenACC::ForStmtBeginChecker::check() {
3161 AlreadyChecked =
true;
3181 if (!RangeFor.has_value())
3185 const DeclStmt *RangeStmt = (*RangeFor)->getBeginStmt();
3194 if (!isValidLoopVariableType(VarType)) {
3196 <<
SemaRef.LoopWithoutSeqInfo.Kind << VarType;
3198 diag::note_acc_construct_here)
3199 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3208 if (Cond.has_value())
3210 if (
Inc.has_value())
3213const ValueDecl *SemaOpenACC::ForStmtBeginChecker::checkInit() {
3217 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3219 diag::note_acc_construct_here)
3220 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3225 auto DiagLoopVar = [&]() {
3228 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3230 diag::note_acc_construct_here)
3231 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3236 if (
const auto *ExprTemp = dyn_cast<ExprWithCleanups>(
Init))
3237 Init = ExprTemp->getSubExpr();
3238 if (
const auto *
E = dyn_cast<Expr>(
Init))
3243 if (
const auto *BO = dyn_cast<BinaryOperator>(
Init)) {
3246 if (!BO->isAssignmentOp())
3247 return DiagLoopVar();
3251 if (
const auto *DRE = dyn_cast<DeclRefExpr>(LHS))
3252 InitVar = DRE->getDecl();
3253 }
else if (
const auto *DS = dyn_cast<DeclStmt>(
Init)) {
3255 if (!DS->isSingleDecl())
3256 return DiagLoopVar();
3258 InitVar = dyn_cast<ValueDecl>(DS->getSingleDecl());
3263 if (!isa<VarDecl>(InitVar))
3264 return DiagLoopVar();
3268 !cast<VarDecl>(InitVar)->hasInit())
3269 return DiagLoopVar();
3271 }
else if (
auto *CE = dyn_cast<CXXOperatorCallExpr>(
Init)) {
3273 if (CE->getOperator() != OO_Equal)
3274 return DiagLoopVar();
3278 if (
auto *DRE = dyn_cast<DeclRefExpr>(LHS)) {
3279 InitVar = DRE->getDecl();
3280 }
else if (
auto *ME = dyn_cast<MemberExpr>(LHS)) {
3281 if (isa<CXXThisExpr>(ME->getBase()->IgnoreParenImpCasts()))
3282 InitVar = ME->getMemberDecl();
3287 return DiagLoopVar();
3293 if (!isValidLoopVariableType(VarType)) {
3296 <<
SemaRef.LoopWithoutSeqInfo.Kind << VarType;
3298 diag::note_acc_construct_here)
3299 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3306void SemaOpenACC::ForStmtBeginChecker::checkCond() {
3308 SemaRef.
Diag(ForLoc, diag::err_acc_loop_terminating_condition)
3309 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3311 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3320void SemaOpenACC::ForStmtBeginChecker::checkInc(
const ValueDecl *
Init) {
3323 SemaRef.
Diag(ForLoc, diag::err_acc_loop_not_monotonic)
3324 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3326 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3329 auto DiagIncVar = [
this] {
3330 SemaRef.
Diag((*Inc)->getBeginLoc(), diag::err_acc_loop_not_monotonic)
3331 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3333 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3337 if (
const auto *ExprTemp = dyn_cast<ExprWithCleanups>(*Inc))
3338 Inc = ExprTemp->getSubExpr();
3339 if (
const auto *
E = dyn_cast<Expr>(*Inc))
3344 if (
const auto *FE = dyn_cast<FullExpr>(
E))
3345 E = FE->getSubExpr();
3351 if (
const auto *DRE = dyn_cast<DeclRefExpr>(
E))
3352 return dyn_cast<ValueDecl>(DRE->getDecl());
3354 if (
const auto *ME = dyn_cast<MemberExpr>(
E))
3355 if (isa<CXXThisExpr>(ME->getBase()->IgnoreParenImpCasts()))
3356 return ME->getMemberDecl();
3364 if (
const auto *UO = dyn_cast<UnaryOperator>(*Inc)) {
3366 if (!UO->isIncrementDecrementOp())
3367 return DiagIncVar();
3369 }
else if (
const auto *BO = dyn_cast<BinaryOperator>(*Inc)) {
3370 switch (BO->getOpcode()) {
3372 return DiagIncVar();
3386 }
else if (
const auto *CE = dyn_cast<CXXOperatorCallExpr>(*Inc)) {
3387 switch (CE->getOperator()) {
3389 return DiagIncVar();
3407 }
else if (
const auto *ME = dyn_cast<CXXMemberCallExpr>(*Inc)) {
3414 return DiagIncVar();
3420 return DiagIncVar();
3427 const Stmt *Second,
const Stmt *OldThird,
3428 const Stmt *Third) {
3432 std::optional<const Stmt *> S;
3433 if (OldSecond == Second)
3437 std::optional<const Stmt *>
T;
3438 if (OldThird == Third)
3443 bool InitChanged =
false;
3444 if (OldFirst !=
First) {
3452 if (
const auto *DS = dyn_cast<DeclStmt>(OldFirst))
3453 if (
const VarDecl *VD = dyn_cast_if_present<VarDecl>(
3454 DS->isSingleDecl() ? DS->getSingleDecl() :
nullptr))
3455 OldVDTy = VD->getType();
3456 if (
const auto *DS = dyn_cast<DeclStmt>(
First))
3457 if (
const VarDecl *VD = dyn_cast_if_present<VarDecl>(
3458 DS->isSingleDecl() ? DS->getSingleDecl() :
nullptr))
3459 NewVDTy = VD->getType();
3466 ForStmtBeginChecker FSBC{*
this, ForLoc,
First, InitChanged, S,
T};
3467 if (!LoopInfo.TopLevelLoopSeen) {
3471 ForStmtBeginHelper(ForLoc, FSBC);
3475 const Stmt *Second,
const Stmt *Third) {
3479 ForStmtBeginChecker FSBC{*
this, ForLoc,
First,
true,
3481 if (!LoopInfo.TopLevelLoopSeen) {
3485 ForStmtBeginHelper(ForLoc, FSBC);
3489 const Stmt *OldRangeFor,
3490 const Stmt *RangeFor) {
3494 std::optional<const CXXForRangeStmt *> RF;
3496 if (OldRangeFor == RangeFor)
3499 RF = cast<CXXForRangeStmt>(RangeFor);
3501 ForStmtBeginChecker FSBC{*
this, ForLoc, RF};
3502 if (!LoopInfo.TopLevelLoopSeen) {
3505 ForStmtBeginHelper(ForLoc, FSBC);
3509 const Stmt *RangeFor) {
3513 ForStmtBeginChecker FSBC{*
this, ForLoc, cast<CXXForRangeStmt>(RangeFor)};
3514 if (!LoopInfo.TopLevelLoopSeen) {
3517 ForStmtBeginHelper(ForLoc, FSBC);
3527 isa<ForStmt, NullStmt, ForStmt, CXXForRangeStmt, WhileStmt, DoStmt>(
3532 if (isa<OpenACCConstructStmt>(CurStmt))
3537 if (
const auto *CS = dyn_cast<CompoundStmt>(CurStmt)) {
3538 for (
const auto *ChildStmt : CS->children()) {
3539 SourceLocation ChildStmtLoc = FindInterveningCodeInLoop(ChildStmt);
3541 return ChildStmtLoc;
3555 LoopInfo.CurLevelHasLoopAlready =
true;
3560 bool IsActiveCollapse = CollapseInfo.CurCollapseCount &&
3561 *CollapseInfo.CurCollapseCount > 0 &&
3562 !CollapseInfo.ActiveCollapse->hasForce();
3563 bool IsActiveTile = TileInfo.CurTileCount && *TileInfo.CurTileCount > 0;
3565 if (IsActiveCollapse || IsActiveTile) {
3568 if (OtherStmtLoc.
isValid() && IsActiveCollapse) {
3569 Diag(OtherStmtLoc, diag::err_acc_intervening_code)
3571 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3572 diag::note_acc_active_clause_here)
3576 if (OtherStmtLoc.
isValid() && IsActiveTile) {
3577 Diag(OtherStmtLoc, diag::err_acc_intervening_code)
3579 Diag(TileInfo.ActiveTile->getBeginLoc(),
3580 diag::note_acc_active_clause_here)
3590 assert(!Clauses.empty() &&
"empty clause list not supported");
3593 llvm::raw_string_ostream OS{Output};
3595 if (Clauses.size() == 1) {
3596 OS <<
'\'' << Clauses[0] <<
'\'';
3605 [&] { OS <<
", "; });
3607 OS <<
" or \'" << Clauses.back() <<
'\'';
3623 if (CollapseInfo.CurCollapseCount && *CollapseInfo.CurCollapseCount > 0) {
3624 Diag(StartLoc, diag::err_acc_invalid_in_loop)
3625 << 0 << CollapseInfo.DirectiveKind
3627 assert(CollapseInfo.ActiveCollapse &&
"Collapse count without object?");
3628 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3629 diag::note_acc_active_clause_here)
3632 if (TileInfo.CurTileCount && *TileInfo.CurTileCount > 0) {
3633 Diag(StartLoc, diag::err_acc_invalid_in_loop)
3634 << 0 << TileInfo.DirectiveKind
3636 assert(TileInfo.ActiveTile &&
"Tile count without object?");
3637 Diag(TileInfo.ActiveTile->getBeginLoc(), diag::note_acc_active_clause_here)
3645 llvm::find_if(Clauses,
3651 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3653 << GetListOfClauses(
3663 llvm::find_if(Clauses,
3666 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3668 << GetListOfClauses({
3676 llvm::find_if(Clauses,
3679 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3681 << GetListOfClauses({
3689 llvm::find_if(Clauses, llvm::IsaPred<OpenACCUseDeviceClause>) ==
3691 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3702 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3712 return diagnoseConstructAppertainment(*
this, K, StartLoc,
true);
3730 AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3737 AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3741 getASTContext(), ActiveComputeConstructInfo.Kind, StartLoc, DirLoc,
3742 EndLoc, Clauses, AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3747 AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3760 AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3764 getASTContext(), StartLoc, DirLoc, LParenLoc, Exprs.front(), MiscLoc,
3765 Exprs.drop_front(), RParenLoc, EndLoc, Clauses);
3784 llvm_unreachable(
"Unhandled case in directive handling?");
3792 llvm_unreachable(
"Unimplemented associated statement application");
3800 "these don't have associated statements, so shouldn't get here");
3823 if (!isa<CXXForRangeStmt, ForStmt>(AssocStmt.
get())) {
3826 Diag(DirectiveLoc, diag::note_acc_construct_here) << K;
3830 if (!CollapseInfo.CollapseDepthSatisfied || !TileInfo.TileDepthSatisfied) {
3831 if (!CollapseInfo.CollapseDepthSatisfied) {
3832 Diag(DirectiveLoc, diag::err_acc_insufficient_loops)
3834 assert(CollapseInfo.ActiveCollapse &&
"Collapse count without object?");
3835 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3836 diag::note_acc_active_clause_here)
3840 if (!TileInfo.TileDepthSatisfied) {
3841 Diag(DirectiveLoc, diag::err_acc_insufficient_loops)
3843 assert(TileInfo.ActiveTile &&
"Collapse count without object?");
3844 Diag(TileInfo.ActiveTile->getBeginLoc(),
3845 diag::note_acc_active_clause_here)
3851 return AssocStmt.
get();
3853 llvm_unreachable(
"Invalid associated statement application");
3863 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 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 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)
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.
@ CopyOut
'copyout' clause, allowed on Compute and Combined constructs, plus 'data', 'exit data',...
@ 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',...
@ 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