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());
717 return isNotImplemented();
727 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
738 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCSelfClause>);
739 if (Itr != ExistingClauses.end()) {
741 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
755 return isNotImplemented();
764 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
772 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCIfClause>);
773 if (Itr != ExistingClauses.end()) {
775 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
787 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
814 auto *GangClauseItr =
815 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
816 auto *ReductionClauseItr =
817 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
819 if (GangClauseItr != ExistingClauses.end() &&
820 ReductionClauseItr != ExistingClauses.end()) {
822 diag::err_acc_gang_reduction_numgangs_conflict)
823 << OpenACCClauseKind::Reduction << OpenACCClauseKind::Gang
825 SemaRef.
Diag((*ReductionClauseItr)->getBeginLoc(),
826 diag::note_acc_previous_clause_here);
827 SemaRef.
Diag((*GangClauseItr)->getBeginLoc(),
828 diag::note_acc_previous_clause_here);
840 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
842 if (
Parallel != ExistingClauses.end()) {
844 diag::err_acc_reduction_num_gangs_conflict)
847 SemaRef.
Diag((*Parallel)->getBeginLoc(),
848 diag::note_acc_previous_clause_here);
857 auto GangClauses = llvm::make_filter_range(
858 ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
860 for (
auto *GC : GangClauses) {
861 if (cast<OpenACCGangClause>(GC)->hasExprOfKind(OpenACCGangKind::Num)) {
863 diag::err_acc_num_arg_conflict_reverse)
864 << OpenACCClauseKind::NumGangs << OpenACCClauseKind::Gang
866 SemaRef.
Diag(GC->getBeginLoc(), diag::note_acc_previous_clause_here);
877OpenACCClause *SemaOpenACCClauseVisitor::VisitNumWorkersClause(
882 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
889 auto WorkerClauses = llvm::make_filter_range(
890 ExistingClauses, llvm::IsaPred<OpenACCWorkerClause>);
892 for (
auto *WC : WorkerClauses) {
893 if (cast<OpenACCWorkerClause>(WC)->hasIntExpr()) {
895 diag::err_acc_num_arg_conflict_reverse)
896 << OpenACCClauseKind::NumWorkers << OpenACCClauseKind::Worker
898 SemaRef.
Diag(WC->getBeginLoc(), diag::note_acc_previous_clause_here);
905 "Invalid number of expressions for NumWorkers");
911OpenACCClause *SemaOpenACCClauseVisitor::VisitVectorLengthClause(
916 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
923 auto VectorClauses = llvm::make_filter_range(
924 ExistingClauses, llvm::IsaPred<OpenACCVectorClause>);
926 for (
auto *VC : VectorClauses) {
927 if (cast<OpenACCVectorClause>(VC)->hasIntExpr()) {
929 diag::err_acc_num_arg_conflict_reverse)
930 << OpenACCClauseKind::VectorLength << OpenACCClauseKind::Vector
932 SemaRef.
Diag(VC->getBeginLoc(), diag::note_acc_previous_clause_here);
939 "Invalid number of expressions for NumWorkers");
952 return isNotImplemented();
957 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
961 "Invalid number of expressions for Async");
968OpenACCClause *SemaOpenACCClauseVisitor::VisitDeviceNumClause(
973 return isNotImplemented();
978 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
982 "Invalid number of expressions for device_num");
988OpenACCClause *SemaOpenACCClauseVisitor::VisitDefaultAsyncClause(
992 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
996 "Invalid number of expressions for default_async");
1013OpenACCClause *SemaOpenACCClauseVisitor::VisitFirstPrivateClause(
1024OpenACCClause *SemaOpenACCClauseVisitor::VisitNoCreateClause(
1042 return isNotImplemented();
1059 return isNotImplemented();
1076 return isNotImplemented();
1093 return isNotImplemented();
1119 llvm::erase_if(VarList, [&](
Expr *
E) {
1134 llvm::erase_if(VarList, [&](
Expr *
E) {
1154OpenACCClause *SemaOpenACCClauseVisitor::VisitUseDeviceClause(
1163OpenACCClause *SemaOpenACCClauseVisitor::VisitDevicePtrClause(
1170 return isNotImplemented();
1175 llvm::erase_if(VarList, [&](
Expr *
E) {
1193 return isNotImplemented();
1200OpenACCClause *SemaOpenACCClauseVisitor::VisitDeviceTypeClause(
1207 return isNotImplemented();
1212 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
1229 llvm::find_if(ExistingClauses,
1230 llvm::IsaPred<OpenACCIndependentClause, OpenACCSeqClause>);
1231 if (Itr != ExistingClauses.end()) {
1234 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1242OpenACCClause *SemaOpenACCClauseVisitor::VisitIndependentClause(
1246 const auto *Itr = llvm::find_if(
1247 ExistingClauses, llvm::IsaPred<OpenACCAutoClause, OpenACCSeqClause>);
1248 if (Itr != ExistingClauses.end()) {
1251 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1260 if (isa<OpenACCAsteriskSizeExpr>(
E))
1262 return S.ActOnIntExpr(OpenACCDirectiveKind::Invalid, OpenACCClauseKind::Gang,
1267 return DK == OpenACCDirectiveKind::Loop &&
1268 AssocKind == OpenACCDirectiveKind::Invalid;
1272 return DK == OpenACCDirectiveKind::Loop &&
1273 AssocKind != OpenACCDirectiveKind::Invalid;
1280 << GK << CK << IsOrphanLoop(DK, AssocKind) << DK
1281 << HasAssocKind(DK, AssocKind) << AssocKind;
1288 << TagKind << CK << IsOrphanLoop(DK, AssocKind) << DK
1289 << HasAssocKind(DK, AssocKind) << AssocKind;
1297 case OpenACCGangKind::Static:
1298 return CheckGangStaticExpr(S,
E);
1299 case OpenACCGangKind::Num:
1303 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1304 case OpenACCGangKind::Dim: {
1312 S.ActOnIntExpr(OpenACCDirectiveKind::Invalid, OpenACCClauseKind::Gang,
1321 std::optional<llvm::APSInt> ICE =
1324 if (!ICE || *ICE <= 0 || ICE > 3) {
1326 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
1334 llvm_unreachable(
"Unknown gang kind in gang parallel check");
1346 case OpenACCGangKind::Dim:
1347 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1348 case OpenACCGangKind::Num: {
1360 : S.getActiveComputeConstructInfo().Clauses;
1363 llvm::find_if(Collection, llvm::IsaPred<OpenACCNumGangsClause>);
1365 if (Itr != Collection.end()) {
1367 <<
"num" << OpenACCClauseKind::Gang << DK
1368 << HasAssocKind(DK, AssocKind) << AssocKind
1369 << OpenACCClauseKind::NumGangs;
1371 S.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1376 case OpenACCGangKind::Static:
1377 return CheckGangStaticExpr(S,
E);
1380 llvm_unreachable(
"Unknown gang kind in gang kernels check");
1389 case OpenACCGangKind::Dim:
1390 case OpenACCGangKind::Num:
1391 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1392 case OpenACCGangKind::Static:
1393 return CheckGangStaticExpr(S,
E);
1395 llvm_unreachable(
"Unknown gang kind in gang serial check");
1400 if (DiagIfSeqClause(Clause))
1407 return isNotImplemented();
1414 case OpenACCDirectiveKind::Invalid:
1415 case OpenACCDirectiveKind::Parallel:
1418 case OpenACCDirectiveKind::Serial:
1421 DiagIntArgInvalid(SemaRef, IntExpr,
"length", OpenACCClauseKind::Vector,
1426 case OpenACCDirectiveKind::Kernels: {
1429 llvm::IsaPred<OpenACCVectorLengthClause>);
1432 <<
"length" << OpenACCClauseKind::Vector
1437 << OpenACCClauseKind::VectorLength;
1438 SemaRef.
Diag((*Itr)->getBeginLoc(),
1439 diag::note_acc_previous_clause_here);
1446 llvm_unreachable(
"Non compute construct in active compute construct");
1450 DiagIntArgInvalid(SemaRef, IntExpr,
"length", OpenACCClauseKind::Vector,
1455 OpenACCDirectiveKind::KernelsLoop) {
1456 const auto *Itr = llvm::find_if(
1457 ExistingClauses, llvm::IsaPred<OpenACCVectorLengthClause>);
1458 if (Itr != ExistingClauses.end()) {
1460 <<
"length" << OpenACCClauseKind::Vector
1465 << OpenACCClauseKind::VectorLength;
1466 SemaRef.
Diag((*Itr)->getBeginLoc(),
1467 diag::note_acc_previous_clause_here);
1482 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1483 << OpenACCClauseKind::Vector << OpenACCClauseKind::Vector
1486 diag::note_acc_previous_clause_here);
1498 if (DiagIfSeqClause(Clause))
1505 return isNotImplemented();
1513 case OpenACCDirectiveKind::Invalid:
1514 case OpenACCDirectiveKind::ParallelLoop:
1515 case OpenACCDirectiveKind::SerialLoop:
1516 case OpenACCDirectiveKind::Parallel:
1517 case OpenACCDirectiveKind::Serial:
1518 DiagIntArgInvalid(SemaRef, IntExpr, OpenACCGangKind::Num,
1523 case OpenACCDirectiveKind::KernelsLoop:
1524 case OpenACCDirectiveKind::Kernels: {
1527 llvm::IsaPred<OpenACCNumWorkersClause>);
1534 << OpenACCClauseKind::NumWorkers;
1535 SemaRef.
Diag((*Itr)->getBeginLoc(),
1536 diag::note_acc_previous_clause_here);
1543 llvm_unreachable(
"Non compute construct in active compute construct");
1548 DiagIntArgInvalid(SemaRef, IntExpr, OpenACCGangKind::Num,
1554 "Unknown combined directive kind?");
1555 const auto *Itr = llvm::find_if(ExistingClauses,
1556 llvm::IsaPred<OpenACCNumWorkersClause>);
1557 if (Itr != ExistingClauses.end()) {
1563 << OpenACCClauseKind::NumWorkers;
1564 SemaRef.
Diag((*Itr)->getBeginLoc(),
1565 diag::note_acc_previous_clause_here);
1580 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1581 << OpenACCClauseKind::Worker << OpenACCClauseKind::Worker
1584 diag::note_acc_previous_clause_here);
1594 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1595 << OpenACCClauseKind::Worker << OpenACCClauseKind::Vector
1598 diag::note_acc_previous_clause_here);
1610 if (DiagIfSeqClause(Clause))
1617 return isNotImplemented();
1624 OpenACCDirectiveKind::Invalid) ||
1627 auto ActiveComputeConstructContainer =
1631 auto *NumGangsClauseItr = llvm::find_if(
1632 ActiveComputeConstructContainer, llvm::IsaPred<OpenACCNumGangsClause>);
1634 if (NumGangsClauseItr != ActiveComputeConstructContainer.end() &&
1635 cast<OpenACCNumGangsClause>(*NumGangsClauseItr)->getIntExprs().size() >
1637 auto *ReductionClauseItr =
1638 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
1640 if (ReductionClauseItr != ExistingClauses.end()) {
1642 diag::err_acc_gang_reduction_numgangs_conflict)
1643 << OpenACCClauseKind::Gang << OpenACCClauseKind::Reduction
1646 SemaRef.
Diag((*ReductionClauseItr)->getBeginLoc(),
1647 diag::note_acc_previous_clause_here);
1648 SemaRef.
Diag((*NumGangsClauseItr)->getBeginLoc(),
1649 diag::note_acc_previous_clause_here);
1662 for (
unsigned I = 0; I < Clause.
getIntExprs().size(); ++I) {
1673 if (ExistingElemLoc[
static_cast<unsigned>(GK)].isValid()) {
1675 <<
static_cast<unsigned>(GK);
1676 SemaRef.
Diag(ExistingElemLoc[
static_cast<unsigned>(GK)],
1677 diag::note_acc_previous_expr_here);
1681 ExistingElemLoc[
static_cast<unsigned>(GK)] = ER.
get()->
getBeginLoc();
1682 GangKinds.push_back(GK);
1683 IntExprs.push_back(ER.
get());
1694 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1695 << OpenACCClauseKind::Gang << OpenACCClauseKind::Gang
1699 diag::note_acc_previous_clause_here);
1709 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1710 << OpenACCClauseKind::Gang << OpenACCClauseKind::Worker
1713 diag::note_acc_previous_clause_here);
1723 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1724 << OpenACCClauseKind::Gang << OpenACCClauseKind::Vector
1727 diag::note_acc_previous_clause_here);
1734 GangKinds, IntExprs, Clause.
getEndLoc());
1737OpenACCClause *SemaOpenACCClauseVisitor::VisitFinalizeClause(
1745OpenACCClause *SemaOpenACCClauseVisitor::VisitIfPresentClause(
1748 return isNotImplemented();
1761 return isNotImplemented();
1766 llvm::find_if(ExistingClauses,
1767 llvm::IsaPred<OpenACCAutoClause, OpenACCIndependentClause>);
1768 if (Itr != ExistingClauses.end()) {
1771 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1778 Itr = llvm::find_if(ExistingClauses,
1782 if (Itr != ExistingClauses.end()) {
1783 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_cannot_combine)
1786 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1794OpenACCClause *SemaOpenACCClauseVisitor::VisitReductionClause(
1801 OpenACCDirectiveKind::Invalid) ||
1804 auto ActiveComputeConstructContainer =
1808 auto *NumGangsClauseItr = llvm::find_if(
1809 ActiveComputeConstructContainer, llvm::IsaPred<OpenACCNumGangsClause>);
1811 if (NumGangsClauseItr != ActiveComputeConstructContainer.end() &&
1812 cast<OpenACCNumGangsClause>(*NumGangsClauseItr)->getIntExprs().size() >
1814 auto *GangClauseItr =
1815 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
1817 if (GangClauseItr != ExistingClauses.end()) {
1819 diag::err_acc_gang_reduction_numgangs_conflict)
1820 << OpenACCClauseKind::Reduction << OpenACCClauseKind::Gang
1823 SemaRef.
Diag((*GangClauseItr)->getBeginLoc(),
1824 diag::note_acc_previous_clause_here);
1825 SemaRef.
Diag((*NumGangsClauseItr)->getBeginLoc(),
1826 diag::note_acc_previous_clause_here);
1854 auto NumGangsClauses = llvm::make_filter_range(
1855 ExistingClauses, llvm::IsaPred<OpenACCNumGangsClause>);
1857 for (
auto *NGC : NumGangsClauses) {
1859 cast<OpenACCNumGangsClause>(NGC)->getIntExprs().size();
1863 diag::err_acc_reduction_num_gangs_conflict)
1866 SemaRef.
Diag(NGC->getBeginLoc(), diag::note_acc_previous_clause_here);
1879 ValidVars.push_back(Res.
get());
1888OpenACCClause *SemaOpenACCClauseVisitor::VisitCollapseClause(
1895 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
1908void CollectActiveReductionClauses(
1911 for (
auto *CurClause : CurClauses) {
1912 if (
auto *RedClause = dyn_cast<OpenACCReductionClause>(CurClause);
1913 RedClause && !RedClause->getVarList().empty())
1914 ActiveClauses.push_back(RedClause);
1922 case OpenACCDirectiveKind::Parallel:
1923 case OpenACCDirectiveKind::ParallelLoop:
1924 case OpenACCDirectiveKind::Serial:
1925 case OpenACCDirectiveKind::SerialLoop:
1926 case OpenACCDirectiveKind::Kernels:
1927 case OpenACCDirectiveKind::KernelsLoop:
1928 case OpenACCDirectiveKind::Loop:
1930 case OpenACCDirectiveKind::Data:
1931 case OpenACCDirectiveKind::HostData:
1933 case OpenACCDirectiveKind::EnterData:
1934 case OpenACCDirectiveKind::ExitData:
1935 case OpenACCDirectiveKind::Wait:
1936 case OpenACCDirectiveKind::Init:
1937 case OpenACCDirectiveKind::Shutdown:
1938 case OpenACCDirectiveKind::Set:
1939 llvm_unreachable(
"Doesn't have an associated stmt");
1941 case OpenACCDirectiveKind::Invalid:
1942 llvm_unreachable(
"Unhandled directive kind?");
1944 llvm_unreachable(
"Unhandled directive kind?");
1955 : SemaRef(S), OldActiveComputeConstructInfo(S.ActiveComputeConstructInfo),
1956 DirKind(DK), OldLoopGangClauseOnKernel(S.LoopGangClauseOnKernel),
1957 OldLoopWorkerClauseLoc(S.LoopWorkerClauseLoc),
1958 OldLoopVectorClauseLoc(S.LoopVectorClauseLoc),
1959 OldLoopWithoutSeqInfo(S.LoopWithoutSeqInfo),
1960 ActiveReductionClauses(S.ActiveReductionClauses),
1961 LoopRAII(SemaRef, PreserveLoopRAIIDepthInAssociatedStmtRAII(DirKind)) {
1967 CollectActiveReductionClauses(S.ActiveReductionClauses, Clauses);
1968 SemaRef.ActiveComputeConstructInfo.Kind = DirKind;
1969 SemaRef.ActiveComputeConstructInfo.Clauses = Clauses;
1984 SemaRef.ActiveComputeConstructInfo.Kind = DirKind;
1985 SemaRef.ActiveComputeConstructInfo.Clauses = Clauses;
1987 CollectActiveReductionClauses(S.ActiveReductionClauses, Clauses);
1998 if (Clauses.end() ==
1999 llvm::find_if(Clauses, llvm::IsaPred<OpenACCSeqClause>))
2012 auto *Itr = llvm::find_if(Clauses, llvm::IsaPred<OpenACCGangClause>);
2013 if (Itr != Clauses.end())
2017 if (UnInstClauses.empty()) {
2018 auto *Itr = llvm::find_if(Clauses, llvm::IsaPred<OpenACCWorkerClause>);
2019 if (Itr != Clauses.end())
2022 auto *Itr2 = llvm::find_if(Clauses, llvm::IsaPred<OpenACCVectorClause>);
2023 if (Itr2 != Clauses.end())
2027 CollectActiveReductionClauses(S.ActiveReductionClauses, Clauses);
2034 if (Clauses.end() ==
2035 llvm::find_if(Clauses, llvm::IsaPred<OpenACCSeqClause>))
2048 UnInstClauses.empty()) {
2050 auto *Itr = llvm::find_if(Clauses, llvm::IsaPred<OpenACCGangClause>);
2051 if (Itr != Clauses.end())
2056 if (UnInstClauses.empty()) {
2057 auto *Itr = llvm::find_if(Clauses, llvm::IsaPred<OpenACCWorkerClause>);
2058 if (Itr != Clauses.end())
2061 auto *Itr2 = llvm::find_if(Clauses, llvm::IsaPred<OpenACCVectorClause>);
2062 if (Itr2 != Clauses.end())
2073 SemaRef.LoopInfo.CurLevelHasLoopAlready =
false;
2074 SemaRef.CollapseInfo.CollapseDepthSatisfied =
true;
2075 SemaRef.TileInfo.TileDepthSatisfied =
true;
2082 auto *CollapseClauseItr =
2083 llvm::find_if(Clauses, llvm::IsaPred<OpenACCCollapseClause>);
2084 auto *UnInstCollapseClauseItr =
2085 llvm::find_if(UnInstClauses, llvm::IsaPred<OpenACCCollapseClause>);
2087 if (Clauses.end() == CollapseClauseItr)
2091 cast<OpenACCCollapseClause>(*CollapseClauseItr);
2093 SemaRef.CollapseInfo.ActiveCollapse = CollapseClause;
2103 if (UnInstCollapseClauseItr != UnInstClauses.end() &&
2104 !cast<OpenACCCollapseClause>(*UnInstCollapseClauseItr)
2106 ->isInstantiationDependent())
2109 SemaRef.CollapseInfo.CollapseDepthSatisfied =
false;
2110 SemaRef.CollapseInfo.CurCollapseCount =
2111 cast<ConstantExpr>(LoopCount)->getResultAsAPSInt();
2112 SemaRef.CollapseInfo.DirectiveKind = DirKind;
2121 if (UnInstClauses.size() > 0)
2123 auto *TileClauseItr =
2124 llvm::find_if(Clauses, llvm::IsaPred<OpenACCTileClause>);
2126 if (Clauses.end() == TileClauseItr)
2130 SemaRef.TileInfo.ActiveTile = TileClause;
2131 SemaRef.TileInfo.TileDepthSatisfied =
false;
2133 SemaRef.TileInfo.DirectiveKind = DirKind;
2144 SemaRef.ActiveComputeConstructInfo = OldActiveComputeConstructInfo;
2145 SemaRef.LoopGangClauseOnKernel = OldLoopGangClauseOnKernel;
2146 SemaRef.LoopWorkerClauseLoc = OldLoopWorkerClauseLoc;
2147 SemaRef.LoopVectorClauseLoc = OldLoopVectorClauseLoc;
2148 SemaRef.LoopWithoutSeqInfo = OldLoopWithoutSeqInfo;
2149 SemaRef.ActiveReductionClauses.swap(ActiveReductionClauses);
2171 if (
const auto *DevTypeClause =
2172 llvm::find_if(ExistingClauses,
2174 return isa<OpenACCDeviceTypeClause>(
C);
2176 DevTypeClause != ExistingClauses.end()) {
2177 if (checkValidAfterDeviceType(
2178 *
this, *cast<OpenACCDeviceTypeClause>(*DevTypeClause), Clause))
2182 SemaOpenACCClauseVisitor Visitor{*
this, ExistingClauses};
2185 "Created wrong clause?");
2187 if (Visitor.diagNotImplemented())
2198bool areVarsEqual(
Expr *VarExpr1,
Expr *VarExpr2) {
2210 if (isa<ArraySectionExpr>(VarExpr1)) {
2211 auto *Expr2AS = dyn_cast<ArraySectionExpr>(VarExpr2);
2215 auto *Expr1AS = cast<ArraySectionExpr>(VarExpr1);
2217 if (!areVarsEqual(Expr1AS->getBase(), Expr2AS->getBase()))
2225 if (isa<ArraySubscriptExpr>(VarExpr1)) {
2226 auto *Expr2AS = dyn_cast<ArraySubscriptExpr>(VarExpr2);
2230 auto *Expr1AS = cast<ArraySubscriptExpr>(VarExpr1);
2232 if (!areVarsEqual(Expr1AS->getBase(), Expr2AS->getBase()))
2242 if (isa<DeclRefExpr>(VarExpr1)) {
2243 auto *Expr2DRE = dyn_cast<DeclRefExpr>(VarExpr2);
2247 auto *Expr1DRE = cast<DeclRefExpr>(VarExpr1);
2249 return Expr1DRE->getDecl()->getMostRecentDecl() ==
2250 Expr2DRE->getDecl()->getMostRecentDecl();
2253 llvm_unreachable(
"Unknown variable type encountered");
2269 auto TypeIsValid = [](
QualType Ty) {
2270 return Ty->isDependentType() || Ty->isScalarType();
2273 if (isa<ArraySectionExpr>(VarExpr)) {
2274 Expr *ASExpr = VarExpr;
2278 if (!TypeIsValid(EltTy)) {
2284 if (!RD->isStruct() && !RD->isClass()) {
2285 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2290 if (!RD->isCompleteDefinition()) {
2291 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2295 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD);
2296 CXXRD && !CXXRD->isAggregate()) {
2297 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2303 if (!TypeIsValid(FD->getType())) {
2305 diag::err_acc_reduction_composite_member_type);
2306 Diag(FD->getLocation(), diag::note_acc_reduction_composite_member_loc);
2310 }
else if (!TypeIsValid(VarExpr->
getType())) {
2321 if (RClause->getReductionOp() == ReductionOp)
2324 for (
Expr *OldVarExpr : RClause->getVarList()) {
2325 if (OldVarExpr->isInstantiationDependent())
2328 if (areVarsEqual(VarExpr, OldVarExpr)) {
2330 << ReductionOp << RClause->getReductionOp();
2331 Diag(OldVarExpr->getExprLoc(), diag::note_acc_previous_clause_here);
2376 Diag(DirLoc, diag::warn_acc_construct_unimplemented) << K;
2391 "Only one of directive or clause kind should be provided");
2400 unsigned getDiagKind()
const {
2401 if (ClauseKind != OpenACCClauseKind::Invalid)
2403 if (DirectiveKind != OpenACCDirectiveKind::Invalid)
2411 : ICEConvertDiagnoser(
false,
2414 DirectiveKind(DK), ClauseKind(CK), IntExpr(IntExpr) {}
2423 return S.
Diag(
Loc, diag::err_acc_int_expr_requires_integer)
2424 << getDiagKind() << ClauseKind << DirectiveKind <<
T;
2429 return S.
Diag(
Loc, diag::err_acc_int_expr_incomplete_class_type)
2436 return S.
Diag(
Loc, diag::err_acc_int_expr_explicit_conversion)
2443 return S.
Diag(Conv->
getLocation(), diag::note_acc_int_expr_conversion)
2449 return S.
Diag(
Loc, diag::err_acc_int_expr_multiple_conversions) <<
T;
2454 return S.
Diag(Conv->
getLocation(), diag::note_acc_int_expr_conversion)
2461 llvm_unreachable(
"conversion functions are permitted");
2463 } IntExprDiagnoser(DK, CK, IntExpr);
2469 Loc, IntExpr, IntExprDiagnoser);
2473 IntExpr = IntExprResult.
get();
2495 Diag(VarExpr->
getExprLoc(), diag::note_acc_expected_pointer_var);
2507 return Diag(VarExpr->
getExprLoc(), diag::err_acc_var_not_pointer_type)
2508 << ClauseKind << Ty;
2519 isa<ArraySectionExpr, ArraySubscriptExpr>(CurVarExpr)) {
2520 Diag(VarExpr->
getExprLoc(), diag::err_acc_not_a_var_ref_use_device);
2526 while (isa<ArraySectionExpr, ArraySubscriptExpr>(CurVarExpr)) {
2527 if (
auto *SubScrpt = dyn_cast<ArraySubscriptExpr>(CurVarExpr))
2535 if (
const auto *DRE = dyn_cast<DeclRefExpr>(CurVarExpr)) {
2536 if (isa<VarDecl, NonTypeTemplateParmDecl>(
2537 DRE->getFoundDecl()->getCanonicalDecl()))
2549 if (
const auto *ME = dyn_cast<MemberExpr>(CurVarExpr)) {
2550 if (isa<FieldDecl>(ME->getMemberDecl()->getCanonicalDecl()))
2562 if (isa<DependentScopeDeclRefExpr>(CurVarExpr) ||
2564 isa<CXXDependentScopeMemberExpr>(CurVarExpr)))
2569 if (isa<RecoveryExpr>(CurVarExpr))
2573 Diag(VarExpr->
getExprLoc(), diag::err_acc_not_a_var_ref_use_device);
2588 if (
Base->hasPlaceholderType() &&
2589 !
Base->hasPlaceholderType(BuiltinType::ArraySection)) {
2602 LowerBound =
Result.get();
2604 if (Length && Length->getType()->isNonOverloadPlaceholderType()) {
2618 if (!
Base->isTypeDependent()) {
2625 Diag(
Base->getExprLoc(), diag::err_acc_typecheck_subarray_value)
2626 <<
Base->getSourceRange());
2630 Diag(
Base->getExprLoc(), diag::err_acc_subarray_function_type)
2631 << ResultTy <<
Base->getSourceRange();
2636 diag::err_acc_subarray_incomplete_type,
2640 if (!
Base->hasPlaceholderType(BuiltinType::ArraySection)) {
2651 return Recovery.
isUsable() ? Recovery.
get() :
nullptr;
2666 if (Length && !Length->isTypeDependent()) {
2669 Length->getExprLoc(), Length);
2678 if (!Length && (OriginalBaseTy.
isNull() ||
2683 Diag(ColonLoc, diag::err_acc_subarray_no_length) << IsArray;
2688 Length = Recovery.
isUsable() ? Recovery.
get() :
nullptr;
2699 std::optional<llvm::APSInt> BaseSize;
2702 BaseSize = ArrayTy->
getSize();
2705 auto GetBoundValue = [&](
Expr *
E) -> std::optional<llvm::APSInt> {
2707 return std::nullopt;
2711 return std::nullopt;
2715 std::optional<llvm::APSInt> LowerBoundValue = GetBoundValue(LowerBound);
2716 std::optional<llvm::APSInt> LengthValue = GetBoundValue(Length);
2719 if (LowerBoundValue.has_value()) {
2720 if (LowerBoundValue->isNegative()) {
2722 << 0 <<
toString(*LowerBoundValue, 10);
2723 LowerBoundValue.reset();
2724 LowerBound = GetRecovery(LowerBound, LowerBound->
getType());
2725 }
else if (BaseSize.has_value() &&
2726 llvm::APSInt::compareValues(*LowerBoundValue, *BaseSize) >= 0) {
2728 Diag(LowerBound->
getExprLoc(), diag::err_acc_subarray_out_of_range)
2729 << 0 <<
toString(*LowerBoundValue, 10)
2731 LowerBoundValue.reset();
2732 LowerBound = GetRecovery(LowerBound, LowerBound->
getType());
2737 if (LengthValue.has_value()) {
2738 if (LengthValue->isNegative()) {
2739 Diag(Length->getExprLoc(), diag::err_acc_subarray_negative)
2740 << 1 <<
toString(*LengthValue, 10);
2741 LengthValue.reset();
2742 Length = GetRecovery(Length, Length->getType());
2743 }
else if (BaseSize.has_value() &&
2744 llvm::APSInt::compareValues(*LengthValue, *BaseSize) > 0) {
2746 Diag(Length->getExprLoc(), diag::err_acc_subarray_out_of_range)
2749 LengthValue.reset();
2750 Length = GetRecovery(Length, Length->getType());
2755 auto AddAPSInt = [](llvm::APSInt LHS, llvm::APSInt RHS) -> llvm::APSInt {
2756 if (LHS.isSigned() == RHS.isSigned())
2759 unsigned Width = std::max(LHS.getBitWidth(), RHS.getBitWidth()) + 1;
2760 return llvm::APSInt(LHS.sext(Width) + RHS.sext(Width),
true);
2765 if (BaseSize.has_value() && LowerBoundValue.has_value() &&
2766 LengthValue.has_value() &&
2767 llvm::APSInt::compareValues(AddAPSInt(*LowerBoundValue, *LengthValue),
2770 diag::err_acc_subarray_base_plus_length_out_of_range)
2775 LowerBoundValue.reset();
2776 LowerBound = GetRecovery(LowerBound, LowerBound->
getType());
2777 LengthValue.reset();
2778 Length = GetRecovery(Length, Length->getType());
2783 if (
Base->isTypeDependent() ||
2785 (Length && Length->isInstantiationDependent()))
2788 return new (Context)
2799 "Loop argument non integer?");
2805 std::optional<llvm::APSInt> ICE =
2811 if (!ICE || *ICE <= 0) {
2813 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
2831 return CheckGangParallelExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2834 return CheckGangSerialExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2837 return CheckGangKernelsExpr(*
this, ExistingClauses, DK,
2838 ActiveComputeConstructInfo.Kind, GK,
E);
2840 switch (ActiveComputeConstructInfo.Kind) {
2844 return CheckGangParallelExpr(*
this, DK, ActiveComputeConstructInfo.Kind,
2848 return CheckGangSerialExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2852 return CheckGangKernelsExpr(*
this, ExistingClauses, DK,
2853 ActiveComputeConstructInfo.Kind, GK,
E);
2855 llvm_unreachable(
"Non compute construct in active compute construct?");
2860 llvm_unreachable(
"Invalid directive kind for a Gang clause");
2862 llvm_unreachable(
"Compute construct directive not handled?");
2874 const auto *ReductionItr =
2875 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
2877 if (ReductionItr != ExistingClauses.end()) {
2878 const auto GangZip = llvm::zip_equal(GangKinds, IntExprs);
2879 const auto GangItr = llvm::find_if(GangZip, [](
const auto &Tuple) {
2883 if (GangItr != GangZip.end()) {
2884 const Expr *DimExpr = std::get<1>(*GangItr);
2888 "Improperly formed gang argument");
2889 if (
const auto *DimVal = dyn_cast<ConstantExpr>(DimExpr);
2890 DimVal && DimVal->getResultAsAPSInt() > 1) {
2891 Diag(DimVal->getBeginLoc(), diag::err_acc_gang_reduction_conflict)
2893 Diag((*ReductionItr)->getBeginLoc(),
2894 diag::note_acc_previous_clause_here);
2901 GangKinds, IntExprs, EndLoc);
2914 const auto GangClauses = llvm::make_filter_range(
2915 ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
2917 for (
auto *GC : GangClauses) {
2918 const auto *GangClause = cast<OpenACCGangClause>(GC);
2919 for (
unsigned I = 0; I < GangClause->getNumExprs(); ++I) {
2920 std::pair<OpenACCGangKind, const Expr *> EPair = GangClause->getExpr(I);
2924 if (
const auto *DimVal = dyn_cast<ConstantExpr>(EPair.second);
2925 DimVal && DimVal->getResultAsAPSInt() > 1) {
2926 Diag(BeginLoc, diag::err_acc_gang_reduction_conflict)
2927 << 1 << DirectiveKind;
2928 Diag(GangClause->getBeginLoc(), diag::note_acc_previous_clause_here);
2936 getASTContext(), BeginLoc, LParenLoc, ReductionOp, Vars, EndLoc);
2946 "size argument non integer?");
2950 isa<OpenACCAsteriskSizeExpr>(SizeExpr))
2953 std::optional<llvm::APSInt> ICE =
2958 if (!ICE || *ICE <= 0) {
2960 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
2972 if (!LoopInfo.TopLevelLoopSeen)
2975 if (CollapseInfo.CurCollapseCount && *CollapseInfo.CurCollapseCount > 0) {
2976 Diag(WhileLoc, diag::err_acc_invalid_in_loop)
2977 << 1 << CollapseInfo.DirectiveKind
2979 assert(CollapseInfo.ActiveCollapse &&
"Collapse count without object?");
2980 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
2981 diag::note_acc_active_clause_here)
2986 CollapseInfo.CurCollapseCount = std::nullopt;
2989 if (TileInfo.CurTileCount && *TileInfo.CurTileCount > 0) {
2990 Diag(WhileLoc, diag::err_acc_invalid_in_loop)
2991 << 1 << TileInfo.DirectiveKind
2993 assert(TileInfo.ActiveTile &&
"tile count without object?");
2994 Diag(TileInfo.ActiveTile->getBeginLoc(), diag::note_acc_active_clause_here)
2999 TileInfo.CurTileCount = std::nullopt;
3007 if (!LoopInfo.TopLevelLoopSeen)
3010 if (CollapseInfo.CurCollapseCount && *CollapseInfo.CurCollapseCount > 0) {
3011 Diag(DoLoc, diag::err_acc_invalid_in_loop)
3012 << 2 << CollapseInfo.DirectiveKind
3014 assert(CollapseInfo.ActiveCollapse &&
"Collapse count without object?");
3015 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3016 diag::note_acc_active_clause_here)
3021 CollapseInfo.CurCollapseCount = std::nullopt;
3024 if (TileInfo.CurTileCount && *TileInfo.CurTileCount > 0) {
3025 Diag(DoLoc, diag::err_acc_invalid_in_loop)
3027 assert(TileInfo.ActiveTile &&
"tile count without object?");
3028 Diag(TileInfo.ActiveTile->getBeginLoc(), diag::note_acc_active_clause_here)
3033 TileInfo.CurTileCount = std::nullopt;
3038 ForStmtBeginChecker &
C) {
3039 assert(
getLangOpts().OpenACC &&
"Check enabled when not OpenACC?");
3042 LoopInfo.TopLevelLoopSeen =
true;
3044 if (CollapseInfo.CurCollapseCount && *CollapseInfo.CurCollapseCount > 0) {
3052 if (LoopInfo.CurLevelHasLoopAlready) {
3053 Diag(ForLoc, diag::err_acc_clause_multiple_loops)
3055 assert(CollapseInfo.ActiveCollapse &&
"No collapse object?");
3056 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3057 diag::note_acc_active_clause_here)
3060 --(*CollapseInfo.CurCollapseCount);
3064 if (*CollapseInfo.CurCollapseCount == 0)
3065 CollapseInfo.CollapseDepthSatisfied =
true;
3069 if (TileInfo.CurTileCount && *TileInfo.CurTileCount > 0) {
3072 if (LoopInfo.CurLevelHasLoopAlready) {
3073 Diag(ForLoc, diag::err_acc_clause_multiple_loops)
3075 assert(TileInfo.ActiveTile &&
"No tile object?");
3076 Diag(TileInfo.ActiveTile->getBeginLoc(),
3077 diag::note_acc_active_clause_here)
3080 --(*TileInfo.CurTileCount);
3083 if (*TileInfo.CurTileCount == 0)
3084 TileInfo.TileDepthSatisfied =
true;
3090 LoopInfo.CurLevelHasLoopAlready =
false;
3094bool isValidLoopVariableType(
QualType LoopVarTy) {
3117 for (
const auto *TD :
3118 llvm::make_filter_range(RD->decls(), llvm::IsaPred<TypedefNameDecl>)) {
3119 const auto *TDND = cast<TypedefNameDecl>(TD)->getCanonicalDecl();
3121 if (TDND->getName() !=
"iterator_category")
3125 if (TDND->getUnderlyingType().isNull())
3129 TDND->getUnderlyingType()->getAsCXXRecordDecl();
3132 if (!ItrCategoryDecl)
3135 auto IsRandomAccessIteratorTag = [](
const CXXRecordDecl *RD) {
3136 if (RD->getName() !=
"random_access_iterator_tag")
3142 if (IsRandomAccessIteratorTag(ItrCategoryDecl))
3149 if (IsRandomAccessIteratorTag(BS.getType()->getAsCXXRecordDecl()))
3162void SemaOpenACC::ForStmtBeginChecker::check() {
3168 AlreadyChecked =
true;
3188 if (!RangeFor.has_value())
3192 const DeclStmt *RangeStmt = (*RangeFor)->getBeginStmt();
3201 if (!isValidLoopVariableType(VarType)) {
3203 <<
SemaRef.LoopWithoutSeqInfo.Kind << VarType;
3205 diag::note_acc_construct_here)
3206 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3215 if (Cond.has_value())
3217 if (
Inc.has_value())
3220const ValueDecl *SemaOpenACC::ForStmtBeginChecker::checkInit() {
3224 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3226 diag::note_acc_construct_here)
3227 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3232 auto DiagLoopVar = [&]() {
3235 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3237 diag::note_acc_construct_here)
3238 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3243 if (
const auto *ExprTemp = dyn_cast<ExprWithCleanups>(
Init))
3244 Init = ExprTemp->getSubExpr();
3245 if (
const auto *
E = dyn_cast<Expr>(
Init))
3250 if (
const auto *BO = dyn_cast<BinaryOperator>(
Init)) {
3253 if (!BO->isAssignmentOp())
3254 return DiagLoopVar();
3258 if (
const auto *DRE = dyn_cast<DeclRefExpr>(LHS))
3259 InitVar = DRE->getDecl();
3260 }
else if (
const auto *DS = dyn_cast<DeclStmt>(
Init)) {
3262 if (!DS->isSingleDecl())
3263 return DiagLoopVar();
3265 InitVar = dyn_cast<ValueDecl>(DS->getSingleDecl());
3270 if (!isa<VarDecl>(InitVar))
3271 return DiagLoopVar();
3275 !cast<VarDecl>(InitVar)->hasInit())
3276 return DiagLoopVar();
3278 }
else if (
auto *CE = dyn_cast<CXXOperatorCallExpr>(
Init)) {
3280 if (CE->getOperator() != OO_Equal)
3281 return DiagLoopVar();
3285 if (
auto *DRE = dyn_cast<DeclRefExpr>(LHS)) {
3286 InitVar = DRE->getDecl();
3287 }
else if (
auto *ME = dyn_cast<MemberExpr>(LHS)) {
3288 if (isa<CXXThisExpr>(ME->getBase()->IgnoreParenImpCasts()))
3289 InitVar = ME->getMemberDecl();
3294 return DiagLoopVar();
3300 if (!isValidLoopVariableType(VarType)) {
3303 <<
SemaRef.LoopWithoutSeqInfo.Kind << VarType;
3305 diag::note_acc_construct_here)
3306 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3313void SemaOpenACC::ForStmtBeginChecker::checkCond() {
3315 SemaRef.
Diag(ForLoc, diag::err_acc_loop_terminating_condition)
3316 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3318 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3327void SemaOpenACC::ForStmtBeginChecker::checkInc(
const ValueDecl *
Init) {
3330 SemaRef.
Diag(ForLoc, diag::err_acc_loop_not_monotonic)
3331 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3333 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3336 auto DiagIncVar = [
this] {
3337 SemaRef.
Diag((*Inc)->getBeginLoc(), diag::err_acc_loop_not_monotonic)
3338 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3340 <<
SemaRef.LoopWithoutSeqInfo.Kind;
3344 if (
const auto *ExprTemp = dyn_cast<ExprWithCleanups>(*Inc))
3345 Inc = ExprTemp->getSubExpr();
3346 if (
const auto *
E = dyn_cast<Expr>(*Inc))
3351 if (
const auto *FE = dyn_cast<FullExpr>(
E))
3352 E = FE->getSubExpr();
3358 if (
const auto *DRE = dyn_cast<DeclRefExpr>(
E))
3359 return dyn_cast<ValueDecl>(DRE->getDecl());
3361 if (
const auto *ME = dyn_cast<MemberExpr>(
E))
3362 if (isa<CXXThisExpr>(ME->getBase()->IgnoreParenImpCasts()))
3363 return ME->getMemberDecl();
3371 if (
const auto *UO = dyn_cast<UnaryOperator>(*Inc)) {
3373 if (!UO->isIncrementDecrementOp())
3374 return DiagIncVar();
3376 }
else if (
const auto *BO = dyn_cast<BinaryOperator>(*Inc)) {
3377 switch (BO->getOpcode()) {
3379 return DiagIncVar();
3393 }
else if (
const auto *CE = dyn_cast<CXXOperatorCallExpr>(*Inc)) {
3394 switch (CE->getOperator()) {
3396 return DiagIncVar();
3414 }
else if (
const auto *ME = dyn_cast<CXXMemberCallExpr>(*Inc)) {
3421 return DiagIncVar();
3427 return DiagIncVar();
3434 const Stmt *Second,
const Stmt *OldThird,
3435 const Stmt *Third) {
3439 std::optional<const Stmt *> S;
3440 if (OldSecond == Second)
3444 std::optional<const Stmt *>
T;
3445 if (OldThird == Third)
3450 bool InitChanged =
false;
3451 if (OldFirst !=
First) {
3459 if (
const auto *DS = dyn_cast<DeclStmt>(OldFirst))
3460 if (
const VarDecl *VD = dyn_cast_if_present<VarDecl>(
3461 DS->isSingleDecl() ? DS->getSingleDecl() :
nullptr))
3462 OldVDTy = VD->getType();
3463 if (
const auto *DS = dyn_cast<DeclStmt>(
First))
3464 if (
const VarDecl *VD = dyn_cast_if_present<VarDecl>(
3465 DS->isSingleDecl() ? DS->getSingleDecl() :
nullptr))
3466 NewVDTy = VD->getType();
3473 ForStmtBeginChecker FSBC{*
this, ForLoc,
First, InitChanged, S,
T};
3474 if (!LoopInfo.TopLevelLoopSeen) {
3478 ForStmtBeginHelper(ForLoc, FSBC);
3482 const Stmt *Second,
const Stmt *Third) {
3486 ForStmtBeginChecker FSBC{*
this, ForLoc,
First,
true,
3488 if (!LoopInfo.TopLevelLoopSeen) {
3492 ForStmtBeginHelper(ForLoc, FSBC);
3496 const Stmt *OldRangeFor,
3497 const Stmt *RangeFor) {
3501 std::optional<const CXXForRangeStmt *> RF;
3503 if (OldRangeFor == RangeFor)
3506 RF = cast<CXXForRangeStmt>(RangeFor);
3508 ForStmtBeginChecker FSBC{*
this, ForLoc, RF};
3509 if (!LoopInfo.TopLevelLoopSeen) {
3512 ForStmtBeginHelper(ForLoc, FSBC);
3516 const Stmt *RangeFor) {
3520 ForStmtBeginChecker FSBC{*
this, ForLoc, cast<CXXForRangeStmt>(RangeFor)};
3521 if (!LoopInfo.TopLevelLoopSeen) {
3524 ForStmtBeginHelper(ForLoc, FSBC);
3534 isa<ForStmt, NullStmt, ForStmt, CXXForRangeStmt, WhileStmt, DoStmt>(
3539 if (isa<OpenACCConstructStmt>(CurStmt))
3544 if (
const auto *CS = dyn_cast<CompoundStmt>(CurStmt)) {
3545 for (
const auto *ChildStmt : CS->children()) {
3546 SourceLocation ChildStmtLoc = FindInterveningCodeInLoop(ChildStmt);
3548 return ChildStmtLoc;
3562 LoopInfo.CurLevelHasLoopAlready =
true;
3567 bool IsActiveCollapse = CollapseInfo.CurCollapseCount &&
3568 *CollapseInfo.CurCollapseCount > 0 &&
3569 !CollapseInfo.ActiveCollapse->hasForce();
3570 bool IsActiveTile = TileInfo.CurTileCount && *TileInfo.CurTileCount > 0;
3572 if (IsActiveCollapse || IsActiveTile) {
3575 if (OtherStmtLoc.
isValid() && IsActiveCollapse) {
3576 Diag(OtherStmtLoc, diag::err_acc_intervening_code)
3578 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3579 diag::note_acc_active_clause_here)
3583 if (OtherStmtLoc.
isValid() && IsActiveTile) {
3584 Diag(OtherStmtLoc, diag::err_acc_intervening_code)
3586 Diag(TileInfo.ActiveTile->getBeginLoc(),
3587 diag::note_acc_active_clause_here)
3597 assert(!Clauses.empty() &&
"empty clause list not supported");
3600 llvm::raw_string_ostream OS{Output};
3602 if (Clauses.size() == 1) {
3603 OS <<
'\'' << Clauses[0] <<
'\'';
3612 [&] { OS <<
", "; });
3614 OS <<
" or \'" << Clauses.back() <<
'\'';
3630 if (CollapseInfo.CurCollapseCount && *CollapseInfo.CurCollapseCount > 0) {
3631 Diag(StartLoc, diag::err_acc_invalid_in_loop)
3632 << 0 << CollapseInfo.DirectiveKind
3634 assert(CollapseInfo.ActiveCollapse &&
"Collapse count without object?");
3635 Diag(CollapseInfo.ActiveCollapse->getBeginLoc(),
3636 diag::note_acc_active_clause_here)
3639 if (TileInfo.CurTileCount && *TileInfo.CurTileCount > 0) {
3640 Diag(StartLoc, diag::err_acc_invalid_in_loop)
3641 << 0 << TileInfo.DirectiveKind
3643 assert(TileInfo.ActiveTile &&
"Tile count without object?");
3644 Diag(TileInfo.ActiveTile->getBeginLoc(), diag::note_acc_active_clause_here)
3652 llvm::find_if(Clauses,
3658 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3660 << GetListOfClauses(
3670 llvm::find_if(Clauses,
3673 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3675 << GetListOfClauses({
3683 llvm::find_if(Clauses,
3686 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3688 << GetListOfClauses({
3696 llvm::find_if(Clauses, llvm::IsaPred<OpenACCUseDeviceClause>) ==
3698 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3709 return Diag(StartLoc, diag::err_acc_construct_one_clause_of)
3716 return diagnoseConstructAppertainment(*
this, K, StartLoc,
true);
3734 AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3741 AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3745 getASTContext(), ActiveComputeConstructInfo.Kind, StartLoc, DirLoc,
3746 EndLoc, Clauses, AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3751 AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3764 AssocStmt.
isUsable() ? AssocStmt.
get() :
nullptr);
3768 getASTContext(), StartLoc, DirLoc, LParenLoc, Exprs.front(), MiscLoc,
3769 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 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