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::Routine;
595class SemaOpenACCClauseVisitor {
599 bool NotImplemented =
false;
602 NotImplemented =
true;
611 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCSeqClause>);
613 if (Itr != ExistingClauses.end()) {
614 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_cannot_combine)
617 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
627 : SemaRef(S), Ctx(S.getASTContext()), ExistingClauses(ExistingClauses) {}
631 bool diagNotImplemented() {
return NotImplemented; }
635#define VISIT_CLAUSE(CLAUSE_NAME) \
636 case OpenACCClauseKind::CLAUSE_NAME: \
637 return Visit##CLAUSE_NAME##Clause(Clause);
638#define CLAUSE_ALIAS(ALIAS, CLAUSE_NAME, DEPRECATED) \
639 case OpenACCClauseKind::ALIAS: \
641 SemaRef.Diag(Clause.getBeginLoc(), diag::warn_acc_deprecated_alias_name) \
642 << Clause.getClauseKind() << OpenACCClauseKind::CLAUSE_NAME; \
643 return Visit##CLAUSE_NAME##Clause(Clause);
644#include "clang/Basic/OpenACCClauses.def"
646 return isNotImplemented();
648 llvm_unreachable(
"Invalid clause kind");
651#define VISIT_CLAUSE(CLAUSE_NAME) \
652 OpenACCClause *Visit##CLAUSE_NAME##Clause( \
653 SemaOpenACC::OpenACCParsedClause &Clause);
654#include "clang/Basic/OpenACCClauses.def"
667 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
683 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
695 NewSizeExprs.push_back(Res.
get());
713 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
723 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCSelfClause>);
724 if (Itr != ExistingClauses.end()) {
726 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
740 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
751 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCIfClause>);
752 if (Itr != ExistingClauses.end()) {
754 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
766 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
793 auto *GangClauseItr =
794 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
795 auto *ReductionClauseItr =
796 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
798 if (GangClauseItr != ExistingClauses.end() &&
799 ReductionClauseItr != ExistingClauses.end()) {
801 diag::err_acc_gang_reduction_numgangs_conflict)
802 << OpenACCClauseKind::Reduction << OpenACCClauseKind::Gang
804 SemaRef.
Diag((*ReductionClauseItr)->getBeginLoc(),
805 diag::note_acc_previous_clause_here);
806 SemaRef.
Diag((*GangClauseItr)->getBeginLoc(),
807 diag::note_acc_previous_clause_here);
819 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
821 if (
Parallel != ExistingClauses.end()) {
823 diag::err_acc_reduction_num_gangs_conflict)
826 SemaRef.
Diag((*Parallel)->getBeginLoc(),
827 diag::note_acc_previous_clause_here);
836 auto GangClauses = llvm::make_filter_range(
837 ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
839 for (
auto *GC : GangClauses) {
840 if (cast<OpenACCGangClause>(GC)->hasExprOfKind(OpenACCGangKind::Num)) {
842 diag::err_acc_num_arg_conflict_reverse)
843 << OpenACCClauseKind::NumGangs << OpenACCClauseKind::Gang
845 SemaRef.
Diag(GC->getBeginLoc(), diag::note_acc_previous_clause_here);
856OpenACCClause *SemaOpenACCClauseVisitor::VisitNumWorkersClause(
861 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
868 auto WorkerClauses = llvm::make_filter_range(
869 ExistingClauses, llvm::IsaPred<OpenACCWorkerClause>);
871 for (
auto *WC : WorkerClauses) {
872 if (cast<OpenACCWorkerClause>(WC)->hasIntExpr()) {
874 diag::err_acc_num_arg_conflict_reverse)
875 << OpenACCClauseKind::NumWorkers << OpenACCClauseKind::Worker
877 SemaRef.
Diag(WC->getBeginLoc(), diag::note_acc_previous_clause_here);
884 "Invalid number of expressions for NumWorkers");
890OpenACCClause *SemaOpenACCClauseVisitor::VisitVectorLengthClause(
895 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
902 auto VectorClauses = llvm::make_filter_range(
903 ExistingClauses, llvm::IsaPred<OpenACCVectorClause>);
905 for (
auto *VC : VectorClauses) {
906 if (cast<OpenACCVectorClause>(VC)->hasIntExpr()) {
908 diag::err_acc_num_arg_conflict_reverse)
909 << OpenACCClauseKind::VectorLength << OpenACCClauseKind::Vector
911 SemaRef.
Diag(VC->getBeginLoc(), diag::note_acc_previous_clause_here);
918 "Invalid number of expressions for NumWorkers");
929 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
933 "Invalid number of expressions for Async");
940OpenACCClause *SemaOpenACCClauseVisitor::VisitDeviceNumClause(
945 return isNotImplemented();
950 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
954 "Invalid number of expressions for device_num");
960OpenACCClause *SemaOpenACCClauseVisitor::VisitDefaultAsyncClause(
964 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
968 "Invalid number of expressions for default_async");
985OpenACCClause *SemaOpenACCClauseVisitor::VisitFirstPrivateClause(
1014 return isNotImplemented();
1053 return isNotImplemented();
1070 return isNotImplemented();
1087 return isNotImplemented();
1113 llvm::erase_if(VarList, [&](
Expr *
E) {
1128 llvm::erase_if(VarList, [&](
Expr *
E) {
1148OpenACCClause *SemaOpenACCClauseVisitor::VisitUseDeviceClause(
1157OpenACCClause *SemaOpenACCClauseVisitor::VisitDevicePtrClause(
1164 return isNotImplemented();
1169 llvm::erase_if(VarList, [&](
Expr *
E) {
1187OpenACCClause *SemaOpenACCClauseVisitor::VisitDeviceTypeClause(
1191 return isNotImplemented();
1196 checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
1213 llvm::find_if(ExistingClauses,
1214 llvm::IsaPred<OpenACCIndependentClause, OpenACCSeqClause>);
1215 if (Itr != ExistingClauses.end()) {
1218 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1226OpenACCClause *SemaOpenACCClauseVisitor::VisitIndependentClause(
1230 const auto *Itr = llvm::find_if(
1231 ExistingClauses, llvm::IsaPred<OpenACCAutoClause, OpenACCSeqClause>);
1232 if (Itr != ExistingClauses.end()) {
1235 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1244 if (isa<OpenACCAsteriskSizeExpr>(
E))
1246 return S.ActOnIntExpr(OpenACCDirectiveKind::Invalid, OpenACCClauseKind::Gang,
1251 return DK == OpenACCDirectiveKind::Loop &&
1252 AssocKind == OpenACCDirectiveKind::Invalid;
1256 return DK == OpenACCDirectiveKind::Loop &&
1257 AssocKind != OpenACCDirectiveKind::Invalid;
1264 << GK << CK << IsOrphanLoop(DK, AssocKind) << DK
1265 << HasAssocKind(DK, AssocKind) << AssocKind;
1272 << TagKind << CK << IsOrphanLoop(DK, AssocKind) << DK
1273 << HasAssocKind(DK, AssocKind) << AssocKind;
1281 case OpenACCGangKind::Static:
1282 return CheckGangStaticExpr(S,
E);
1283 case OpenACCGangKind::Num:
1287 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1288 case OpenACCGangKind::Dim: {
1296 S.ActOnIntExpr(OpenACCDirectiveKind::Invalid, OpenACCClauseKind::Gang,
1305 std::optional<llvm::APSInt> ICE =
1308 if (!ICE || *ICE <= 0 || ICE > 3) {
1310 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
1318 llvm_unreachable(
"Unknown gang kind in gang parallel check");
1330 case OpenACCGangKind::Dim:
1331 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1332 case OpenACCGangKind::Num: {
1344 : S.getActiveComputeConstructInfo().Clauses;
1347 llvm::find_if(Collection, llvm::IsaPred<OpenACCNumGangsClause>);
1349 if (Itr != Collection.end()) {
1351 <<
"num" << OpenACCClauseKind::Gang << DK
1352 << HasAssocKind(DK, AssocKind) << AssocKind
1353 << OpenACCClauseKind::NumGangs;
1355 S.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1360 case OpenACCGangKind::Static:
1361 return CheckGangStaticExpr(S,
E);
1363 llvm_unreachable(
"Unknown gang kind in gang kernels check");
1372 case OpenACCGangKind::Dim:
1373 case OpenACCGangKind::Num:
1374 return DiagIntArgInvalid(S,
E, GK, OpenACCClauseKind::Gang, DK, AssocKind);
1375 case OpenACCGangKind::Static:
1376 return CheckGangStaticExpr(S,
E);
1378 llvm_unreachable(
"Unknown gang kind in gang serial check");
1383 if (DiagIfSeqClause(Clause))
1390 return isNotImplemented();
1397 case OpenACCDirectiveKind::Invalid:
1398 case OpenACCDirectiveKind::Parallel:
1401 case OpenACCDirectiveKind::Serial:
1404 DiagIntArgInvalid(SemaRef, IntExpr,
"length", OpenACCClauseKind::Vector,
1409 case OpenACCDirectiveKind::Kernels: {
1412 llvm::IsaPred<OpenACCVectorLengthClause>);
1415 <<
"length" << OpenACCClauseKind::Vector
1420 << OpenACCClauseKind::VectorLength;
1421 SemaRef.
Diag((*Itr)->getBeginLoc(),
1422 diag::note_acc_previous_clause_here);
1429 llvm_unreachable(
"Non compute construct in active compute construct");
1433 DiagIntArgInvalid(SemaRef, IntExpr,
"length", OpenACCClauseKind::Vector,
1438 OpenACCDirectiveKind::KernelsLoop) {
1439 const auto *Itr = llvm::find_if(
1440 ExistingClauses, llvm::IsaPred<OpenACCVectorLengthClause>);
1441 if (Itr != ExistingClauses.end()) {
1443 <<
"length" << OpenACCClauseKind::Vector
1448 << OpenACCClauseKind::VectorLength;
1449 SemaRef.
Diag((*Itr)->getBeginLoc(),
1450 diag::note_acc_previous_clause_here);
1465 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1466 << OpenACCClauseKind::Vector << OpenACCClauseKind::Vector
1469 diag::note_acc_previous_clause_here);
1481 if (DiagIfSeqClause(Clause))
1488 return isNotImplemented();
1496 case OpenACCDirectiveKind::Invalid:
1497 case OpenACCDirectiveKind::ParallelLoop:
1498 case OpenACCDirectiveKind::SerialLoop:
1499 case OpenACCDirectiveKind::Parallel:
1500 case OpenACCDirectiveKind::Serial:
1501 DiagIntArgInvalid(SemaRef, IntExpr, OpenACCGangKind::Num,
1506 case OpenACCDirectiveKind::KernelsLoop:
1507 case OpenACCDirectiveKind::Kernels: {
1510 llvm::IsaPred<OpenACCNumWorkersClause>);
1517 << OpenACCClauseKind::NumWorkers;
1518 SemaRef.
Diag((*Itr)->getBeginLoc(),
1519 diag::note_acc_previous_clause_here);
1526 llvm_unreachable(
"Non compute construct in active compute construct");
1531 DiagIntArgInvalid(SemaRef, IntExpr, OpenACCGangKind::Num,
1537 "Unknown combined directive kind?");
1538 const auto *Itr = llvm::find_if(ExistingClauses,
1539 llvm::IsaPred<OpenACCNumWorkersClause>);
1540 if (Itr != ExistingClauses.end()) {
1546 << OpenACCClauseKind::NumWorkers;
1547 SemaRef.
Diag((*Itr)->getBeginLoc(),
1548 diag::note_acc_previous_clause_here);
1563 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1564 << OpenACCClauseKind::Worker << OpenACCClauseKind::Worker
1567 diag::note_acc_previous_clause_here);
1577 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1578 << OpenACCClauseKind::Worker << OpenACCClauseKind::Vector
1581 diag::note_acc_previous_clause_here);
1593 if (DiagIfSeqClause(Clause))
1600 return isNotImplemented();
1607 OpenACCDirectiveKind::Invalid) ||
1610 auto ActiveComputeConstructContainer =
1614 auto *NumGangsClauseItr = llvm::find_if(
1615 ActiveComputeConstructContainer, llvm::IsaPred<OpenACCNumGangsClause>);
1617 if (NumGangsClauseItr != ActiveComputeConstructContainer.end() &&
1618 cast<OpenACCNumGangsClause>(*NumGangsClauseItr)->getIntExprs().size() >
1620 auto *ReductionClauseItr =
1621 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
1623 if (ReductionClauseItr != ExistingClauses.end()) {
1625 diag::err_acc_gang_reduction_numgangs_conflict)
1626 << OpenACCClauseKind::Gang << OpenACCClauseKind::Reduction
1629 SemaRef.
Diag((*ReductionClauseItr)->getBeginLoc(),
1630 diag::note_acc_previous_clause_here);
1631 SemaRef.
Diag((*NumGangsClauseItr)->getBeginLoc(),
1632 diag::note_acc_previous_clause_here);
1645 for (
unsigned I = 0; I < Clause.
getIntExprs().size(); ++I) {
1656 if (ExistingElemLoc[
static_cast<unsigned>(GK)].isValid()) {
1658 <<
static_cast<unsigned>(GK);
1659 SemaRef.
Diag(ExistingElemLoc[
static_cast<unsigned>(GK)],
1660 diag::note_acc_previous_expr_here);
1664 ExistingElemLoc[
static_cast<unsigned>(GK)] = ER.
get()->
getBeginLoc();
1665 GangKinds.push_back(GK);
1666 IntExprs.push_back(ER.
get());
1677 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1678 << OpenACCClauseKind::Gang << OpenACCClauseKind::Gang
1682 diag::note_acc_previous_clause_here);
1692 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1693 << OpenACCClauseKind::Gang << OpenACCClauseKind::Worker
1696 diag::note_acc_previous_clause_here);
1706 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_in_clause_region)
1707 << OpenACCClauseKind::Gang << OpenACCClauseKind::Vector
1710 diag::note_acc_previous_clause_here);
1717 GangKinds, IntExprs, Clause.
getEndLoc());
1720OpenACCClause *SemaOpenACCClauseVisitor::VisitFinalizeClause(
1728OpenACCClause *SemaOpenACCClauseVisitor::VisitIfPresentClause(
1742 return isNotImplemented();
1747 llvm::find_if(ExistingClauses,
1748 llvm::IsaPred<OpenACCAutoClause, OpenACCIndependentClause>);
1749 if (Itr != ExistingClauses.end()) {
1752 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1759 Itr = llvm::find_if(ExistingClauses,
1763 if (Itr != ExistingClauses.end()) {
1764 SemaRef.
Diag(Clause.
getBeginLoc(), diag::err_acc_clause_cannot_combine)
1767 SemaRef.
Diag((*Itr)->getBeginLoc(), diag::note_acc_previous_clause_here);
1775OpenACCClause *SemaOpenACCClauseVisitor::VisitReductionClause(
1782 OpenACCDirectiveKind::Invalid) ||
1785 auto ActiveComputeConstructContainer =
1789 auto *NumGangsClauseItr = llvm::find_if(
1790 ActiveComputeConstructContainer, llvm::IsaPred<OpenACCNumGangsClause>);
1792 if (NumGangsClauseItr != ActiveComputeConstructContainer.end() &&
1793 cast<OpenACCNumGangsClause>(*NumGangsClauseItr)->getIntExprs().size() >
1795 auto *GangClauseItr =
1796 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
1798 if (GangClauseItr != ExistingClauses.end()) {
1800 diag::err_acc_gang_reduction_numgangs_conflict)
1801 << OpenACCClauseKind::Reduction << OpenACCClauseKind::Gang
1804 SemaRef.
Diag((*GangClauseItr)->getBeginLoc(),
1805 diag::note_acc_previous_clause_here);
1806 SemaRef.
Diag((*NumGangsClauseItr)->getBeginLoc(),
1807 diag::note_acc_previous_clause_here);
1835 auto NumGangsClauses = llvm::make_filter_range(
1836 ExistingClauses, llvm::IsaPred<OpenACCNumGangsClause>);
1838 for (
auto *NGC : NumGangsClauses) {
1840 cast<OpenACCNumGangsClause>(NGC)->getIntExprs().size();
1844 diag::err_acc_reduction_num_gangs_conflict)
1847 SemaRef.
Diag(NGC->getBeginLoc(), diag::note_acc_previous_clause_here);
1860 ValidVars.push_back(Res.
get());
1869OpenACCClause *SemaOpenACCClauseVisitor::VisitCollapseClause(
1876 if (checkAlreadyHasClauseOfKind(SemaRef, ExistingClauses, Clause))
1891bool areVarsEqual(
Expr *VarExpr1,
Expr *VarExpr2) {
1903 if (isa<ArraySectionExpr>(VarExpr1)) {
1904 auto *Expr2AS = dyn_cast<ArraySectionExpr>(VarExpr2);
1908 auto *Expr1AS = cast<ArraySectionExpr>(VarExpr1);
1910 if (!areVarsEqual(Expr1AS->getBase(), Expr2AS->getBase()))
1918 if (isa<ArraySubscriptExpr>(VarExpr1)) {
1919 auto *Expr2AS = dyn_cast<ArraySubscriptExpr>(VarExpr2);
1923 auto *Expr1AS = cast<ArraySubscriptExpr>(VarExpr1);
1925 if (!areVarsEqual(Expr1AS->getBase(), Expr2AS->getBase()))
1935 if (isa<DeclRefExpr>(VarExpr1)) {
1936 auto *Expr2DRE = dyn_cast<DeclRefExpr>(VarExpr2);
1940 auto *Expr1DRE = cast<DeclRefExpr>(VarExpr1);
1942 return Expr1DRE->getDecl()->getMostRecentDecl() ==
1943 Expr2DRE->getDecl()->getMostRecentDecl();
1946 llvm_unreachable(
"Unknown variable type encountered");
1964 if (
const auto *DevTypeClause =
1965 llvm::find_if(ExistingClauses,
1967 return isa<OpenACCDeviceTypeClause>(
C);
1969 DevTypeClause != ExistingClauses.end()) {
1970 if (checkValidAfterDeviceType(
1971 *
this, *cast<OpenACCDeviceTypeClause>(*DevTypeClause), Clause))
1975 SemaOpenACCClauseVisitor Visitor{*
this, ExistingClauses};
1978 "Created wrong clause?");
1980 if (Visitor.diagNotImplemented())
2000 auto TypeIsValid = [](
QualType Ty) {
2001 return Ty->isDependentType() || Ty->isScalarType();
2004 if (isa<ArraySectionExpr>(VarExpr)) {
2005 Expr *ASExpr = VarExpr;
2009 if (!TypeIsValid(EltTy)) {
2015 if (!RD->isStruct() && !RD->isClass()) {
2016 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2021 if (!RD->isCompleteDefinition()) {
2022 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2026 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD);
2027 CXXRD && !CXXRD->isAggregate()) {
2028 Diag(VarExpr->
getExprLoc(), diag::err_acc_reduction_composite_type)
2034 if (!TypeIsValid(FD->getType())) {
2036 diag::err_acc_reduction_composite_member_type);
2037 Diag(FD->getLocation(), diag::note_acc_reduction_composite_member_loc);
2041 }
else if (!TypeIsValid(VarExpr->
getType())) {
2052 if (RClause->getReductionOp() == ReductionOp)
2055 for (
Expr *OldVarExpr : RClause->getVarList()) {
2056 if (OldVarExpr->isInstantiationDependent())
2059 if (areVarsEqual(VarExpr, OldVarExpr)) {
2061 << ReductionOp << RClause->getReductionOp();
2062 Diag(OldVarExpr->getExprLoc(), diag::note_acc_previous_clause_here);
2078 "size argument non integer?");
2082 isa<OpenACCAsteriskSizeExpr>(SizeExpr))
2085 std::optional<llvm::APSInt> ICE =
2090 if (!ICE || *ICE <= 0) {
2092 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
2106 "Loop argument non integer?");
2112 std::optional<llvm::APSInt> ICE =
2118 if (!ICE || *ICE <= 0) {
2120 << ICE.has_value() << ICE.value_or(llvm::APSInt{}).getExtValue();
2138 return CheckGangParallelExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2141 return CheckGangSerialExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2144 return CheckGangKernelsExpr(*
this, ExistingClauses, DK,
2145 ActiveComputeConstructInfo.Kind, GK,
E);
2147 switch (ActiveComputeConstructInfo.Kind) {
2151 return CheckGangParallelExpr(*
this, DK, ActiveComputeConstructInfo.Kind,
2155 return CheckGangSerialExpr(*
this, DK, ActiveComputeConstructInfo.Kind, GK,
2159 return CheckGangKernelsExpr(*
this, ExistingClauses, DK,
2160 ActiveComputeConstructInfo.Kind, GK,
E);
2162 llvm_unreachable(
"Non compute construct in active compute construct?");
2167 llvm_unreachable(
"Invalid directive kind for a Gang clause");
2169 llvm_unreachable(
"Compute construct directive not handled?");
2181 const auto *ReductionItr =
2182 llvm::find_if(ExistingClauses, llvm::IsaPred<OpenACCReductionClause>);
2184 if (ReductionItr != ExistingClauses.end()) {
2185 const auto GangZip = llvm::zip_equal(GangKinds, IntExprs);
2186 const auto GangItr = llvm::find_if(GangZip, [](
const auto &Tuple) {
2190 if (GangItr != GangZip.end()) {
2191 const Expr *DimExpr = std::get<1>(*GangItr);
2195 "Improperly formed gang argument");
2196 if (
const auto *DimVal = dyn_cast<ConstantExpr>(DimExpr);
2197 DimVal && DimVal->getResultAsAPSInt() > 1) {
2198 Diag(DimVal->getBeginLoc(), diag::err_acc_gang_reduction_conflict)
2200 Diag((*ReductionItr)->getBeginLoc(),
2201 diag::note_acc_previous_clause_here);
2208 GangKinds, IntExprs, EndLoc);
2221 const auto GangClauses = llvm::make_filter_range(
2222 ExistingClauses, llvm::IsaPred<OpenACCGangClause>);
2224 for (
auto *GC : GangClauses) {
2225 const auto *GangClause = cast<OpenACCGangClause>(GC);
2226 for (
unsigned I = 0; I < GangClause->getNumExprs(); ++I) {
2227 std::pair<OpenACCGangKind, const Expr *> EPair = GangClause->getExpr(I);
2231 if (
const auto *DimVal = dyn_cast<ConstantExpr>(EPair.second);
2232 DimVal && DimVal->getResultAsAPSInt() > 1) {
2233 Diag(BeginLoc, diag::err_acc_gang_reduction_conflict)
2234 << 1 << DirectiveKind;
2235 Diag(GangClause->getBeginLoc(), diag::note_acc_previous_clause_here);
2243 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