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);
1365 llvm_unreachable(
"Unknown gang kind in gang kernels check");
1374 case OpenACCGangKind::Dim:
1375 case OpenACCGangKind::Num:
1376 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1377 case OpenACCGangKind::Static:
1378 return CheckGangStaticExpr(S,
E);
1380 llvm_unreachable(
"Unknown gang kind in gang serial check");
1385 if (DiagIfSeqClause(Clause))
1392 return isNotImplemented();
1399 case OpenACCDirectiveKind::Invalid:
1400 case OpenACCDirectiveKind::Parallel:
1403 case OpenACCDirectiveKind::Serial:
1406 DiagIntArgInvalid(SemaRef, IntExpr,
"length", OpenACCClauseKind::Vector,
1411 case OpenACCDirectiveKind::Kernels: {
1414 llvm::IsaPred<OpenACCVectorLengthClause>);
1417 <<
"length" << OpenACCClauseKind::Vector
1422 << OpenACCClauseKind::VectorLength;
1423 SemaRef.
Diag((*Itr)->getBeginLoc(),
1424 diag::note_acc_previous_clause_here);
1431 llvm_unreachable(
"Non compute construct in active compute construct");
1435 DiagIntArgInvalid(SemaRef, IntExpr,
"length", OpenACCClauseKind::Vector,
1440 OpenACCDirectiveKind::KernelsLoop) {
1441 const auto *Itr = llvm::find_if(
1442 ExistingClauses, llvm::IsaPred<OpenACCVectorLengthClause>);
1443 if (Itr != ExistingClauses.end()) {
1445 <<
"length" << OpenACCClauseKind::Vector
1450 << OpenACCClauseKind::VectorLength;
1451 SemaRef.
Diag((*Itr)->getBeginLoc(),
1452 diag::note_acc_previous_clause_here);
1467 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1468 << OpenACCClauseKind::Vector << OpenACCClauseKind::Vector
1471 diag::note_acc_previous_clause_here);
1483 if (DiagIfSeqClause(Clause))
1490 return isNotImplemented();
1498 case OpenACCDirectiveKind::Invalid:
1499 case OpenACCDirectiveKind::ParallelLoop:
1500 case OpenACCDirectiveKind::SerialLoop:
1501 case OpenACCDirectiveKind::Parallel:
1502 case OpenACCDirectiveKind::Serial:
1503 DiagIntArgInvalid(SemaRef, IntExpr, OpenACCGangKind::Num,
1508 case OpenACCDirectiveKind::KernelsLoop:
1509 case OpenACCDirectiveKind::Kernels: {
1512 llvm::IsaPred<OpenACCNumWorkersClause>);
1519 << OpenACCClauseKind::NumWorkers;
1520 SemaRef.
Diag((*Itr)->getBeginLoc(),
1521 diag::note_acc_previous_clause_here);
1528 llvm_unreachable(
"Non compute construct in active compute construct");
1533 DiagIntArgInvalid(SemaRef, IntExpr, OpenACCGangKind::Num,
1539 "Unknown combined directive kind?");
1540 const auto *Itr = llvm::find_if(ExistingClauses,
1541 llvm::IsaPred<OpenACCNumWorkersClause>);
1542 if (Itr != ExistingClauses.end()) {
1548 << OpenACCClauseKind::NumWorkers;
1549 SemaRef.
Diag((*Itr)->getBeginLoc(),
1550 diag::note_acc_previous_clause_here);
1565 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1566 << OpenACCClauseKind::Worker << OpenACCClauseKind::Worker
1569 diag::note_acc_previous_clause_here);
1579 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1580 << OpenACCClauseKind::Worker << OpenACCClauseKind::Vector
1583 diag::note_acc_previous_clause_here);
1595 if (DiagIfSeqClause(Clause))
1602 return isNotImplemented();
1609 OpenACCDirectiveKind::Invalid) ||
1612 auto ActiveComputeConstructContainer =
1616 auto *NumGangsClauseItr = llvm::find_if(
1617 ActiveComputeConstructContainer, llvm::IsaPred<OpenACCNumGangsClause>);
1619 if (NumGangsClauseItr != ActiveComputeConstructContainer.end() &&
1620 cast<OpenACCNumGangsClause>(*NumGangsClauseItr)->getIntExprs().size() >
1622 auto *ReductionClauseItr =
1623 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
1625 if (ReductionClauseItr != ExistingClauses.end()) {
1627 diag::err_acc_gang_reduction_numgangs_conflict)
1628 << OpenACCClauseKind::Gang << OpenACCClauseKind::Reduction
1631 SemaRef.
Diag((*ReductionClauseItr)->getBeginLoc(),
1632 diag::note_acc_previous_clause_here);
1633 SemaRef.
Diag((*NumGangsClauseItr)->getBeginLoc(),
1634 diag::note_acc_previous_clause_here);
1647 for (
unsigned I = 0; I < Clause.
getIntExprs().size(); ++I) {
1658 if (ExistingElemLoc[
static_cast<unsigned>(GK)].isValid()) {
1660 <<
static_cast<unsigned>(GK);
1661 SemaRef.
Diag(ExistingElemLoc[
static_cast<unsigned>(GK)],
1662 diag::note_acc_previous_expr_here);
1666 ExistingElemLoc[
static_cast<unsigned>(GK)] = ER.
get()->
getBeginLoc();
1667 GangKinds.push_back(GK);
1668 IntExprs.push_back(ER.
get());
1679 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1680 << OpenACCClauseKind::Gang << OpenACCClauseKind::Gang
1684 diag::note_acc_previous_clause_here);
1694 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1695 << OpenACCClauseKind::Gang << OpenACCClauseKind::Worker
1698 diag::note_acc_previous_clause_here);
1708 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1709 << OpenACCClauseKind::Gang << OpenACCClauseKind::Vector
1712 diag::note_acc_previous_clause_here);
1719 GangKinds, IntExprs, Clause.
getEndLoc());
1722OpenACCClause *SemaOpenACCClauseVisitor::VisitFinalizeClause(
1730OpenACCClause *SemaOpenACCClauseVisitor::VisitIfPresentClause(
1744 return isNotImplemented();
1749 llvm::find_if(ExistingClauses,
1750 llvm::IsaPred<OpenACCAutoClause, OpenACCIndependentClause>);
1751 if (Itr != ExistingClauses.end()) {
1754 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1761 Itr = llvm::find_if(ExistingClauses,
1765 if (Itr != ExistingClauses.end()) {
1766 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_cannot_combine)
1769 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1777OpenACCClause *SemaOpenACCClauseVisitor::VisitReductionClause(
1784 OpenACCDirectiveKind::Invalid) ||
1787 auto ActiveComputeConstructContainer =
1791 auto *NumGangsClauseItr = llvm::find_if(
1792 ActiveComputeConstructContainer, llvm::IsaPred<OpenACCNumGangsClause>);
1794 if (NumGangsClauseItr != ActiveComputeConstructContainer.end() &&
1795 cast<OpenACCNumGangsClause>(*NumGangsClauseItr)->getIntExprs().size() >
1797 auto *GangClauseItr =
1798 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
1800 if (GangClauseItr != ExistingClauses.end()) {
1802 diag::err_acc_gang_reduction_numgangs_conflict)
1803 << OpenACCClauseKind::Reduction << OpenACCClauseKind::Gang
1806 SemaRef.
Diag((*GangClauseItr)->getBeginLoc(),
1807 diag::note_acc_previous_clause_here);
1808 SemaRef.
Diag((*NumGangsClauseItr)->getBeginLoc(),
1809 diag::note_acc_previous_clause_here);
1837 auto NumGangsClauses = llvm::make_filter_range(
1838 ExistingClauses, llvm::IsaPred<OpenACCNumGangsClause>);
1840 for (
auto *NGC : NumGangsClauses) {
1842 cast<OpenACCNumGangsClause>(NGC)->getIntExprs().size();
1846 diag::err_acc_reduction_num_gangs_conflict)
1849 SemaRef.
Diag(NGC->getBeginLoc(), diag::note_acc_previous_clause_here);
1862 ValidVars.push_back(Res.
get());
1871OpenACCClause *SemaOpenACCClauseVisitor::VisitCollapseClause(
1878 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
1893bool areVarsEqual(
Expr *VarExpr1,
Expr *VarExpr2) {
1905 if (isa<ArraySectionExpr>(VarExpr1)) {
1906 auto *Expr2AS = dyn_cast<ArraySectionExpr>(VarExpr2);
1910 auto *Expr1AS = cast<ArraySectionExpr>(VarExpr1);
1912 if (!areVarsEqual(Expr1AS->getBase(), Expr2AS->getBase()))
1920 if (isa<ArraySubscriptExpr>(VarExpr1)) {
1921 auto *Expr2AS = dyn_cast<ArraySubscriptExpr>(VarExpr2);
1925 auto *Expr1AS = cast<ArraySubscriptExpr>(VarExpr1);
1927 if (!areVarsEqual(Expr1AS->getBase(), Expr2AS->getBase()))
1937 if (isa<DeclRefExpr>(VarExpr1)) {
1938 auto *Expr2DRE = dyn_cast<DeclRefExpr>(VarExpr2);
1942 auto *Expr1DRE = cast<DeclRefExpr>(VarExpr1);
1944 return Expr1DRE->getDecl()->getMostRecentDecl() ==
1945 Expr2DRE->getDecl()->getMostRecentDecl();
1948 llvm_unreachable(
"Unknown variable type encountered");
1966 if (
const auto *DevTypeClause =
1967 llvm::find_if(ExistingClauses,
1969 return isa<OpenACCDeviceTypeClause>(
C);
1971 DevTypeClause != ExistingClauses.end()) {
1972 if (checkValidAfterDeviceType(
1973 *
this, *cast<OpenACCDeviceTypeClause>(*DevTypeClause), Clause))
1977 SemaOpenACCClauseVisitor Visitor{*
this, ExistingClauses};
1980 "Created wrong clause?");
1982 if (Visitor.diagNotImplemented())
2002 auto TypeIsValid = [](
QualType Ty) {
2003 return Ty->isDependentType() || Ty->isScalarType();
2006 if (isa<ArraySectionExpr>(VarExpr)) {
2007 Expr *ASExpr = VarExpr;
2011 if (!TypeIsValid(EltTy)) {
2017 if (!RD->isStruct() && !RD->isClass()) {
2018 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2023 if (!RD->isCompleteDefinition()) {
2024 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2028 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD);
2029 CXXRD && !CXXRD->isAggregate()) {
2030 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2036 if (!TypeIsValid(FD->getType())) {
2038 diag::err_acc_reduction_composite_member_type);
2039 Diag(FD->getLocation(), diag::note_acc_reduction_composite_member_loc);
2043 }
else if (!TypeIsValid(VarExpr->
getType())) {
2054 if (RClause->getReductionOp() == ReductionOp)
2057 for (
Expr *OldVarExpr : RClause->getVarList()) {
2058 if (OldVarExpr->isInstantiationDependent())
2061 if (areVarsEqual(VarExpr, OldVarExpr)) {
2063 << ReductionOp << RClause->getReductionOp();
2064 Diag(OldVarExpr->getExprLoc(), diag::note_acc_previous_clause_here);
2080 "size argument non integer?");
2084 isa<OpenACCAsteriskSizeExpr>(SizeExpr))
2087 std::optional<llvm::APSInt> ICE =
2092 if (!ICE || *ICE <= 0) {
2094 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
2108 "Loop argument non integer?");
2114 std::optional<llvm::APSInt> ICE =
2120 if (!ICE || *ICE <= 0) {
2122 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
2140 return CheckGangParallelExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2143 return CheckGangSerialExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2146 return CheckGangKernelsExpr(*
this, ExistingClauses, DK,
2147 ActiveComputeConstructInfo.Kind, GK,
E);
2149 switch (ActiveComputeConstructInfo.Kind) {
2153 return CheckGangParallelExpr(*
this, DK, ActiveComputeConstructInfo.Kind,
2157 return CheckGangSerialExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2161 return CheckGangKernelsExpr(*
this, ExistingClauses, DK,
2162 ActiveComputeConstructInfo.Kind, GK,
E);
2164 llvm_unreachable(
"Non compute construct in active compute construct?");
2169 llvm_unreachable(
"Invalid directive kind for a Gang clause");
2171 llvm_unreachable(
"Compute construct directive not handled?");
2183 const auto *ReductionItr =
2184 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
2186 if (ReductionItr != ExistingClauses.end()) {
2187 const auto GangZip = llvm::zip_equal(GangKinds, IntExprs);
2188 const auto GangItr = llvm::find_if(GangZip, [](
const auto &Tuple) {
2192 if (GangItr != GangZip.end()) {
2193 const Expr *DimExpr = std::get<1>(*GangItr);
2197 "Improperly formed gang argument");
2198 if (
const auto *DimVal = dyn_cast<ConstantExpr>(DimExpr);
2199 DimVal && DimVal->getResultAsAPSInt() > 1) {
2200 Diag(DimVal->getBeginLoc(), diag::err_acc_gang_reduction_conflict)
2202 Diag((*ReductionItr)->getBeginLoc(),
2203 diag::note_acc_previous_clause_here);
2210 GangKinds, IntExprs, EndLoc);
2223 const auto GangClauses = llvm::make_filter_range(
2224 ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
2226 for (
auto *GC : GangClauses) {
2227 const auto *GangClause = cast<OpenACCGangClause>(GC);
2228 for (
unsigned I = 0; I < GangClause->getNumExprs(); ++I) {
2229 std::pair<OpenACCGangKind, const Expr *> EPair = GangClause->getExpr(I);
2233 if (
const auto *DimVal = dyn_cast<ConstantExpr>(EPair.second);
2234 DimVal && DimVal->getResultAsAPSInt() > 1) {
2235 Diag(BeginLoc, diag::err_acc_gang_reduction_conflict)
2236 << 1 << DirectiveKind;
2237 Diag(GangClause->getBeginLoc(), diag::note_acc_previous_clause_here);
2245 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