27 case OpenACCClauseKind::Default:
28 switch (DirectiveKind) {
29 case OpenACCDirectiveKind::Parallel:
30 case OpenACCDirectiveKind::Serial:
31 case OpenACCDirectiveKind::Kernels:
32 case OpenACCDirectiveKind::ParallelLoop:
33 case OpenACCDirectiveKind::SerialLoop:
34 case OpenACCDirectiveKind::KernelsLoop:
35 case OpenACCDirectiveKind::Data:
40 case OpenACCClauseKind::If:
41 switch (DirectiveKind) {
42 case OpenACCDirectiveKind::Parallel:
43 case OpenACCDirectiveKind::Serial:
44 case OpenACCDirectiveKind::Kernels:
45 case OpenACCDirectiveKind::Data:
46 case OpenACCDirectiveKind::EnterData:
47 case OpenACCDirectiveKind::ExitData:
48 case OpenACCDirectiveKind::HostData:
49 case OpenACCDirectiveKind::Init:
50 case OpenACCDirectiveKind::Shutdown:
51 case OpenACCDirectiveKind::Set:
52 case OpenACCDirectiveKind::Update:
53 case OpenACCDirectiveKind::Wait:
54 case OpenACCDirectiveKind::ParallelLoop:
55 case OpenACCDirectiveKind::SerialLoop:
56 case OpenACCDirectiveKind::KernelsLoop:
61 case OpenACCClauseKind::Self:
62 switch (DirectiveKind) {
63 case OpenACCDirectiveKind::Parallel:
64 case OpenACCDirectiveKind::Serial:
65 case OpenACCDirectiveKind::Kernels:
66 case OpenACCDirectiveKind::Update:
67 case OpenACCDirectiveKind::ParallelLoop:
68 case OpenACCDirectiveKind::SerialLoop:
69 case OpenACCDirectiveKind::KernelsLoop:
74 case OpenACCClauseKind::NumGangs:
75 case OpenACCClauseKind::NumWorkers:
76 case OpenACCClauseKind::VectorLength:
77 switch (DirectiveKind) {
78 case OpenACCDirectiveKind::Parallel:
79 case OpenACCDirectiveKind::Kernels:
80 case OpenACCDirectiveKind::ParallelLoop:
81 case OpenACCDirectiveKind::KernelsLoop:
86 case OpenACCClauseKind::FirstPrivate:
87 switch (DirectiveKind) {
88 case OpenACCDirectiveKind::Parallel:
89 case OpenACCDirectiveKind::Serial:
90 case OpenACCDirectiveKind::ParallelLoop:
91 case OpenACCDirectiveKind::SerialLoop:
96 case OpenACCClauseKind::Private:
97 switch (DirectiveKind) {
98 case OpenACCDirectiveKind::Parallel:
99 case OpenACCDirectiveKind::Serial:
100 case OpenACCDirectiveKind::Loop:
101 case OpenACCDirectiveKind::ParallelLoop:
102 case OpenACCDirectiveKind::SerialLoop:
103 case OpenACCDirectiveKind::KernelsLoop:
108 case OpenACCClauseKind::NoCreate:
109 switch (DirectiveKind) {
110 case OpenACCDirectiveKind::Parallel:
111 case OpenACCDirectiveKind::Serial:
112 case OpenACCDirectiveKind::Kernels:
113 case OpenACCDirectiveKind::Data:
114 case OpenACCDirectiveKind::ParallelLoop:
115 case OpenACCDirectiveKind::SerialLoop:
116 case OpenACCDirectiveKind::KernelsLoop:
121 case OpenACCClauseKind::Present:
122 switch (DirectiveKind) {
123 case OpenACCDirectiveKind::Parallel:
124 case OpenACCDirectiveKind::Serial:
125 case OpenACCDirectiveKind::Kernels:
126 case OpenACCDirectiveKind::Data:
127 case OpenACCDirectiveKind::Declare:
128 case OpenACCDirectiveKind::ParallelLoop:
129 case OpenACCDirectiveKind::SerialLoop:
130 case OpenACCDirectiveKind::KernelsLoop:
136 case OpenACCClauseKind::Copy:
137 case OpenACCClauseKind::PCopy:
138 case OpenACCClauseKind::PresentOrCopy:
139 switch (DirectiveKind) {
140 case OpenACCDirectiveKind::Parallel:
141 case OpenACCDirectiveKind::Serial:
142 case OpenACCDirectiveKind::Kernels:
143 case OpenACCDirectiveKind::Data:
144 case OpenACCDirectiveKind::Declare:
145 case OpenACCDirectiveKind::ParallelLoop:
146 case OpenACCDirectiveKind::SerialLoop:
147 case OpenACCDirectiveKind::KernelsLoop:
152 case OpenACCClauseKind::CopyIn:
153 case OpenACCClauseKind::PCopyIn:
154 case OpenACCClauseKind::PresentOrCopyIn:
155 switch (DirectiveKind) {
156 case OpenACCDirectiveKind::Parallel:
157 case OpenACCDirectiveKind::Serial:
158 case OpenACCDirectiveKind::Kernels:
159 case OpenACCDirectiveKind::Data:
160 case OpenACCDirectiveKind::EnterData:
161 case OpenACCDirectiveKind::Declare:
162 case OpenACCDirectiveKind::ParallelLoop:
163 case OpenACCDirectiveKind::SerialLoop:
164 case OpenACCDirectiveKind::KernelsLoop:
169 case OpenACCClauseKind::CopyOut:
170 case OpenACCClauseKind::PCopyOut:
171 case OpenACCClauseKind::PresentOrCopyOut:
172 switch (DirectiveKind) {
173 case OpenACCDirectiveKind::Parallel:
174 case OpenACCDirectiveKind::Serial:
175 case OpenACCDirectiveKind::Kernels:
176 case OpenACCDirectiveKind::Data:
177 case OpenACCDirectiveKind::ExitData:
178 case OpenACCDirectiveKind::Declare:
179 case OpenACCDirectiveKind::ParallelLoop:
180 case OpenACCDirectiveKind::SerialLoop:
181 case OpenACCDirectiveKind::KernelsLoop:
186 case OpenACCClauseKind::Create:
187 case OpenACCClauseKind::PCreate:
188 case OpenACCClauseKind::PresentOrCreate:
189 switch (DirectiveKind) {
190 case OpenACCDirectiveKind::Parallel:
191 case OpenACCDirectiveKind::Serial:
192 case OpenACCDirectiveKind::Kernels:
193 case OpenACCDirectiveKind::Data:
194 case OpenACCDirectiveKind::EnterData:
195 case OpenACCDirectiveKind::ParallelLoop:
196 case OpenACCDirectiveKind::SerialLoop:
197 case OpenACCDirectiveKind::KernelsLoop:
203 case OpenACCClauseKind::Attach:
204 switch (DirectiveKind) {
205 case OpenACCDirectiveKind::Parallel:
206 case OpenACCDirectiveKind::Serial:
207 case OpenACCDirectiveKind::Kernels:
208 case OpenACCDirectiveKind::Data:
209 case OpenACCDirectiveKind::EnterData:
210 case OpenACCDirectiveKind::ParallelLoop:
211 case OpenACCDirectiveKind::SerialLoop:
212 case OpenACCDirectiveKind::KernelsLoop:
217 case OpenACCClauseKind::DevicePtr:
218 switch (DirectiveKind) {
219 case OpenACCDirectiveKind::Parallel:
220 case OpenACCDirectiveKind::Serial:
221 case OpenACCDirectiveKind::Kernels:
222 case OpenACCDirectiveKind::Data:
223 case OpenACCDirectiveKind::Declare:
224 case OpenACCDirectiveKind::ParallelLoop:
225 case OpenACCDirectiveKind::SerialLoop:
226 case OpenACCDirectiveKind::KernelsLoop:
231 case OpenACCClauseKind::Async:
232 switch (DirectiveKind) {
233 case OpenACCDirectiveKind::Parallel:
234 case OpenACCDirectiveKind::Serial:
235 case OpenACCDirectiveKind::Kernels:
236 case OpenACCDirectiveKind::Data:
237 case OpenACCDirectiveKind::EnterData:
238 case OpenACCDirectiveKind::ExitData:
239 case OpenACCDirectiveKind::Set:
240 case OpenACCDirectiveKind::Update:
241 case OpenACCDirectiveKind::Wait:
242 case OpenACCDirectiveKind::ParallelLoop:
243 case OpenACCDirectiveKind::SerialLoop:
244 case OpenACCDirectiveKind::KernelsLoop:
249 case OpenACCClauseKind::Wait:
250 switch (DirectiveKind) {
251 case OpenACCDirectiveKind::Parallel:
252 case OpenACCDirectiveKind::Serial:
253 case OpenACCDirectiveKind::Kernels:
254 case OpenACCDirectiveKind::Data:
255 case OpenACCDirectiveKind::EnterData:
256 case OpenACCDirectiveKind::ExitData:
257 case OpenACCDirectiveKind::Update:
258 case OpenACCDirectiveKind::ParallelLoop:
259 case OpenACCDirectiveKind::SerialLoop:
260 case OpenACCDirectiveKind::KernelsLoop:
266 case OpenACCClauseKind::Seq:
267 switch (DirectiveKind) {
268 case OpenACCDirectiveKind::Loop:
269 case OpenACCDirectiveKind::Routine:
270 case OpenACCDirectiveKind::ParallelLoop:
271 case OpenACCDirectiveKind::SerialLoop:
272 case OpenACCDirectiveKind::KernelsLoop:
278 case OpenACCClauseKind::Independent:
279 case OpenACCClauseKind::Auto:
280 switch (DirectiveKind) {
281 case OpenACCDirectiveKind::Loop:
282 case OpenACCDirectiveKind::ParallelLoop:
283 case OpenACCDirectiveKind::SerialLoop:
284 case OpenACCDirectiveKind::KernelsLoop:
290 case OpenACCClauseKind::Reduction:
291 switch (DirectiveKind) {
292 case OpenACCDirectiveKind::Parallel:
293 case OpenACCDirectiveKind::Serial:
294 case OpenACCDirectiveKind::Loop:
295 case OpenACCDirectiveKind::ParallelLoop:
296 case OpenACCDirectiveKind::SerialLoop:
297 case OpenACCDirectiveKind::KernelsLoop:
303 case OpenACCClauseKind::DeviceType:
304 case OpenACCClauseKind::DType:
305 switch (DirectiveKind) {
306 case OpenACCDirectiveKind::Parallel:
307 case OpenACCDirectiveKind::Serial:
308 case OpenACCDirectiveKind::Kernels:
309 case OpenACCDirectiveKind::Data:
310 case OpenACCDirectiveKind::Init:
311 case OpenACCDirectiveKind::Shutdown:
312 case OpenACCDirectiveKind::Set:
313 case OpenACCDirectiveKind::Update:
314 case OpenACCDirectiveKind::Loop:
315 case OpenACCDirectiveKind::Routine:
316 case OpenACCDirectiveKind::ParallelLoop:
317 case OpenACCDirectiveKind::SerialLoop:
318 case OpenACCDirectiveKind::KernelsLoop:
324 case OpenACCClauseKind::Collapse: {
325 switch (DirectiveKind) {
326 case OpenACCDirectiveKind::Loop:
327 case OpenACCDirectiveKind::ParallelLoop:
328 case OpenACCDirectiveKind::SerialLoop:
329 case OpenACCDirectiveKind::KernelsLoop:
335 case OpenACCClauseKind::Tile: {
336 switch (DirectiveKind) {
337 case OpenACCDirectiveKind::Loop:
338 case OpenACCDirectiveKind::ParallelLoop:
339 case OpenACCDirectiveKind::SerialLoop:
340 case OpenACCDirectiveKind::KernelsLoop:
347 case OpenACCClauseKind::Gang: {
348 switch (DirectiveKind) {
349 case OpenACCDirectiveKind::Loop:
350 case OpenACCDirectiveKind::ParallelLoop:
351 case OpenACCDirectiveKind::SerialLoop:
352 case OpenACCDirectiveKind::KernelsLoop:
353 case OpenACCDirectiveKind::Routine:
358 case OpenACCClauseKind::Worker: {
359 switch (DirectiveKind) {
360 case OpenACCDirectiveKind::Loop:
361 case OpenACCDirectiveKind::ParallelLoop:
362 case OpenACCDirectiveKind::SerialLoop:
363 case OpenACCDirectiveKind::KernelsLoop:
364 case OpenACCDirectiveKind::Routine:
370 case OpenACCClauseKind::Vector: {
371 switch (DirectiveKind) {
372 case OpenACCDirectiveKind::Loop:
373 case OpenACCDirectiveKind::ParallelLoop:
374 case OpenACCDirectiveKind::SerialLoop:
375 case OpenACCDirectiveKind::KernelsLoop:
376 case OpenACCDirectiveKind::Routine:
382 case OpenACCClauseKind::Finalize: {
383 switch (DirectiveKind) {
384 case OpenACCDirectiveKind::ExitData:
390 case OpenACCClauseKind::IfPresent: {
391 switch (DirectiveKind) {
392 case OpenACCDirectiveKind::HostData:
393 case OpenACCDirectiveKind::Update:
399 case OpenACCClauseKind::Delete: {
400 switch (DirectiveKind) {
401 case OpenACCDirectiveKind::ExitData:
408 case OpenACCClauseKind::Detach: {
409 switch (DirectiveKind) {
410 case OpenACCDirectiveKind::ExitData:
417 case OpenACCClauseKind::DeviceNum: {
418 switch (DirectiveKind) {
419 case OpenACCDirectiveKind::Init:
420 case OpenACCDirectiveKind::Shutdown:
421 case OpenACCDirectiveKind::Set:
428 case OpenACCClauseKind::UseDevice: {
429 switch (DirectiveKind) {
430 case OpenACCDirectiveKind::HostData:
436 case OpenACCClauseKind::DefaultAsync: {
437 switch (DirectiveKind) {
438 case OpenACCDirectiveKind::Set:
444 case OpenACCClauseKind::Device: {
445 switch (DirectiveKind) {
446 case OpenACCDirectiveKind::Update:
452 case OpenACCClauseKind::Host: {
453 switch (DirectiveKind) {
454 case OpenACCDirectiveKind::Update:
466 llvm_unreachable(
"Invalid clause kind");
469bool checkAlreadyHasClauseOfKind(
472 const auto *Itr = llvm::find_if(ExistingClauses, [&](
const OpenACCClause *
C) {
475 if (Itr != ExistingClauses.end()) {
476 S.
Diag(Clause.
getBeginLoc(), diag::err_acc_duplicate_clause_disallowed)
478 S.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
483bool checkValidAfterDeviceType(
488 if (NewClause.getDirectiveKind() == OpenACCDirectiveKind::Routine)
507 case OpenACCClauseKind::Async:
508 case OpenACCClauseKind::Wait:
509 case OpenACCClauseKind::NumGangs:
510 case OpenACCClauseKind::NumWorkers:
511 case OpenACCClauseKind::VectorLength:
516 }
else if (NewClause.getDirectiveKind() == OpenACCDirectiveKind::Loop) {
521 case OpenACCClauseKind::Collapse:
522 case OpenACCClauseKind::Gang:
523 case OpenACCClauseKind::Worker:
524 case OpenACCClauseKind::Vector:
525 case OpenACCClauseKind::Seq:
526 case OpenACCClauseKind::Independent:
527 case OpenACCClauseKind::Auto:
528 case OpenACCClauseKind::Tile:
536 case OpenACCClauseKind::Async:
537 case OpenACCClauseKind::Wait:
538 case OpenACCClauseKind::NumGangs:
539 case OpenACCClauseKind::NumWorkers:
540 case OpenACCClauseKind::VectorLength:
541 case OpenACCClauseKind::Collapse:
542 case OpenACCClauseKind::Gang:
543 case OpenACCClauseKind::Worker:
544 case OpenACCClauseKind::Vector:
545 case OpenACCClauseKind::Seq:
546 case OpenACCClauseKind::Independent:
547 case OpenACCClauseKind::Auto:
548 case OpenACCClauseKind::Tile:
553 }
else if (NewClause.getDirectiveKind() == OpenACCDirectiveKind::Data) {
557 case OpenACCClauseKind::Async:
558 case OpenACCClauseKind::Wait:
563 }
else if (NewClause.getDirectiveKind() == OpenACCDirectiveKind::Set ||
564 NewClause.getDirectiveKind() == OpenACCDirectiveKind::Init ||
565 NewClause.getDirectiveKind() == OpenACCDirectiveKind::Shutdown) {
568 }
else if (NewClause.getDirectiveKind() == OpenACCDirectiveKind::Update) {
572 case OpenACCClauseKind::Async:
573 case OpenACCClauseKind::Wait:
579 S.
Diag(NewClause.
getBeginLoc(), diag::err_acc_clause_after_device_type)
581 << NewClause.getDirectiveKind();
582 S.
Diag(DeviceTypeClause.
getBeginLoc(), diag::note_acc_previous_clause_here);
591 return DK != OpenACCDirectiveKind::Declare &&
592 DK != OpenACCDirectiveKind::Atomic &&
593 DK != OpenACCDirectiveKind::Routine;
596class SemaOpenACCClauseVisitor {
600 bool NotImplemented =
false;
603 NotImplemented =
true;
612 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCSeqClause>);
614 if (Itr != ExistingClauses.end()) {
615 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_cannot_combine)
618 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
628 : SemaRef(S), Ctx(S.getASTContext()), ExistingClauses(ExistingClauses) {}
632 bool diagNotImplemented() {
return NotImplemented; }
636#define VISIT_CLAUSE(CLAUSE_NAME) \
637 case OpenACCClauseKind::CLAUSE_NAME: \
638 return Visit##CLAUSE_NAME##Clause(Clause);
639#define CLAUSE_ALIAS(ALIAS, CLAUSE_NAME, DEPRECATED) \
640 case OpenACCClauseKind::ALIAS: \
642 SemaRef.Diag(Clause.getBeginLoc(), diag::warn_acc_deprecated_alias_name) \
643 << Clause.getClauseKind() << OpenACCClauseKind::CLAUSE_NAME; \
644 return Visit##CLAUSE_NAME##Clause(Clause);
645#include "clang/Basic/OpenACCClauses.def"
647 return isNotImplemented();
649 llvm_unreachable(
"Invalid clause kind");
652#define VISIT_CLAUSE(CLAUSE_NAME) \
653 OpenACCClause *Visit##CLAUSE_NAME##Clause( \
654 SemaOpenACC::OpenACCParsedClause &Clause);
655#include "clang/Basic/OpenACCClauses.def"
668 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
684 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
696 NewSizeExprs.push_back(Res.
get());
714 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
724 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCSelfClause>);
725 if (Itr != ExistingClauses.end()) {
727 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
741 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
752 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCIfClause>);
753 if (Itr != ExistingClauses.end()) {
755 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
767 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
794 auto *GangClauseItr =
795 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
796 auto *ReductionClauseItr =
797 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
799 if (GangClauseItr != ExistingClauses.end() &&
800 ReductionClauseItr != ExistingClauses.end()) {
802 diag::err_acc_gang_reduction_numgangs_conflict)
803 << OpenACCClauseKind::Reduction << OpenACCClauseKind::Gang
805 SemaRef.
Diag((*ReductionClauseItr)->getBeginLoc(),
806 diag::note_acc_previous_clause_here);
807 SemaRef.
Diag((*GangClauseItr)->getBeginLoc(),
808 diag::note_acc_previous_clause_here);
820 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
822 if (
Parallel != ExistingClauses.end()) {
824 diag::err_acc_reduction_num_gangs_conflict)
827 SemaRef.
Diag((*Parallel)->getBeginLoc(),
828 diag::note_acc_previous_clause_here);
837 auto GangClauses = llvm::make_filter_range(
838 ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
840 for (
auto *GC : GangClauses) {
841 if (cast<OpenACCGangClause>(GC)->hasExprOfKind(OpenACCGangKind::Num)) {
843 diag::err_acc_num_arg_conflict_reverse)
844 << OpenACCClauseKind::NumGangs << OpenACCClauseKind::Gang
846 SemaRef.
Diag(GC->getBeginLoc(), diag::note_acc_previous_clause_here);
857OpenACCClause *SemaOpenACCClauseVisitor::VisitNumWorkersClause(
862 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
869 auto WorkerClauses = llvm::make_filter_range(
870 ExistingClauses, llvm::IsaPred<OpenACCWorkerClause>);
872 for (
auto *WC : WorkerClauses) {
873 if (cast<OpenACCWorkerClause>(WC)->hasIntExpr()) {
875 diag::err_acc_num_arg_conflict_reverse)
876 << OpenACCClauseKind::NumWorkers << OpenACCClauseKind::Worker
878 SemaRef.
Diag(WC->getBeginLoc(), diag::note_acc_previous_clause_here);
885 "Invalid number of expressions for NumWorkers");
891OpenACCClause *SemaOpenACCClauseVisitor::VisitVectorLengthClause(
896 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
903 auto VectorClauses = llvm::make_filter_range(
904 ExistingClauses, llvm::IsaPred<OpenACCVectorClause>);
906 for (
auto *VC : VectorClauses) {
907 if (cast<OpenACCVectorClause>(VC)->hasIntExpr()) {
909 diag::err_acc_num_arg_conflict_reverse)
910 << OpenACCClauseKind::VectorLength << OpenACCClauseKind::Vector
912 SemaRef.
Diag(VC->getBeginLoc(), diag::note_acc_previous_clause_here);
919 "Invalid number of expressions for NumWorkers");
930 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
934 "Invalid number of expressions for Async");
941OpenACCClause *SemaOpenACCClauseVisitor::VisitDeviceNumClause(
946 return isNotImplemented();
951 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
955 "Invalid number of expressions for device_num");
961OpenACCClause *SemaOpenACCClauseVisitor::VisitDefaultAsyncClause(
965 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
969 "Invalid number of expressions for default_async");
986OpenACCClause *SemaOpenACCClauseVisitor::VisitFirstPrivateClause(
1015 return isNotImplemented();
1054 return isNotImplemented();
1071 return isNotImplemented();
1088 return isNotImplemented();
1114 llvm::erase_if(VarList, [&](
Expr *
E) {
1129 llvm::erase_if(VarList, [&](
Expr *
E) {
1149OpenACCClause *SemaOpenACCClauseVisitor::VisitUseDeviceClause(
1158OpenACCClause *SemaOpenACCClauseVisitor::VisitDevicePtrClause(
1165 return isNotImplemented();
1170 llvm::erase_if(VarList, [&](
Expr *
E) {
1188OpenACCClause *SemaOpenACCClauseVisitor::VisitDeviceTypeClause(
1192 return isNotImplemented();
1197 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
1214 llvm::find_if(ExistingClauses,
1215 llvm::IsaPred<OpenACCIndependentClause, OpenACCSeqClause>);
1216 if (Itr != ExistingClauses.end()) {
1219 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1227OpenACCClause *SemaOpenACCClauseVisitor::VisitIndependentClause(
1231 const auto *Itr = llvm::find_if(
1232 ExistingClauses, llvm::IsaPred<OpenACCAutoClause, OpenACCSeqClause>);
1233 if (Itr != ExistingClauses.end()) {
1236 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1245 if (isa<OpenACCAsteriskSizeExpr>(
E))
1247 return S.ActOnIntExpr(OpenACCDirectiveKind::Invalid, OpenACCClauseKind::Gang,
1252 return DK == OpenACCDirectiveKind::Loop &&
1253 AssocKind == OpenACCDirectiveKind::Invalid;
1257 return DK == OpenACCDirectiveKind::Loop &&
1258 AssocKind != OpenACCDirectiveKind::Invalid;
1265 << GK << CK << IsOrphanLoop(DK, AssocKind) << DK
1266 << HasAssocKind(DK, AssocKind) << AssocKind;
1273 << TagKind << CK << IsOrphanLoop(DK, AssocKind) << DK
1274 << HasAssocKind(DK, AssocKind) << AssocKind;
1282 case OpenACCGangKind::Static:
1283 return CheckGangStaticExpr(S,
E);
1284 case OpenACCGangKind::Num:
1288 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1289 case OpenACCGangKind::Dim: {
1297 S.ActOnIntExpr(OpenACCDirectiveKind::Invalid, OpenACCClauseKind::Gang,
1306 std::optional<llvm::APSInt> ICE =
1309 if (!ICE || *ICE <= 0 || ICE > 3) {
1311 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
1319 llvm_unreachable(
"Unknown gang kind in gang parallel check");
1331 case OpenACCGangKind::Dim:
1332 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1333 case OpenACCGangKind::Num: {
1345 : S.getActiveComputeConstructInfo().Clauses;
1348 llvm::find_if(Collection, llvm::IsaPred<OpenACCNumGangsClause>);
1350 if (Itr != Collection.end()) {
1352 <<
"num" << OpenACCClauseKind::Gang << DK
1353 << HasAssocKind(DK, AssocKind) << AssocKind
1354 << OpenACCClauseKind::NumGangs;
1356 S.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1361 case OpenACCGangKind::Static:
1362 return CheckGangStaticExpr(S,
E);
1364 llvm_unreachable(
"Unknown gang kind in gang kernels check");
1373 case OpenACCGangKind::Dim:
1374 case OpenACCGangKind::Num:
1375 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1376 case OpenACCGangKind::Static:
1377 return CheckGangStaticExpr(S,
E);
1379 llvm_unreachable(
"Unknown gang kind in gang serial check");
1384 if (DiagIfSeqClause(Clause))
1391 return isNotImplemented();
1398 case OpenACCDirectiveKind::Invalid:
1399 case OpenACCDirectiveKind::Parallel:
1402 case OpenACCDirectiveKind::Serial:
1405 DiagIntArgInvalid(SemaRef, IntExpr,
"length", OpenACCClauseKind::Vector,
1410 case OpenACCDirectiveKind::Kernels: {
1413 llvm::IsaPred<OpenACCVectorLengthClause>);
1416 <<
"length" << OpenACCClauseKind::Vector
1421 << OpenACCClauseKind::VectorLength;
1422 SemaRef.
Diag((*Itr)->getBeginLoc(),
1423 diag::note_acc_previous_clause_here);
1430 llvm_unreachable(
"Non compute construct in active compute construct");
1434 DiagIntArgInvalid(SemaRef, IntExpr,
"length", OpenACCClauseKind::Vector,
1439 OpenACCDirectiveKind::KernelsLoop) {
1440 const auto *Itr = llvm::find_if(
1441 ExistingClauses, llvm::IsaPred<OpenACCVectorLengthClause>);
1442 if (Itr != ExistingClauses.end()) {
1444 <<
"length" << OpenACCClauseKind::Vector
1449 << OpenACCClauseKind::VectorLength;
1450 SemaRef.
Diag((*Itr)->getBeginLoc(),
1451 diag::note_acc_previous_clause_here);
1466 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1467 << OpenACCClauseKind::Vector << OpenACCClauseKind::Vector
1470 diag::note_acc_previous_clause_here);
1482 if (DiagIfSeqClause(Clause))
1489 return isNotImplemented();
1497 case OpenACCDirectiveKind::Invalid:
1498 case OpenACCDirectiveKind::ParallelLoop:
1499 case OpenACCDirectiveKind::SerialLoop:
1500 case OpenACCDirectiveKind::Parallel:
1501 case OpenACCDirectiveKind::Serial:
1502 DiagIntArgInvalid(SemaRef, IntExpr, OpenACCGangKind::Num,
1507 case OpenACCDirectiveKind::KernelsLoop:
1508 case OpenACCDirectiveKind::Kernels: {
1511 llvm::IsaPred<OpenACCNumWorkersClause>);
1518 << OpenACCClauseKind::NumWorkers;
1519 SemaRef.
Diag((*Itr)->getBeginLoc(),
1520 diag::note_acc_previous_clause_here);
1527 llvm_unreachable(
"Non compute construct in active compute construct");
1532 DiagIntArgInvalid(SemaRef, IntExpr, OpenACCGangKind::Num,
1538 "Unknown combined directive kind?");
1539 const auto *Itr = llvm::find_if(ExistingClauses,
1540 llvm::IsaPred<OpenACCNumWorkersClause>);
1541 if (Itr != ExistingClauses.end()) {
1547 << OpenACCClauseKind::NumWorkers;
1548 SemaRef.
Diag((*Itr)->getBeginLoc(),
1549 diag::note_acc_previous_clause_here);
1564 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1565 << OpenACCClauseKind::Worker << OpenACCClauseKind::Worker
1568 diag::note_acc_previous_clause_here);
1578 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1579 << OpenACCClauseKind::Worker << OpenACCClauseKind::Vector
1582 diag::note_acc_previous_clause_here);
1594 if (DiagIfSeqClause(Clause))
1601 return isNotImplemented();
1608 OpenACCDirectiveKind::Invalid) ||
1611 auto ActiveComputeConstructContainer =
1615 auto *NumGangsClauseItr = llvm::find_if(
1616 ActiveComputeConstructContainer, llvm::IsaPred<OpenACCNumGangsClause>);
1618 if (NumGangsClauseItr != ActiveComputeConstructContainer.end() &&
1619 cast<OpenACCNumGangsClause>(*NumGangsClauseItr)->getIntExprs().size() >
1621 auto *ReductionClauseItr =
1622 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
1624 if (ReductionClauseItr != ExistingClauses.end()) {
1626 diag::err_acc_gang_reduction_numgangs_conflict)
1627 << OpenACCClauseKind::Gang << OpenACCClauseKind::Reduction
1630 SemaRef.
Diag((*ReductionClauseItr)->getBeginLoc(),
1631 diag::note_acc_previous_clause_here);
1632 SemaRef.
Diag((*NumGangsClauseItr)->getBeginLoc(),
1633 diag::note_acc_previous_clause_here);
1646 for (
unsigned I = 0; I < Clause.
getIntExprs().size(); ++I) {
1657 if (ExistingElemLoc[
static_cast<unsigned>(GK)].isValid()) {
1659 <<
static_cast<unsigned>(GK);
1660 SemaRef.
Diag(ExistingElemLoc[
static_cast<unsigned>(GK)],
1661 diag::note_acc_previous_expr_here);
1665 ExistingElemLoc[
static_cast<unsigned>(GK)] = ER.
get()->
getBeginLoc();
1666 GangKinds.push_back(GK);
1667 IntExprs.push_back(ER.
get());
1678 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1679 << OpenACCClauseKind::Gang << OpenACCClauseKind::Gang
1683 diag::note_acc_previous_clause_here);
1693 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1694 << OpenACCClauseKind::Gang << OpenACCClauseKind::Worker
1697 diag::note_acc_previous_clause_here);
1707 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1708 << OpenACCClauseKind::Gang << OpenACCClauseKind::Vector
1711 diag::note_acc_previous_clause_here);
1718 GangKinds, IntExprs, Clause.
getEndLoc());
1721OpenACCClause *SemaOpenACCClauseVisitor::VisitFinalizeClause(
1729OpenACCClause *SemaOpenACCClauseVisitor::VisitIfPresentClause(
1743 return isNotImplemented();
1748 llvm::find_if(ExistingClauses,
1749 llvm::IsaPred<OpenACCAutoClause, OpenACCIndependentClause>);
1750 if (Itr != ExistingClauses.end()) {
1753 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1760 Itr = llvm::find_if(ExistingClauses,
1764 if (Itr != ExistingClauses.end()) {
1765 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_cannot_combine)
1768 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1776OpenACCClause *SemaOpenACCClauseVisitor::VisitReductionClause(
1783 OpenACCDirectiveKind::Invalid) ||
1786 auto ActiveComputeConstructContainer =
1790 auto *NumGangsClauseItr = llvm::find_if(
1791 ActiveComputeConstructContainer, llvm::IsaPred<OpenACCNumGangsClause>);
1793 if (NumGangsClauseItr != ActiveComputeConstructContainer.end() &&
1794 cast<OpenACCNumGangsClause>(*NumGangsClauseItr)->getIntExprs().size() >
1796 auto *GangClauseItr =
1797 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
1799 if (GangClauseItr != ExistingClauses.end()) {
1801 diag::err_acc_gang_reduction_numgangs_conflict)
1802 << OpenACCClauseKind::Reduction << OpenACCClauseKind::Gang
1805 SemaRef.
Diag((*GangClauseItr)->getBeginLoc(),
1806 diag::note_acc_previous_clause_here);
1807 SemaRef.
Diag((*NumGangsClauseItr)->getBeginLoc(),
1808 diag::note_acc_previous_clause_here);
1836 auto NumGangsClauses = llvm::make_filter_range(
1837 ExistingClauses, llvm::IsaPred<OpenACCNumGangsClause>);
1839 for (
auto *NGC : NumGangsClauses) {
1841 cast<OpenACCNumGangsClause>(NGC)->getIntExprs().size();
1845 diag::err_acc_reduction_num_gangs_conflict)
1848 SemaRef.
Diag(NGC->getBeginLoc(), diag::note_acc_previous_clause_here);
1861 ValidVars.push_back(Res.
get());
1870OpenACCClause *SemaOpenACCClauseVisitor::VisitCollapseClause(
1877 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
1892bool areVarsEqual(
Expr *VarExpr1,
Expr *VarExpr2) {
1904 if (isa<ArraySectionExpr>(VarExpr1)) {
1905 auto *Expr2AS = dyn_cast<ArraySectionExpr>(VarExpr2);
1909 auto *Expr1AS = cast<ArraySectionExpr>(VarExpr1);
1911 if (!areVarsEqual(Expr1AS->getBase(), Expr2AS->getBase()))
1919 if (isa<ArraySubscriptExpr>(VarExpr1)) {
1920 auto *Expr2AS = dyn_cast<ArraySubscriptExpr>(VarExpr2);
1924 auto *Expr1AS = cast<ArraySubscriptExpr>(VarExpr1);
1926 if (!areVarsEqual(Expr1AS->getBase(), Expr2AS->getBase()))
1936 if (isa<DeclRefExpr>(VarExpr1)) {
1937 auto *Expr2DRE = dyn_cast<DeclRefExpr>(VarExpr2);
1941 auto *Expr1DRE = cast<DeclRefExpr>(VarExpr1);
1943 return Expr1DRE->getDecl()->getMostRecentDecl() ==
1944 Expr2DRE->getDecl()->getMostRecentDecl();
1947 llvm_unreachable(
"Unknown variable type encountered");
1965 if (
const auto *DevTypeClause =
1966 llvm::find_if(ExistingClauses,
1968 return isa<OpenACCDeviceTypeClause>(
C);
1970 DevTypeClause != ExistingClauses.end()) {
1971 if (checkValidAfterDeviceType(
1972 *
this, *cast<OpenACCDeviceTypeClause>(*DevTypeClause), Clause))
1976 SemaOpenACCClauseVisitor Visitor{*
this, ExistingClauses};
1979 "Created wrong clause?");
1981 if (Visitor.diagNotImplemented())
2001 auto TypeIsValid = [](
QualType Ty) {
2002 return Ty->isDependentType() || Ty->isScalarType();
2005 if (isa<ArraySectionExpr>(VarExpr)) {
2006 Expr *ASExpr = VarExpr;
2010 if (!TypeIsValid(EltTy)) {
2016 if (!RD->isStruct() && !RD->isClass()) {
2017 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2022 if (!RD->isCompleteDefinition()) {
2023 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2027 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD);
2028 CXXRD && !CXXRD->isAggregate()) {
2029 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2035 if (!TypeIsValid(FD->getType())) {
2037 diag::err_acc_reduction_composite_member_type);
2038 Diag(FD->getLocation(), diag::note_acc_reduction_composite_member_loc);
2042 }
else if (!TypeIsValid(VarExpr->
getType())) {
2053 if (RClause->getReductionOp() == ReductionOp)
2056 for (
Expr *OldVarExpr : RClause->getVarList()) {
2057 if (OldVarExpr->isInstantiationDependent())
2060 if (areVarsEqual(VarExpr, OldVarExpr)) {
2062 << ReductionOp << RClause->getReductionOp();
2063 Diag(OldVarExpr->getExprLoc(), diag::note_acc_previous_clause_here);
2079 "size argument non integer?");
2083 isa<OpenACCAsteriskSizeExpr>(SizeExpr))
2086 std::optional<llvm::APSInt> ICE =
2091 if (!ICE || *ICE <= 0) {
2093 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
2107 "Loop argument non integer?");
2113 std::optional<llvm::APSInt> ICE =
2119 if (!ICE || *ICE <= 0) {
2121 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
2139 return CheckGangParallelExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2142 return CheckGangSerialExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2145 return CheckGangKernelsExpr(*
this, ExistingClauses, DK,
2146 ActiveComputeConstructInfo.Kind, GK,
E);
2148 switch (ActiveComputeConstructInfo.Kind) {
2152 return CheckGangParallelExpr(*
this, DK, ActiveComputeConstructInfo.Kind,
2156 return CheckGangSerialExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2160 return CheckGangKernelsExpr(*
this, ExistingClauses, DK,
2161 ActiveComputeConstructInfo.Kind, GK,
E);
2163 llvm_unreachable(
"Non compute construct in active compute construct?");
2168 llvm_unreachable(
"Invalid directive kind for a Gang clause");
2170 llvm_unreachable(
"Compute construct directive not handled?");
2182 const auto *ReductionItr =
2183 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
2185 if (ReductionItr != ExistingClauses.end()) {
2186 const auto GangZip = llvm::zip_equal(GangKinds, IntExprs);
2187 const auto GangItr = llvm::find_if(GangZip, [](
const auto &Tuple) {
2191 if (GangItr != GangZip.end()) {
2192 const Expr *DimExpr = std::get<1>(*GangItr);
2196 "Improperly formed gang argument");
2197 if (
const auto *DimVal = dyn_cast<ConstantExpr>(DimExpr);
2198 DimVal && DimVal->getResultAsAPSInt() > 1) {
2199 Diag(DimVal->getBeginLoc(), diag::err_acc_gang_reduction_conflict)
2201 Diag((*ReductionItr)->getBeginLoc(),
2202 diag::note_acc_previous_clause_here);
2209 GangKinds, IntExprs, EndLoc);
2222 const auto GangClauses = llvm::make_filter_range(
2223 ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
2225 for (
auto *GC : GangClauses) {
2226 const auto *GangClause = cast<OpenACCGangClause>(GC);
2227 for (
unsigned I = 0; I < GangClause->getNumExprs(); ++I) {
2228 std::pair<OpenACCGangKind, const Expr *> EPair = GangClause->getExpr(I);
2232 if (
const auto *DimVal = dyn_cast<ConstantExpr>(EPair.second);
2233 DimVal && DimVal->getResultAsAPSInt() > 1) {
2234 Diag(BeginLoc, diag::err_acc_gang_reduction_conflict)
2235 << 1 << DirectiveKind;
2236 Diag(GangClause->getBeginLoc(), diag::note_acc_previous_clause_here);
2244 getASTContext(), BeginLoc, LParenLoc, ReductionOp, Vars, EndLoc);
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines some OpenACC-specific enums and functions.
This file declares semantic analysis for OpenACC constructs and clauses.
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 ...
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
static QualType getBaseOriginalType(const Expr *Base)
Return original type of the base expression for array section.
static ConstantExpr * Create(const ASTContext &Context, Expr *E, const APValue &Result)
This represents one expression.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
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.
Represents a member of a struct/union/class.
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
static OpenACCCollapseClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, bool HasForce, Expr *LoopCount, SourceLocation EndLoc)
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 OpenACCDefaultAsyncClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDefaultClause * Create(const ASTContext &C, OpenACCDefaultClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static OpenACCDeleteClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDetachClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCDeviceNumClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
static OpenACCDevicePtrClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
A 'device_type' or 'dtype' clause, takes a list of either an 'asterisk' or an identifier.
static OpenACCDeviceTypeClause * Create(const ASTContext &C, OpenACCClauseKind K, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< DeviceTypeArgument > Archs, SourceLocation EndLoc)
static OpenACCFinalizeClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation EndLoc)
static OpenACCFirstPrivateClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static OpenACCGangClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< OpenACCGangKind > GangKinds, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
static OpenACCHostClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > VarList, SourceLocation EndLoc)
static 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 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 OpenACCTileClause * Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< Expr * > SizeExprs, SourceLocation EndLoc)
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 OpenACCWorkerClause * Create(const ASTContext &Ctx, SourceLocation BeginLoc, SourceLocation LParenLoc, Expr *IntExpr, SourceLocation EndLoc)
A (possibly-)qualified type.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
ASTContext & getASTContext() const
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
ComputeConstructInfo & getActiveComputeConstructInfo()
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 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.
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)...
ExprResult CheckGangExpr(ArrayRef< const OpenACCClause * > ExistingClauses, OpenACCDirectiveKind DK, OpenACCGangKind GK, Expr *E)
OpenACCClause * CheckGangClause(OpenACCDirectiveKind DirKind, ArrayRef< const OpenACCClause * > ExistingClauses, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< OpenACCGangKind > GangKinds, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
ExprResult CheckTileSizeExpr(Expr *SizeExpr)
Checks a single size expr for a tile clause.
ASTContext & getASTContext() const
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
SourceLocation getBeginLoc() const LLVM_READONLY
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
The JSON file list parser is used to communicate input to InstallAPI.
bool isOpenACCComputeDirectiveKind(OpenACCDirectiveKind K)
bool isOpenACCCombinedDirectiveKind(OpenACCDirectiveKind K)
OpenACCClauseKind
Represents the kind of an OpenACC clause.
@ Invalid
Represents an invalid clause, for the purposes of parsing.
@ Result
The result type of a method or function.
OpenACCDirectiveKind DirKind