1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | #ifndef LLVM_CLANG_AST_OPENMPCLAUSE_H |
17 | #define LLVM_CLANG_AST_OPENMPCLAUSE_H |
18 | |
19 | #include "clang/AST/Decl.h" |
20 | #include "clang/AST/DeclarationName.h" |
21 | #include "clang/AST/Expr.h" |
22 | #include "clang/AST/NestedNameSpecifier.h" |
23 | #include "clang/AST/Stmt.h" |
24 | #include "clang/AST/StmtIterator.h" |
25 | #include "clang/Basic/LLVM.h" |
26 | #include "clang/Basic/OpenMPKinds.h" |
27 | #include "clang/Basic/SourceLocation.h" |
28 | #include "llvm/ADT/ArrayRef.h" |
29 | #include "llvm/ADT/MapVector.h" |
30 | #include "llvm/ADT/SmallVector.h" |
31 | #include "llvm/ADT/iterator.h" |
32 | #include "llvm/ADT/iterator_range.h" |
33 | #include "llvm/Support/Casting.h" |
34 | #include "llvm/Support/Compiler.h" |
35 | #include "llvm/Support/TrailingObjects.h" |
36 | #include <cassert> |
37 | #include <cstddef> |
38 | #include <iterator> |
39 | #include <utility> |
40 | |
41 | namespace clang { |
42 | |
43 | class ASTContext; |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 | class OMPClause { |
51 | |
52 | SourceLocation StartLoc; |
53 | |
54 | |
55 | SourceLocation EndLoc; |
56 | |
57 | |
58 | OpenMPClauseKind Kind; |
59 | |
60 | protected: |
61 | OMPClause(OpenMPClauseKind K, SourceLocation StartLoc, SourceLocation EndLoc) |
62 | : StartLoc(StartLoc), EndLoc(EndLoc), Kind(K) {} |
63 | |
64 | public: |
65 | |
66 | SourceLocation getBeginLoc() const { return StartLoc; } |
67 | |
68 | |
69 | SourceLocation getEndLoc() const { return EndLoc; } |
70 | |
71 | |
72 | void setLocStart(SourceLocation Loc) { StartLoc = Loc; } |
73 | |
74 | |
75 | void setLocEnd(SourceLocation Loc) { EndLoc = Loc; } |
76 | |
77 | |
78 | OpenMPClauseKind getClauseKind() const { return Kind; } |
79 | |
80 | bool isImplicit() const { return StartLoc.isInvalid(); } |
81 | |
82 | using child_iterator = StmtIterator; |
83 | using const_child_iterator = ConstStmtIterator; |
84 | using child_range = llvm::iterator_range<child_iterator>; |
85 | using const_child_range = llvm::iterator_range<const_child_iterator>; |
86 | |
87 | child_range children(); |
88 | const_child_range children() const { |
89 | auto Children = const_cast<OMPClause *>(this)->children(); |
90 | return const_child_range(Children.begin(), Children.end()); |
91 | } |
92 | |
93 | static bool classof(const OMPClause *) { return true; } |
94 | }; |
95 | |
96 | |
97 | |
98 | class OMPClauseWithPreInit { |
99 | friend class OMPClauseReader; |
100 | |
101 | |
102 | Stmt *PreInit = nullptr; |
103 | |
104 | |
105 | OpenMPDirectiveKind CaptureRegion = OMPD_unknown; |
106 | |
107 | protected: |
108 | OMPClauseWithPreInit(const OMPClause *This) { |
109 | (0) . __assert_fail ("get(This) && \"get is not tuned for pre-init.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 109, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(get(This) && "get is not tuned for pre-init."); |
110 | } |
111 | |
112 | |
113 | void setPreInitStmt(Stmt *S, OpenMPDirectiveKind ThisRegion = OMPD_unknown) { |
114 | PreInit = S; |
115 | CaptureRegion = ThisRegion; |
116 | } |
117 | |
118 | public: |
119 | |
120 | const Stmt *getPreInitStmt() const { return PreInit; } |
121 | |
122 | |
123 | Stmt *getPreInitStmt() { return PreInit; } |
124 | |
125 | |
126 | OpenMPDirectiveKind getCaptureRegion() const { return CaptureRegion; } |
127 | |
128 | static OMPClauseWithPreInit *get(OMPClause *C); |
129 | static const OMPClauseWithPreInit *get(const OMPClause *C); |
130 | }; |
131 | |
132 | |
133 | |
134 | class OMPClauseWithPostUpdate : public OMPClauseWithPreInit { |
135 | friend class OMPClauseReader; |
136 | |
137 | |
138 | Expr *PostUpdate = nullptr; |
139 | |
140 | protected: |
141 | OMPClauseWithPostUpdate(const OMPClause *This) : OMPClauseWithPreInit(This) { |
142 | (0) . __assert_fail ("get(This) && \"get is not tuned for post-update.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 142, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(get(This) && "get is not tuned for post-update."); |
143 | } |
144 | |
145 | |
146 | void setPostUpdateExpr(Expr *S) { PostUpdate = S; } |
147 | |
148 | public: |
149 | |
150 | const Expr *getPostUpdateExpr() const { return PostUpdate; } |
151 | |
152 | |
153 | Expr *getPostUpdateExpr() { return PostUpdate; } |
154 | |
155 | static OMPClauseWithPostUpdate *get(OMPClause *C); |
156 | static const OMPClauseWithPostUpdate *get(const OMPClause *C); |
157 | }; |
158 | |
159 | |
160 | struct OMPVarListLocTy { |
161 | |
162 | SourceLocation StartLoc; |
163 | |
164 | SourceLocation LParenLoc; |
165 | |
166 | SourceLocation EndLoc; |
167 | OMPVarListLocTy() = default; |
168 | OMPVarListLocTy(SourceLocation StartLoc, SourceLocation LParenLoc, |
169 | SourceLocation EndLoc) |
170 | : StartLoc(StartLoc), LParenLoc(LParenLoc), EndLoc(EndLoc) {} |
171 | }; |
172 | |
173 | |
174 | |
175 | |
176 | template <class T> class OMPVarListClause : public OMPClause { |
177 | friend class OMPClauseReader; |
178 | |
179 | |
180 | SourceLocation LParenLoc; |
181 | |
182 | |
183 | unsigned NumVars; |
184 | |
185 | protected: |
186 | |
187 | |
188 | |
189 | |
190 | |
191 | |
192 | |
193 | OMPVarListClause(OpenMPClauseKind K, SourceLocation StartLoc, |
194 | SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N) |
195 | : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {} |
196 | |
197 | |
198 | MutableArrayRef<Expr *> getVarRefs() { |
199 | return MutableArrayRef<Expr *>( |
200 | static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars); |
201 | } |
202 | |
203 | |
204 | void setVarRefs(ArrayRef<Expr *> VL) { |
205 | (0) . __assert_fail ("VL.size() == NumVars && \"Number of variables is not the same as the preallocated buffer\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 206, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(VL.size() == NumVars && |
206 | (0) . __assert_fail ("VL.size() == NumVars && \"Number of variables is not the same as the preallocated buffer\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 206, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Number of variables is not the same as the preallocated buffer"); |
207 | std::copy(VL.begin(), VL.end(), |
208 | static_cast<T *>(this)->template getTrailingObjects<Expr *>()); |
209 | } |
210 | |
211 | public: |
212 | using varlist_iterator = MutableArrayRef<Expr *>::iterator; |
213 | using varlist_const_iterator = ArrayRef<const Expr *>::iterator; |
214 | using varlist_range = llvm::iterator_range<varlist_iterator>; |
215 | using varlist_const_range = llvm::iterator_range<varlist_const_iterator>; |
216 | |
217 | unsigned varlist_size() const { return NumVars; } |
218 | bool varlist_empty() const { return NumVars == 0; } |
219 | |
220 | varlist_range varlists() { |
221 | return varlist_range(varlist_begin(), varlist_end()); |
222 | } |
223 | varlist_const_range varlists() const { |
224 | return varlist_const_range(varlist_begin(), varlist_end()); |
225 | } |
226 | |
227 | varlist_iterator varlist_begin() { return getVarRefs().begin(); } |
228 | varlist_iterator varlist_end() { return getVarRefs().end(); } |
229 | varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); } |
230 | varlist_const_iterator varlist_end() const { return getVarRefs().end(); } |
231 | |
232 | |
233 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
234 | |
235 | |
236 | SourceLocation getLParenLoc() const { return LParenLoc; } |
237 | |
238 | |
239 | ArrayRef<const Expr *> getVarRefs() const { |
240 | return llvm::makeArrayRef( |
241 | static_cast<const T *>(this)->template getTrailingObjects<Expr *>(), |
242 | NumVars); |
243 | } |
244 | }; |
245 | |
246 | |
247 | |
248 | |
249 | |
250 | |
251 | |
252 | |
253 | |
254 | class OMPAllocatorClause : public OMPClause { |
255 | friend class OMPClauseReader; |
256 | |
257 | |
258 | SourceLocation LParenLoc; |
259 | |
260 | |
261 | Stmt *Allocator = nullptr; |
262 | |
263 | |
264 | void setAllocator(Expr *A) { Allocator = A; } |
265 | |
266 | public: |
267 | |
268 | |
269 | |
270 | |
271 | |
272 | |
273 | OMPAllocatorClause(Expr *A, SourceLocation StartLoc, SourceLocation LParenLoc, |
274 | SourceLocation EndLoc) |
275 | : OMPClause(OMPC_allocator, StartLoc, EndLoc), LParenLoc(LParenLoc), |
276 | Allocator(A) {} |
277 | |
278 | |
279 | OMPAllocatorClause() |
280 | : OMPClause(OMPC_allocator, SourceLocation(), SourceLocation()) {} |
281 | |
282 | |
283 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
284 | |
285 | |
286 | SourceLocation getLParenLoc() const { return LParenLoc; } |
287 | |
288 | |
289 | Expr *getAllocator() const { return cast_or_null<Expr>(Allocator); } |
290 | |
291 | child_range children() { return child_range(&Allocator, &Allocator + 1); } |
292 | |
293 | static bool classof(const OMPClause *T) { |
294 | return T->getClauseKind() == OMPC_allocator; |
295 | } |
296 | }; |
297 | |
298 | |
299 | |
300 | |
301 | |
302 | |
303 | |
304 | |
305 | class OMPAllocateClause final |
306 | : public OMPVarListClause<OMPAllocateClause>, |
307 | private llvm::TrailingObjects<OMPAllocateClause, Expr *> { |
308 | friend class OMPClauseReader; |
309 | friend OMPVarListClause; |
310 | friend TrailingObjects; |
311 | |
312 | |
313 | |
314 | Expr *Allocator = nullptr; |
315 | |
316 | SourceLocation ColonLoc; |
317 | |
318 | |
319 | |
320 | |
321 | |
322 | |
323 | |
324 | |
325 | |
326 | OMPAllocateClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
327 | Expr *Allocator, SourceLocation ColonLoc, |
328 | SourceLocation EndLoc, unsigned N) |
329 | : OMPVarListClause<OMPAllocateClause>(OMPC_allocate, StartLoc, LParenLoc, |
330 | EndLoc, N), |
331 | Allocator(Allocator), ColonLoc(ColonLoc) {} |
332 | |
333 | |
334 | |
335 | |
336 | explicit OMPAllocateClause(unsigned N) |
337 | : OMPVarListClause<OMPAllocateClause>(OMPC_allocate, SourceLocation(), |
338 | SourceLocation(), SourceLocation(), |
339 | N) {} |
340 | |
341 | |
342 | void setColonLoc(SourceLocation CL) { ColonLoc = CL; } |
343 | |
344 | void setAllocator(Expr *A) { Allocator = A; } |
345 | |
346 | public: |
347 | |
348 | |
349 | |
350 | |
351 | |
352 | |
353 | |
354 | |
355 | |
356 | static OMPAllocateClause *Create(const ASTContext &C, SourceLocation StartLoc, |
357 | SourceLocation LParenLoc, Expr *Allocator, |
358 | SourceLocation ColonLoc, |
359 | SourceLocation EndLoc, ArrayRef<Expr *> VL); |
360 | |
361 | |
362 | Expr *getAllocator() const { return Allocator; } |
363 | |
364 | |
365 | SourceLocation getColonLoc() const { return ColonLoc; } |
366 | |
367 | |
368 | |
369 | |
370 | |
371 | static OMPAllocateClause *CreateEmpty(const ASTContext &C, unsigned N); |
372 | |
373 | child_range children() { |
374 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
375 | reinterpret_cast<Stmt **>(varlist_end())); |
376 | } |
377 | |
378 | static bool classof(const OMPClause *T) { |
379 | return T->getClauseKind() == OMPC_allocate; |
380 | } |
381 | }; |
382 | |
383 | |
384 | |
385 | |
386 | |
387 | |
388 | |
389 | |
390 | class OMPIfClause : public OMPClause, public OMPClauseWithPreInit { |
391 | friend class OMPClauseReader; |
392 | |
393 | |
394 | SourceLocation LParenLoc; |
395 | |
396 | |
397 | Stmt *Condition = nullptr; |
398 | |
399 | |
400 | SourceLocation ColonLoc; |
401 | |
402 | |
403 | OpenMPDirectiveKind NameModifier = OMPD_unknown; |
404 | |
405 | |
406 | SourceLocation NameModifierLoc; |
407 | |
408 | |
409 | void setCondition(Expr *Cond) { Condition = Cond; } |
410 | |
411 | |
412 | void setNameModifier(OpenMPDirectiveKind NM) { NameModifier = NM; } |
413 | |
414 | |
415 | void setNameModifierLoc(SourceLocation Loc) { NameModifierLoc = Loc; } |
416 | |
417 | |
418 | void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; } |
419 | |
420 | public: |
421 | |
422 | |
423 | |
424 | |
425 | |
426 | |
427 | |
428 | |
429 | |
430 | |
431 | |
432 | |
433 | OMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Cond, Stmt *HelperCond, |
434 | OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, |
435 | SourceLocation LParenLoc, SourceLocation NameModifierLoc, |
436 | SourceLocation ColonLoc, SourceLocation EndLoc) |
437 | : OMPClause(OMPC_if, StartLoc, EndLoc), OMPClauseWithPreInit(this), |
438 | LParenLoc(LParenLoc), Condition(Cond), ColonLoc(ColonLoc), |
439 | NameModifier(NameModifier), NameModifierLoc(NameModifierLoc) { |
440 | setPreInitStmt(HelperCond, CaptureRegion); |
441 | } |
442 | |
443 | |
444 | OMPIfClause() |
445 | : OMPClause(OMPC_if, SourceLocation(), SourceLocation()), |
446 | OMPClauseWithPreInit(this) {} |
447 | |
448 | |
449 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
450 | |
451 | |
452 | SourceLocation getLParenLoc() const { return LParenLoc; } |
453 | |
454 | |
455 | SourceLocation getColonLoc() const { return ColonLoc; } |
456 | |
457 | |
458 | Expr *getCondition() const { return cast_or_null<Expr>(Condition); } |
459 | |
460 | |
461 | OpenMPDirectiveKind getNameModifier() const { return NameModifier; } |
462 | |
463 | |
464 | SourceLocation getNameModifierLoc() const { return NameModifierLoc; } |
465 | |
466 | child_range children() { return child_range(&Condition, &Condition + 1); } |
467 | |
468 | static bool classof(const OMPClause *T) { |
469 | return T->getClauseKind() == OMPC_if; |
470 | } |
471 | }; |
472 | |
473 | |
474 | |
475 | |
476 | |
477 | |
478 | |
479 | |
480 | class OMPFinalClause : public OMPClause { |
481 | friend class OMPClauseReader; |
482 | |
483 | |
484 | SourceLocation LParenLoc; |
485 | |
486 | |
487 | Stmt *Condition = nullptr; |
488 | |
489 | |
490 | void setCondition(Expr *Cond) { Condition = Cond; } |
491 | |
492 | public: |
493 | |
494 | |
495 | |
496 | |
497 | |
498 | |
499 | OMPFinalClause(Expr *Cond, SourceLocation StartLoc, SourceLocation LParenLoc, |
500 | SourceLocation EndLoc) |
501 | : OMPClause(OMPC_final, StartLoc, EndLoc), LParenLoc(LParenLoc), |
502 | Condition(Cond) {} |
503 | |
504 | |
505 | OMPFinalClause() |
506 | : OMPClause(OMPC_final, SourceLocation(), SourceLocation()) {} |
507 | |
508 | |
509 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
510 | |
511 | |
512 | SourceLocation getLParenLoc() const { return LParenLoc; } |
513 | |
514 | |
515 | Expr *getCondition() const { return cast_or_null<Expr>(Condition); } |
516 | |
517 | child_range children() { return child_range(&Condition, &Condition + 1); } |
518 | |
519 | static bool classof(const OMPClause *T) { |
520 | return T->getClauseKind() == OMPC_final; |
521 | } |
522 | }; |
523 | |
524 | |
525 | |
526 | |
527 | |
528 | |
529 | |
530 | |
531 | |
532 | class OMPNumThreadsClause : public OMPClause, public OMPClauseWithPreInit { |
533 | friend class OMPClauseReader; |
534 | |
535 | |
536 | SourceLocation LParenLoc; |
537 | |
538 | |
539 | Stmt *NumThreads = nullptr; |
540 | |
541 | |
542 | void setNumThreads(Expr *NThreads) { NumThreads = NThreads; } |
543 | |
544 | public: |
545 | |
546 | |
547 | |
548 | |
549 | |
550 | |
551 | |
552 | |
553 | |
554 | OMPNumThreadsClause(Expr *NumThreads, Stmt *HelperNumThreads, |
555 | OpenMPDirectiveKind CaptureRegion, |
556 | SourceLocation StartLoc, SourceLocation LParenLoc, |
557 | SourceLocation EndLoc) |
558 | : OMPClause(OMPC_num_threads, StartLoc, EndLoc), |
559 | OMPClauseWithPreInit(this), LParenLoc(LParenLoc), |
560 | NumThreads(NumThreads) { |
561 | setPreInitStmt(HelperNumThreads, CaptureRegion); |
562 | } |
563 | |
564 | |
565 | OMPNumThreadsClause() |
566 | : OMPClause(OMPC_num_threads, SourceLocation(), SourceLocation()), |
567 | OMPClauseWithPreInit(this) {} |
568 | |
569 | |
570 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
571 | |
572 | |
573 | SourceLocation getLParenLoc() const { return LParenLoc; } |
574 | |
575 | |
576 | Expr *getNumThreads() const { return cast_or_null<Expr>(NumThreads); } |
577 | |
578 | child_range children() { return child_range(&NumThreads, &NumThreads + 1); } |
579 | |
580 | static bool classof(const OMPClause *T) { |
581 | return T->getClauseKind() == OMPC_num_threads; |
582 | } |
583 | }; |
584 | |
585 | |
586 | |
587 | |
588 | |
589 | |
590 | |
591 | |
592 | |
593 | |
594 | |
595 | |
596 | |
597 | class OMPSafelenClause : public OMPClause { |
598 | friend class OMPClauseReader; |
599 | |
600 | |
601 | SourceLocation LParenLoc; |
602 | |
603 | |
604 | Stmt *Safelen = nullptr; |
605 | |
606 | |
607 | void setSafelen(Expr *Len) { Safelen = Len; } |
608 | |
609 | public: |
610 | |
611 | |
612 | |
613 | |
614 | |
615 | OMPSafelenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc, |
616 | SourceLocation EndLoc) |
617 | : OMPClause(OMPC_safelen, StartLoc, EndLoc), LParenLoc(LParenLoc), |
618 | Safelen(Len) {} |
619 | |
620 | |
621 | explicit OMPSafelenClause() |
622 | : OMPClause(OMPC_safelen, SourceLocation(), SourceLocation()) {} |
623 | |
624 | |
625 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
626 | |
627 | |
628 | SourceLocation getLParenLoc() const { return LParenLoc; } |
629 | |
630 | |
631 | Expr *getSafelen() const { return cast_or_null<Expr>(Safelen); } |
632 | |
633 | child_range children() { return child_range(&Safelen, &Safelen + 1); } |
634 | |
635 | static bool classof(const OMPClause *T) { |
636 | return T->getClauseKind() == OMPC_safelen; |
637 | } |
638 | }; |
639 | |
640 | |
641 | |
642 | |
643 | |
644 | |
645 | |
646 | |
647 | |
648 | |
649 | |
650 | |
651 | class OMPSimdlenClause : public OMPClause { |
652 | friend class OMPClauseReader; |
653 | |
654 | |
655 | SourceLocation LParenLoc; |
656 | |
657 | |
658 | Stmt *Simdlen = nullptr; |
659 | |
660 | |
661 | void setSimdlen(Expr *Len) { Simdlen = Len; } |
662 | |
663 | public: |
664 | |
665 | |
666 | |
667 | |
668 | |
669 | OMPSimdlenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc, |
670 | SourceLocation EndLoc) |
671 | : OMPClause(OMPC_simdlen, StartLoc, EndLoc), LParenLoc(LParenLoc), |
672 | Simdlen(Len) {} |
673 | |
674 | |
675 | explicit OMPSimdlenClause() |
676 | : OMPClause(OMPC_simdlen, SourceLocation(), SourceLocation()) {} |
677 | |
678 | |
679 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
680 | |
681 | |
682 | SourceLocation getLParenLoc() const { return LParenLoc; } |
683 | |
684 | |
685 | Expr *getSimdlen() const { return cast_or_null<Expr>(Simdlen); } |
686 | |
687 | child_range children() { return child_range(&Simdlen, &Simdlen + 1); } |
688 | |
689 | static bool classof(const OMPClause *T) { |
690 | return T->getClauseKind() == OMPC_simdlen; |
691 | } |
692 | }; |
693 | |
694 | |
695 | |
696 | |
697 | |
698 | |
699 | |
700 | |
701 | |
702 | |
703 | |
704 | |
705 | class OMPCollapseClause : public OMPClause { |
706 | friend class OMPClauseReader; |
707 | |
708 | |
709 | SourceLocation LParenLoc; |
710 | |
711 | |
712 | Stmt *NumForLoops = nullptr; |
713 | |
714 | |
715 | void setNumForLoops(Expr *Num) { NumForLoops = Num; } |
716 | |
717 | public: |
718 | |
719 | |
720 | |
721 | |
722 | |
723 | |
724 | OMPCollapseClause(Expr *Num, SourceLocation StartLoc, |
725 | SourceLocation LParenLoc, SourceLocation EndLoc) |
726 | : OMPClause(OMPC_collapse, StartLoc, EndLoc), LParenLoc(LParenLoc), |
727 | NumForLoops(Num) {} |
728 | |
729 | |
730 | explicit OMPCollapseClause() |
731 | : OMPClause(OMPC_collapse, SourceLocation(), SourceLocation()) {} |
732 | |
733 | |
734 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
735 | |
736 | |
737 | SourceLocation getLParenLoc() const { return LParenLoc; } |
738 | |
739 | |
740 | Expr *getNumForLoops() const { return cast_or_null<Expr>(NumForLoops); } |
741 | |
742 | child_range children() { return child_range(&NumForLoops, &NumForLoops + 1); } |
743 | |
744 | static bool classof(const OMPClause *T) { |
745 | return T->getClauseKind() == OMPC_collapse; |
746 | } |
747 | }; |
748 | |
749 | |
750 | |
751 | |
752 | |
753 | |
754 | |
755 | |
756 | class OMPDefaultClause : public OMPClause { |
757 | friend class OMPClauseReader; |
758 | |
759 | |
760 | SourceLocation LParenLoc; |
761 | |
762 | |
763 | OpenMPDefaultClauseKind Kind = OMPC_DEFAULT_unknown; |
764 | |
765 | |
766 | SourceLocation KindKwLoc; |
767 | |
768 | |
769 | |
770 | |
771 | void setDefaultKind(OpenMPDefaultClauseKind K) { Kind = K; } |
772 | |
773 | |
774 | |
775 | |
776 | void setDefaultKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; } |
777 | |
778 | public: |
779 | |
780 | |
781 | |
782 | |
783 | |
784 | |
785 | |
786 | OMPDefaultClause(OpenMPDefaultClauseKind A, SourceLocation ALoc, |
787 | SourceLocation StartLoc, SourceLocation LParenLoc, |
788 | SourceLocation EndLoc) |
789 | : OMPClause(OMPC_default, StartLoc, EndLoc), LParenLoc(LParenLoc), |
790 | Kind(A), KindKwLoc(ALoc) {} |
791 | |
792 | |
793 | OMPDefaultClause() |
794 | : OMPClause(OMPC_default, SourceLocation(), SourceLocation()) {} |
795 | |
796 | |
797 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
798 | |
799 | |
800 | SourceLocation getLParenLoc() const { return LParenLoc; } |
801 | |
802 | |
803 | OpenMPDefaultClauseKind getDefaultKind() const { return Kind; } |
804 | |
805 | |
806 | SourceLocation getDefaultKindKwLoc() const { return KindKwLoc; } |
807 | |
808 | child_range children() { |
809 | return child_range(child_iterator(), child_iterator()); |
810 | } |
811 | |
812 | static bool classof(const OMPClause *T) { |
813 | return T->getClauseKind() == OMPC_default; |
814 | } |
815 | }; |
816 | |
817 | |
818 | |
819 | |
820 | |
821 | |
822 | |
823 | |
824 | |
825 | class OMPProcBindClause : public OMPClause { |
826 | friend class OMPClauseReader; |
827 | |
828 | |
829 | SourceLocation LParenLoc; |
830 | |
831 | |
832 | OpenMPProcBindClauseKind Kind = OMPC_PROC_BIND_unknown; |
833 | |
834 | |
835 | SourceLocation KindKwLoc; |
836 | |
837 | |
838 | |
839 | |
840 | void setProcBindKind(OpenMPProcBindClauseKind K) { Kind = K; } |
841 | |
842 | |
843 | |
844 | |
845 | void setProcBindKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; } |
846 | |
847 | public: |
848 | |
849 | |
850 | |
851 | |
852 | |
853 | |
854 | |
855 | |
856 | OMPProcBindClause(OpenMPProcBindClauseKind A, SourceLocation ALoc, |
857 | SourceLocation StartLoc, SourceLocation LParenLoc, |
858 | SourceLocation EndLoc) |
859 | : OMPClause(OMPC_proc_bind, StartLoc, EndLoc), LParenLoc(LParenLoc), |
860 | Kind(A), KindKwLoc(ALoc) {} |
861 | |
862 | |
863 | OMPProcBindClause() |
864 | : OMPClause(OMPC_proc_bind, SourceLocation(), SourceLocation()) {} |
865 | |
866 | |
867 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
868 | |
869 | |
870 | SourceLocation getLParenLoc() const { return LParenLoc; } |
871 | |
872 | |
873 | OpenMPProcBindClauseKind getProcBindKind() const { return Kind; } |
874 | |
875 | |
876 | SourceLocation getProcBindKindKwLoc() const { return KindKwLoc; } |
877 | |
878 | child_range children() { |
879 | return child_range(child_iterator(), child_iterator()); |
880 | } |
881 | |
882 | static bool classof(const OMPClause *T) { |
883 | return T->getClauseKind() == OMPC_proc_bind; |
884 | } |
885 | }; |
886 | |
887 | |
888 | |
889 | |
890 | |
891 | |
892 | |
893 | |
894 | |
895 | class OMPUnifiedAddressClause final : public OMPClause { |
896 | public: |
897 | friend class OMPClauseReader; |
898 | |
899 | |
900 | |
901 | |
902 | OMPUnifiedAddressClause(SourceLocation StartLoc, SourceLocation EndLoc) |
903 | : OMPClause(OMPC_unified_address, StartLoc, EndLoc) {} |
904 | |
905 | |
906 | OMPUnifiedAddressClause() |
907 | : OMPClause(OMPC_unified_address, SourceLocation(), SourceLocation()) {} |
908 | |
909 | child_range children() { |
910 | return child_range(child_iterator(), child_iterator()); |
911 | } |
912 | |
913 | static bool classof(const OMPClause *T) { |
914 | return T->getClauseKind() == OMPC_unified_address; |
915 | } |
916 | }; |
917 | |
918 | |
919 | |
920 | |
921 | |
922 | |
923 | |
924 | |
925 | |
926 | class OMPUnifiedSharedMemoryClause final : public OMPClause { |
927 | public: |
928 | friend class OMPClauseReader; |
929 | |
930 | |
931 | |
932 | |
933 | OMPUnifiedSharedMemoryClause(SourceLocation StartLoc, SourceLocation EndLoc) |
934 | : OMPClause(OMPC_unified_shared_memory, StartLoc, EndLoc) {} |
935 | |
936 | |
937 | OMPUnifiedSharedMemoryClause() |
938 | : OMPClause(OMPC_unified_shared_memory, SourceLocation(), SourceLocation()) {} |
939 | |
940 | child_range children() { |
941 | return child_range(child_iterator(), child_iterator()); |
942 | } |
943 | |
944 | static bool classof(const OMPClause *T) { |
945 | return T->getClauseKind() == OMPC_unified_shared_memory; |
946 | } |
947 | }; |
948 | |
949 | |
950 | |
951 | |
952 | |
953 | |
954 | |
955 | |
956 | |
957 | class OMPReverseOffloadClause final : public OMPClause { |
958 | public: |
959 | friend class OMPClauseReader; |
960 | |
961 | |
962 | |
963 | |
964 | OMPReverseOffloadClause(SourceLocation StartLoc, SourceLocation EndLoc) |
965 | : OMPClause(OMPC_reverse_offload, StartLoc, EndLoc) {} |
966 | |
967 | |
968 | OMPReverseOffloadClause() |
969 | : OMPClause(OMPC_reverse_offload, SourceLocation(), SourceLocation()) {} |
970 | |
971 | child_range children() { |
972 | return child_range(child_iterator(), child_iterator()); |
973 | } |
974 | |
975 | static bool classof(const OMPClause *T) { |
976 | return T->getClauseKind() == OMPC_reverse_offload; |
977 | } |
978 | }; |
979 | |
980 | |
981 | |
982 | |
983 | |
984 | |
985 | |
986 | |
987 | |
988 | class OMPDynamicAllocatorsClause final : public OMPClause { |
989 | public: |
990 | friend class OMPClauseReader; |
991 | |
992 | |
993 | |
994 | |
995 | OMPDynamicAllocatorsClause(SourceLocation StartLoc, SourceLocation EndLoc) |
996 | : OMPClause(OMPC_dynamic_allocators, StartLoc, EndLoc) {} |
997 | |
998 | |
999 | OMPDynamicAllocatorsClause() |
1000 | : OMPClause(OMPC_dynamic_allocators, SourceLocation(), SourceLocation()) { |
1001 | } |
1002 | |
1003 | child_range children() { |
1004 | return child_range(child_iterator(), child_iterator()); |
1005 | } |
1006 | |
1007 | static bool classof(const OMPClause *T) { |
1008 | return T->getClauseKind() == OMPC_dynamic_allocators; |
1009 | } |
1010 | }; |
1011 | |
1012 | |
1013 | |
1014 | |
1015 | |
1016 | |
1017 | |
1018 | |
1019 | |
1020 | class OMPAtomicDefaultMemOrderClause final : public OMPClause { |
1021 | friend class OMPClauseReader; |
1022 | |
1023 | |
1024 | SourceLocation LParenLoc; |
1025 | |
1026 | |
1027 | OpenMPAtomicDefaultMemOrderClauseKind Kind = |
1028 | OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown; |
1029 | |
1030 | |
1031 | SourceLocation KindKwLoc; |
1032 | |
1033 | |
1034 | |
1035 | |
1036 | void setAtomicDefaultMemOrderKind(OpenMPAtomicDefaultMemOrderClauseKind K) { |
1037 | Kind = K; |
1038 | } |
1039 | |
1040 | |
1041 | |
1042 | |
1043 | void setAtomicDefaultMemOrderKindKwLoc(SourceLocation KLoc) { |
1044 | KindKwLoc = KLoc; |
1045 | } |
1046 | |
1047 | public: |
1048 | |
1049 | |
1050 | |
1051 | |
1052 | |
1053 | |
1054 | |
1055 | |
1056 | OMPAtomicDefaultMemOrderClause(OpenMPAtomicDefaultMemOrderClauseKind A, |
1057 | SourceLocation ALoc, SourceLocation StartLoc, |
1058 | SourceLocation LParenLoc, |
1059 | SourceLocation EndLoc) |
1060 | : OMPClause(OMPC_atomic_default_mem_order, StartLoc, EndLoc), |
1061 | LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {} |
1062 | |
1063 | |
1064 | OMPAtomicDefaultMemOrderClause() |
1065 | : OMPClause(OMPC_atomic_default_mem_order, SourceLocation(), |
1066 | SourceLocation()) {} |
1067 | |
1068 | |
1069 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
1070 | |
1071 | |
1072 | SourceLocation getLParenLoc() const { return LParenLoc; } |
1073 | |
1074 | |
1075 | OpenMPAtomicDefaultMemOrderClauseKind getAtomicDefaultMemOrderKind() const { |
1076 | return Kind; |
1077 | } |
1078 | |
1079 | |
1080 | SourceLocation getAtomicDefaultMemOrderKindKwLoc() const { return KindKwLoc; } |
1081 | |
1082 | child_range children() { |
1083 | return child_range(child_iterator(), child_iterator()); |
1084 | } |
1085 | |
1086 | static bool classof(const OMPClause *T) { |
1087 | return T->getClauseKind() == OMPC_atomic_default_mem_order; |
1088 | } |
1089 | }; |
1090 | |
1091 | |
1092 | |
1093 | |
1094 | |
1095 | |
1096 | |
1097 | |
1098 | class OMPScheduleClause : public OMPClause, public OMPClauseWithPreInit { |
1099 | friend class OMPClauseReader; |
1100 | |
1101 | |
1102 | SourceLocation LParenLoc; |
1103 | |
1104 | |
1105 | OpenMPScheduleClauseKind Kind = OMPC_SCHEDULE_unknown; |
1106 | |
1107 | |
1108 | enum {FIRST, SECOND, NUM_MODIFIERS}; |
1109 | OpenMPScheduleClauseModifier Modifiers[NUM_MODIFIERS]; |
1110 | |
1111 | |
1112 | SourceLocation ModifiersLoc[NUM_MODIFIERS]; |
1113 | |
1114 | |
1115 | SourceLocation KindLoc; |
1116 | |
1117 | |
1118 | SourceLocation CommaLoc; |
1119 | |
1120 | |
1121 | Expr *ChunkSize = nullptr; |
1122 | |
1123 | |
1124 | |
1125 | |
1126 | void setScheduleKind(OpenMPScheduleClauseKind K) { Kind = K; } |
1127 | |
1128 | |
1129 | |
1130 | |
1131 | void setFirstScheduleModifier(OpenMPScheduleClauseModifier M) { |
1132 | Modifiers[FIRST] = M; |
1133 | } |
1134 | |
1135 | |
1136 | |
1137 | |
1138 | void setSecondScheduleModifier(OpenMPScheduleClauseModifier M) { |
1139 | Modifiers[SECOND] = M; |
1140 | } |
1141 | |
1142 | |
1143 | void setFirstScheduleModifierLoc(SourceLocation Loc) { |
1144 | ModifiersLoc[FIRST] = Loc; |
1145 | } |
1146 | |
1147 | |
1148 | void setSecondScheduleModifierLoc(SourceLocation Loc) { |
1149 | ModifiersLoc[SECOND] = Loc; |
1150 | } |
1151 | |
1152 | |
1153 | |
1154 | |
1155 | void setScheduleModifer(OpenMPScheduleClauseModifier M) { |
1156 | if (Modifiers[FIRST] == OMPC_SCHEDULE_MODIFIER_unknown) |
1157 | Modifiers[FIRST] = M; |
1158 | else { |
1159 | assert(Modifiers[SECOND] == OMPC_SCHEDULE_MODIFIER_unknown); |
1160 | Modifiers[SECOND] = M; |
1161 | } |
1162 | } |
1163 | |
1164 | |
1165 | |
1166 | |
1167 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
1168 | |
1169 | |
1170 | |
1171 | |
1172 | void setScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; } |
1173 | |
1174 | |
1175 | |
1176 | |
1177 | void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; } |
1178 | |
1179 | |
1180 | |
1181 | |
1182 | void setChunkSize(Expr *E) { ChunkSize = E; } |
1183 | |
1184 | public: |
1185 | |
1186 | |
1187 | |
1188 | |
1189 | |
1190 | |
1191 | |
1192 | |
1193 | |
1194 | |
1195 | |
1196 | |
1197 | |
1198 | |
1199 | |
1200 | OMPScheduleClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
1201 | SourceLocation KLoc, SourceLocation CommaLoc, |
1202 | SourceLocation EndLoc, OpenMPScheduleClauseKind Kind, |
1203 | Expr *ChunkSize, Stmt *HelperChunkSize, |
1204 | OpenMPScheduleClauseModifier M1, SourceLocation M1Loc, |
1205 | OpenMPScheduleClauseModifier M2, SourceLocation M2Loc) |
1206 | : OMPClause(OMPC_schedule, StartLoc, EndLoc), OMPClauseWithPreInit(this), |
1207 | LParenLoc(LParenLoc), Kind(Kind), KindLoc(KLoc), CommaLoc(CommaLoc), |
1208 | ChunkSize(ChunkSize) { |
1209 | setPreInitStmt(HelperChunkSize); |
1210 | Modifiers[FIRST] = M1; |
1211 | Modifiers[SECOND] = M2; |
1212 | ModifiersLoc[FIRST] = M1Loc; |
1213 | ModifiersLoc[SECOND] = M2Loc; |
1214 | } |
1215 | |
1216 | |
1217 | explicit OMPScheduleClause() |
1218 | : OMPClause(OMPC_schedule, SourceLocation(), SourceLocation()), |
1219 | OMPClauseWithPreInit(this) { |
1220 | Modifiers[FIRST] = OMPC_SCHEDULE_MODIFIER_unknown; |
1221 | Modifiers[SECOND] = OMPC_SCHEDULE_MODIFIER_unknown; |
1222 | } |
1223 | |
1224 | |
1225 | OpenMPScheduleClauseKind getScheduleKind() const { return Kind; } |
1226 | |
1227 | |
1228 | OpenMPScheduleClauseModifier getFirstScheduleModifier() const { |
1229 | return Modifiers[FIRST]; |
1230 | } |
1231 | |
1232 | |
1233 | OpenMPScheduleClauseModifier getSecondScheduleModifier() const { |
1234 | return Modifiers[SECOND]; |
1235 | } |
1236 | |
1237 | |
1238 | SourceLocation getLParenLoc() { return LParenLoc; } |
1239 | |
1240 | |
1241 | SourceLocation getScheduleKindLoc() { return KindLoc; } |
1242 | |
1243 | |
1244 | SourceLocation getFirstScheduleModifierLoc() const { |
1245 | return ModifiersLoc[FIRST]; |
1246 | } |
1247 | |
1248 | |
1249 | SourceLocation getSecondScheduleModifierLoc() const { |
1250 | return ModifiersLoc[SECOND]; |
1251 | } |
1252 | |
1253 | |
1254 | SourceLocation getCommaLoc() { return CommaLoc; } |
1255 | |
1256 | |
1257 | Expr *getChunkSize() { return ChunkSize; } |
1258 | |
1259 | |
1260 | const Expr *getChunkSize() const { return ChunkSize; } |
1261 | |
1262 | child_range children() { |
1263 | return child_range(reinterpret_cast<Stmt **>(&ChunkSize), |
1264 | reinterpret_cast<Stmt **>(&ChunkSize) + 1); |
1265 | } |
1266 | |
1267 | static bool classof(const OMPClause *T) { |
1268 | return T->getClauseKind() == OMPC_schedule; |
1269 | } |
1270 | }; |
1271 | |
1272 | |
1273 | |
1274 | |
1275 | |
1276 | |
1277 | |
1278 | |
1279 | class OMPOrderedClause final |
1280 | : public OMPClause, |
1281 | private llvm::TrailingObjects<OMPOrderedClause, Expr *> { |
1282 | friend class OMPClauseReader; |
1283 | friend TrailingObjects; |
1284 | |
1285 | |
1286 | SourceLocation LParenLoc; |
1287 | |
1288 | |
1289 | Stmt *NumForLoops = nullptr; |
1290 | |
1291 | |
1292 | unsigned NumberOfLoops = 0; |
1293 | |
1294 | |
1295 | |
1296 | |
1297 | |
1298 | |
1299 | |
1300 | |
1301 | OMPOrderedClause(Expr *Num, unsigned NumLoops, SourceLocation StartLoc, |
1302 | SourceLocation LParenLoc, SourceLocation EndLoc) |
1303 | : OMPClause(OMPC_ordered, StartLoc, EndLoc), LParenLoc(LParenLoc), |
1304 | NumForLoops(Num), NumberOfLoops(NumLoops) {} |
1305 | |
1306 | |
1307 | explicit OMPOrderedClause(unsigned NumLoops) |
1308 | : OMPClause(OMPC_ordered, SourceLocation(), SourceLocation()), |
1309 | NumberOfLoops(NumLoops) {} |
1310 | |
1311 | |
1312 | void setNumForLoops(Expr *Num) { NumForLoops = Num; } |
1313 | |
1314 | public: |
1315 | |
1316 | |
1317 | |
1318 | |
1319 | |
1320 | |
1321 | |
1322 | static OMPOrderedClause *Create(const ASTContext &C, Expr *Num, |
1323 | unsigned NumLoops, SourceLocation StartLoc, |
1324 | SourceLocation LParenLoc, |
1325 | SourceLocation EndLoc); |
1326 | |
1327 | |
1328 | static OMPOrderedClause* CreateEmpty(const ASTContext &C, unsigned NumLoops); |
1329 | |
1330 | |
1331 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
1332 | |
1333 | |
1334 | SourceLocation getLParenLoc() const { return LParenLoc; } |
1335 | |
1336 | |
1337 | Expr *getNumForLoops() const { return cast_or_null<Expr>(NumForLoops); } |
1338 | |
1339 | |
1340 | void setLoopNumIterations(unsigned NumLoop, Expr *NumIterations); |
1341 | |
1342 | ArrayRef<Expr *> getLoopNumIterations() const; |
1343 | |
1344 | |
1345 | void setLoopCounter(unsigned NumLoop, Expr *Counter); |
1346 | |
1347 | Expr *getLoopCounter(unsigned NumLoop); |
1348 | const Expr *getLoopCounter(unsigned NumLoop) const; |
1349 | |
1350 | child_range children() { return child_range(&NumForLoops, &NumForLoops + 1); } |
1351 | |
1352 | static bool classof(const OMPClause *T) { |
1353 | return T->getClauseKind() == OMPC_ordered; |
1354 | } |
1355 | }; |
1356 | |
1357 | |
1358 | |
1359 | |
1360 | |
1361 | |
1362 | |
1363 | class OMPNowaitClause : public OMPClause { |
1364 | public: |
1365 | |
1366 | |
1367 | |
1368 | |
1369 | OMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1370 | : OMPClause(OMPC_nowait, StartLoc, EndLoc) {} |
1371 | |
1372 | |
1373 | OMPNowaitClause() |
1374 | : OMPClause(OMPC_nowait, SourceLocation(), SourceLocation()) {} |
1375 | |
1376 | child_range children() { |
1377 | return child_range(child_iterator(), child_iterator()); |
1378 | } |
1379 | |
1380 | static bool classof(const OMPClause *T) { |
1381 | return T->getClauseKind() == OMPC_nowait; |
1382 | } |
1383 | }; |
1384 | |
1385 | |
1386 | |
1387 | |
1388 | |
1389 | |
1390 | |
1391 | class OMPUntiedClause : public OMPClause { |
1392 | public: |
1393 | |
1394 | |
1395 | |
1396 | |
1397 | OMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1398 | : OMPClause(OMPC_untied, StartLoc, EndLoc) {} |
1399 | |
1400 | |
1401 | OMPUntiedClause() |
1402 | : OMPClause(OMPC_untied, SourceLocation(), SourceLocation()) {} |
1403 | |
1404 | child_range children() { |
1405 | return child_range(child_iterator(), child_iterator()); |
1406 | } |
1407 | |
1408 | static bool classof(const OMPClause *T) { |
1409 | return T->getClauseKind() == OMPC_untied; |
1410 | } |
1411 | }; |
1412 | |
1413 | |
1414 | |
1415 | |
1416 | |
1417 | |
1418 | |
1419 | |
1420 | class OMPMergeableClause : public OMPClause { |
1421 | public: |
1422 | |
1423 | |
1424 | |
1425 | |
1426 | OMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1427 | : OMPClause(OMPC_mergeable, StartLoc, EndLoc) {} |
1428 | |
1429 | |
1430 | OMPMergeableClause() |
1431 | : OMPClause(OMPC_mergeable, SourceLocation(), SourceLocation()) {} |
1432 | |
1433 | child_range children() { |
1434 | return child_range(child_iterator(), child_iterator()); |
1435 | } |
1436 | |
1437 | static bool classof(const OMPClause *T) { |
1438 | return T->getClauseKind() == OMPC_mergeable; |
1439 | } |
1440 | }; |
1441 | |
1442 | |
1443 | |
1444 | |
1445 | |
1446 | |
1447 | |
1448 | class OMPReadClause : public OMPClause { |
1449 | public: |
1450 | |
1451 | |
1452 | |
1453 | |
1454 | OMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1455 | : OMPClause(OMPC_read, StartLoc, EndLoc) {} |
1456 | |
1457 | |
1458 | OMPReadClause() : OMPClause(OMPC_read, SourceLocation(), SourceLocation()) {} |
1459 | |
1460 | child_range children() { |
1461 | return child_range(child_iterator(), child_iterator()); |
1462 | } |
1463 | |
1464 | static bool classof(const OMPClause *T) { |
1465 | return T->getClauseKind() == OMPC_read; |
1466 | } |
1467 | }; |
1468 | |
1469 | |
1470 | |
1471 | |
1472 | |
1473 | |
1474 | |
1475 | class OMPWriteClause : public OMPClause { |
1476 | public: |
1477 | |
1478 | |
1479 | |
1480 | |
1481 | OMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1482 | : OMPClause(OMPC_write, StartLoc, EndLoc) {} |
1483 | |
1484 | |
1485 | OMPWriteClause() |
1486 | : OMPClause(OMPC_write, SourceLocation(), SourceLocation()) {} |
1487 | |
1488 | child_range children() { |
1489 | return child_range(child_iterator(), child_iterator()); |
1490 | } |
1491 | |
1492 | static bool classof(const OMPClause *T) { |
1493 | return T->getClauseKind() == OMPC_write; |
1494 | } |
1495 | }; |
1496 | |
1497 | |
1498 | |
1499 | |
1500 | |
1501 | |
1502 | |
1503 | |
1504 | class OMPUpdateClause : public OMPClause { |
1505 | public: |
1506 | |
1507 | |
1508 | |
1509 | |
1510 | OMPUpdateClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1511 | : OMPClause(OMPC_update, StartLoc, EndLoc) {} |
1512 | |
1513 | |
1514 | OMPUpdateClause() |
1515 | : OMPClause(OMPC_update, SourceLocation(), SourceLocation()) {} |
1516 | |
1517 | child_range children() { |
1518 | return child_range(child_iterator(), child_iterator()); |
1519 | } |
1520 | |
1521 | static bool classof(const OMPClause *T) { |
1522 | return T->getClauseKind() == OMPC_update; |
1523 | } |
1524 | }; |
1525 | |
1526 | |
1527 | |
1528 | |
1529 | |
1530 | |
1531 | |
1532 | |
1533 | class OMPCaptureClause : public OMPClause { |
1534 | public: |
1535 | |
1536 | |
1537 | |
1538 | |
1539 | OMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1540 | : OMPClause(OMPC_capture, StartLoc, EndLoc) {} |
1541 | |
1542 | |
1543 | OMPCaptureClause() |
1544 | : OMPClause(OMPC_capture, SourceLocation(), SourceLocation()) {} |
1545 | |
1546 | child_range children() { |
1547 | return child_range(child_iterator(), child_iterator()); |
1548 | } |
1549 | |
1550 | static bool classof(const OMPClause *T) { |
1551 | return T->getClauseKind() == OMPC_capture; |
1552 | } |
1553 | }; |
1554 | |
1555 | |
1556 | |
1557 | |
1558 | |
1559 | |
1560 | |
1561 | |
1562 | class OMPSeqCstClause : public OMPClause { |
1563 | public: |
1564 | |
1565 | |
1566 | |
1567 | |
1568 | OMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc) |
1569 | : OMPClause(OMPC_seq_cst, StartLoc, EndLoc) {} |
1570 | |
1571 | |
1572 | OMPSeqCstClause() |
1573 | : OMPClause(OMPC_seq_cst, SourceLocation(), SourceLocation()) {} |
1574 | |
1575 | child_range children() { |
1576 | return child_range(child_iterator(), child_iterator()); |
1577 | } |
1578 | |
1579 | static bool classof(const OMPClause *T) { |
1580 | return T->getClauseKind() == OMPC_seq_cst; |
1581 | } |
1582 | }; |
1583 | |
1584 | |
1585 | |
1586 | |
1587 | |
1588 | |
1589 | |
1590 | |
1591 | class OMPPrivateClause final |
1592 | : public OMPVarListClause<OMPPrivateClause>, |
1593 | private llvm::TrailingObjects<OMPPrivateClause, Expr *> { |
1594 | friend class OMPClauseReader; |
1595 | friend OMPVarListClause; |
1596 | friend TrailingObjects; |
1597 | |
1598 | |
1599 | |
1600 | |
1601 | |
1602 | |
1603 | |
1604 | OMPPrivateClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
1605 | SourceLocation EndLoc, unsigned N) |
1606 | : OMPVarListClause<OMPPrivateClause>(OMPC_private, StartLoc, LParenLoc, |
1607 | EndLoc, N) {} |
1608 | |
1609 | |
1610 | |
1611 | |
1612 | explicit OMPPrivateClause(unsigned N) |
1613 | : OMPVarListClause<OMPPrivateClause>(OMPC_private, SourceLocation(), |
1614 | SourceLocation(), SourceLocation(), |
1615 | N) {} |
1616 | |
1617 | |
1618 | |
1619 | |
1620 | void setPrivateCopies(ArrayRef<Expr *> VL); |
1621 | |
1622 | |
1623 | |
1624 | MutableArrayRef<Expr *> getPrivateCopies() { |
1625 | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
1626 | } |
1627 | ArrayRef<const Expr *> getPrivateCopies() const { |
1628 | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
1629 | } |
1630 | |
1631 | public: |
1632 | |
1633 | |
1634 | |
1635 | |
1636 | |
1637 | |
1638 | |
1639 | |
1640 | static OMPPrivateClause *Create(const ASTContext &C, SourceLocation StartLoc, |
1641 | SourceLocation LParenLoc, |
1642 | SourceLocation EndLoc, ArrayRef<Expr *> VL, |
1643 | ArrayRef<Expr *> PrivateVL); |
1644 | |
1645 | |
1646 | |
1647 | |
1648 | |
1649 | static OMPPrivateClause *CreateEmpty(const ASTContext &C, unsigned N); |
1650 | |
1651 | using private_copies_iterator = MutableArrayRef<Expr *>::iterator; |
1652 | using private_copies_const_iterator = ArrayRef<const Expr *>::iterator; |
1653 | using private_copies_range = llvm::iterator_range<private_copies_iterator>; |
1654 | using private_copies_const_range = |
1655 | llvm::iterator_range<private_copies_const_iterator>; |
1656 | |
1657 | private_copies_range private_copies() { |
1658 | return private_copies_range(getPrivateCopies().begin(), |
1659 | getPrivateCopies().end()); |
1660 | } |
1661 | |
1662 | private_copies_const_range private_copies() const { |
1663 | return private_copies_const_range(getPrivateCopies().begin(), |
1664 | getPrivateCopies().end()); |
1665 | } |
1666 | |
1667 | child_range children() { |
1668 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
1669 | reinterpret_cast<Stmt **>(varlist_end())); |
1670 | } |
1671 | |
1672 | static bool classof(const OMPClause *T) { |
1673 | return T->getClauseKind() == OMPC_private; |
1674 | } |
1675 | }; |
1676 | |
1677 | |
1678 | |
1679 | |
1680 | |
1681 | |
1682 | |
1683 | |
1684 | |
1685 | class OMPFirstprivateClause final |
1686 | : public OMPVarListClause<OMPFirstprivateClause>, |
1687 | public OMPClauseWithPreInit, |
1688 | private llvm::TrailingObjects<OMPFirstprivateClause, Expr *> { |
1689 | friend class OMPClauseReader; |
1690 | friend OMPVarListClause; |
1691 | friend TrailingObjects; |
1692 | |
1693 | |
1694 | |
1695 | |
1696 | |
1697 | |
1698 | |
1699 | OMPFirstprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
1700 | SourceLocation EndLoc, unsigned N) |
1701 | : OMPVarListClause<OMPFirstprivateClause>(OMPC_firstprivate, StartLoc, |
1702 | LParenLoc, EndLoc, N), |
1703 | OMPClauseWithPreInit(this) {} |
1704 | |
1705 | |
1706 | |
1707 | |
1708 | explicit OMPFirstprivateClause(unsigned N) |
1709 | : OMPVarListClause<OMPFirstprivateClause>( |
1710 | OMPC_firstprivate, SourceLocation(), SourceLocation(), |
1711 | SourceLocation(), N), |
1712 | OMPClauseWithPreInit(this) {} |
1713 | |
1714 | |
1715 | |
1716 | |
1717 | void setPrivateCopies(ArrayRef<Expr *> VL); |
1718 | |
1719 | |
1720 | |
1721 | MutableArrayRef<Expr *> getPrivateCopies() { |
1722 | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
1723 | } |
1724 | ArrayRef<const Expr *> getPrivateCopies() const { |
1725 | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
1726 | } |
1727 | |
1728 | |
1729 | |
1730 | |
1731 | void setInits(ArrayRef<Expr *> VL); |
1732 | |
1733 | |
1734 | |
1735 | MutableArrayRef<Expr *> getInits() { |
1736 | return MutableArrayRef<Expr *>(getPrivateCopies().end(), varlist_size()); |
1737 | } |
1738 | ArrayRef<const Expr *> getInits() const { |
1739 | return llvm::makeArrayRef(getPrivateCopies().end(), varlist_size()); |
1740 | } |
1741 | |
1742 | public: |
1743 | |
1744 | |
1745 | |
1746 | |
1747 | |
1748 | |
1749 | |
1750 | |
1751 | |
1752 | |
1753 | |
1754 | |
1755 | |
1756 | static OMPFirstprivateClause * |
1757 | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
1758 | SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> PrivateVL, |
1759 | ArrayRef<Expr *> InitVL, Stmt *PreInit); |
1760 | |
1761 | |
1762 | |
1763 | |
1764 | |
1765 | static OMPFirstprivateClause *CreateEmpty(const ASTContext &C, unsigned N); |
1766 | |
1767 | using private_copies_iterator = MutableArrayRef<Expr *>::iterator; |
1768 | using private_copies_const_iterator = ArrayRef<const Expr *>::iterator; |
1769 | using private_copies_range = llvm::iterator_range<private_copies_iterator>; |
1770 | using private_copies_const_range = |
1771 | llvm::iterator_range<private_copies_const_iterator>; |
1772 | |
1773 | private_copies_range private_copies() { |
1774 | return private_copies_range(getPrivateCopies().begin(), |
1775 | getPrivateCopies().end()); |
1776 | } |
1777 | private_copies_const_range private_copies() const { |
1778 | return private_copies_const_range(getPrivateCopies().begin(), |
1779 | getPrivateCopies().end()); |
1780 | } |
1781 | |
1782 | using inits_iterator = MutableArrayRef<Expr *>::iterator; |
1783 | using inits_const_iterator = ArrayRef<const Expr *>::iterator; |
1784 | using inits_range = llvm::iterator_range<inits_iterator>; |
1785 | using inits_const_range = llvm::iterator_range<inits_const_iterator>; |
1786 | |
1787 | inits_range inits() { |
1788 | return inits_range(getInits().begin(), getInits().end()); |
1789 | } |
1790 | inits_const_range inits() const { |
1791 | return inits_const_range(getInits().begin(), getInits().end()); |
1792 | } |
1793 | |
1794 | child_range children() { |
1795 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
1796 | reinterpret_cast<Stmt **>(varlist_end())); |
1797 | } |
1798 | |
1799 | static bool classof(const OMPClause *T) { |
1800 | return T->getClauseKind() == OMPC_firstprivate; |
1801 | } |
1802 | }; |
1803 | |
1804 | |
1805 | |
1806 | |
1807 | |
1808 | |
1809 | |
1810 | |
1811 | |
1812 | class OMPLastprivateClause final |
1813 | : public OMPVarListClause<OMPLastprivateClause>, |
1814 | public OMPClauseWithPostUpdate, |
1815 | private llvm::TrailingObjects<OMPLastprivateClause, Expr *> { |
1816 | |
1817 | |
1818 | |
1819 | |
1820 | |
1821 | |
1822 | |
1823 | |
1824 | |
1825 | |
1826 | |
1827 | |
1828 | |
1829 | |
1830 | |
1831 | |
1832 | friend class OMPClauseReader; |
1833 | friend OMPVarListClause; |
1834 | friend TrailingObjects; |
1835 | |
1836 | |
1837 | |
1838 | |
1839 | |
1840 | |
1841 | |
1842 | OMPLastprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
1843 | SourceLocation EndLoc, unsigned N) |
1844 | : OMPVarListClause<OMPLastprivateClause>(OMPC_lastprivate, StartLoc, |
1845 | LParenLoc, EndLoc, N), |
1846 | OMPClauseWithPostUpdate(this) {} |
1847 | |
1848 | |
1849 | |
1850 | |
1851 | explicit OMPLastprivateClause(unsigned N) |
1852 | : OMPVarListClause<OMPLastprivateClause>( |
1853 | OMPC_lastprivate, SourceLocation(), SourceLocation(), |
1854 | SourceLocation(), N), |
1855 | OMPClauseWithPostUpdate(this) {} |
1856 | |
1857 | |
1858 | |
1859 | MutableArrayRef<Expr *> getPrivateCopies() { |
1860 | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
1861 | } |
1862 | ArrayRef<const Expr *> getPrivateCopies() const { |
1863 | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
1864 | } |
1865 | |
1866 | |
1867 | |
1868 | |
1869 | |
1870 | void setSourceExprs(ArrayRef<Expr *> SrcExprs); |
1871 | |
1872 | |
1873 | MutableArrayRef<Expr *> getSourceExprs() { |
1874 | return MutableArrayRef<Expr *>(getPrivateCopies().end(), varlist_size()); |
1875 | } |
1876 | ArrayRef<const Expr *> getSourceExprs() const { |
1877 | return llvm::makeArrayRef(getPrivateCopies().end(), varlist_size()); |
1878 | } |
1879 | |
1880 | |
1881 | |
1882 | |
1883 | |
1884 | void setDestinationExprs(ArrayRef<Expr *> DstExprs); |
1885 | |
1886 | |
1887 | MutableArrayRef<Expr *> getDestinationExprs() { |
1888 | return MutableArrayRef<Expr *>(getSourceExprs().end(), varlist_size()); |
1889 | } |
1890 | ArrayRef<const Expr *> getDestinationExprs() const { |
1891 | return llvm::makeArrayRef(getSourceExprs().end(), varlist_size()); |
1892 | } |
1893 | |
1894 | |
1895 | |
1896 | |
1897 | void setAssignmentOps(ArrayRef<Expr *> AssignmentOps); |
1898 | |
1899 | |
1900 | MutableArrayRef<Expr *> getAssignmentOps() { |
1901 | return MutableArrayRef<Expr *>(getDestinationExprs().end(), varlist_size()); |
1902 | } |
1903 | ArrayRef<const Expr *> getAssignmentOps() const { |
1904 | return llvm::makeArrayRef(getDestinationExprs().end(), varlist_size()); |
1905 | } |
1906 | |
1907 | public: |
1908 | |
1909 | |
1910 | |
1911 | |
1912 | |
1913 | |
1914 | |
1915 | |
1916 | |
1917 | |
1918 | |
1919 | |
1920 | |
1921 | |
1922 | |
1923 | |
1924 | |
1925 | |
1926 | |
1927 | |
1928 | |
1929 | |
1930 | |
1931 | |
1932 | static OMPLastprivateClause * |
1933 | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
1934 | SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs, |
1935 | ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps, |
1936 | Stmt *PreInit, Expr *PostUpdate); |
1937 | |
1938 | |
1939 | |
1940 | |
1941 | |
1942 | static OMPLastprivateClause *CreateEmpty(const ASTContext &C, unsigned N); |
1943 | |
1944 | using helper_expr_iterator = MutableArrayRef<Expr *>::iterator; |
1945 | using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator; |
1946 | using helper_expr_range = llvm::iterator_range<helper_expr_iterator>; |
1947 | using helper_expr_const_range = |
1948 | llvm::iterator_range<helper_expr_const_iterator>; |
1949 | |
1950 | |
1951 | |
1952 | void setPrivateCopies(ArrayRef<Expr *> PrivateCopies); |
1953 | |
1954 | helper_expr_const_range private_copies() const { |
1955 | return helper_expr_const_range(getPrivateCopies().begin(), |
1956 | getPrivateCopies().end()); |
1957 | } |
1958 | |
1959 | helper_expr_range private_copies() { |
1960 | return helper_expr_range(getPrivateCopies().begin(), |
1961 | getPrivateCopies().end()); |
1962 | } |
1963 | |
1964 | helper_expr_const_range source_exprs() const { |
1965 | return helper_expr_const_range(getSourceExprs().begin(), |
1966 | getSourceExprs().end()); |
1967 | } |
1968 | |
1969 | helper_expr_range source_exprs() { |
1970 | return helper_expr_range(getSourceExprs().begin(), getSourceExprs().end()); |
1971 | } |
1972 | |
1973 | helper_expr_const_range destination_exprs() const { |
1974 | return helper_expr_const_range(getDestinationExprs().begin(), |
1975 | getDestinationExprs().end()); |
1976 | } |
1977 | |
1978 | helper_expr_range destination_exprs() { |
1979 | return helper_expr_range(getDestinationExprs().begin(), |
1980 | getDestinationExprs().end()); |
1981 | } |
1982 | |
1983 | helper_expr_const_range assignment_ops() const { |
1984 | return helper_expr_const_range(getAssignmentOps().begin(), |
1985 | getAssignmentOps().end()); |
1986 | } |
1987 | |
1988 | helper_expr_range assignment_ops() { |
1989 | return helper_expr_range(getAssignmentOps().begin(), |
1990 | getAssignmentOps().end()); |
1991 | } |
1992 | |
1993 | child_range children() { |
1994 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
1995 | reinterpret_cast<Stmt **>(varlist_end())); |
1996 | } |
1997 | |
1998 | static bool classof(const OMPClause *T) { |
1999 | return T->getClauseKind() == OMPC_lastprivate; |
2000 | } |
2001 | }; |
2002 | |
2003 | |
2004 | |
2005 | |
2006 | |
2007 | |
2008 | |
2009 | |
2010 | class OMPSharedClause final |
2011 | : public OMPVarListClause<OMPSharedClause>, |
2012 | private llvm::TrailingObjects<OMPSharedClause, Expr *> { |
2013 | friend OMPVarListClause; |
2014 | friend TrailingObjects; |
2015 | |
2016 | |
2017 | |
2018 | |
2019 | |
2020 | |
2021 | |
2022 | OMPSharedClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
2023 | SourceLocation EndLoc, unsigned N) |
2024 | : OMPVarListClause<OMPSharedClause>(OMPC_shared, StartLoc, LParenLoc, |
2025 | EndLoc, N) {} |
2026 | |
2027 | |
2028 | |
2029 | |
2030 | explicit OMPSharedClause(unsigned N) |
2031 | : OMPVarListClause<OMPSharedClause>(OMPC_shared, SourceLocation(), |
2032 | SourceLocation(), SourceLocation(), |
2033 | N) {} |
2034 | |
2035 | public: |
2036 | |
2037 | |
2038 | |
2039 | |
2040 | |
2041 | |
2042 | |
2043 | static OMPSharedClause *Create(const ASTContext &C, SourceLocation StartLoc, |
2044 | SourceLocation LParenLoc, |
2045 | SourceLocation EndLoc, ArrayRef<Expr *> VL); |
2046 | |
2047 | |
2048 | |
2049 | |
2050 | |
2051 | static OMPSharedClause *CreateEmpty(const ASTContext &C, unsigned N); |
2052 | |
2053 | child_range children() { |
2054 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
2055 | reinterpret_cast<Stmt **>(varlist_end())); |
2056 | } |
2057 | |
2058 | static bool classof(const OMPClause *T) { |
2059 | return T->getClauseKind() == OMPC_shared; |
2060 | } |
2061 | }; |
2062 | |
2063 | |
2064 | |
2065 | |
2066 | |
2067 | |
2068 | |
2069 | |
2070 | |
2071 | class OMPReductionClause final |
2072 | : public OMPVarListClause<OMPReductionClause>, |
2073 | public OMPClauseWithPostUpdate, |
2074 | private llvm::TrailingObjects<OMPReductionClause, Expr *> { |
2075 | friend class OMPClauseReader; |
2076 | friend OMPVarListClause; |
2077 | friend TrailingObjects; |
2078 | |
2079 | |
2080 | SourceLocation ColonLoc; |
2081 | |
2082 | |
2083 | NestedNameSpecifierLoc QualifierLoc; |
2084 | |
2085 | |
2086 | DeclarationNameInfo NameInfo; |
2087 | |
2088 | |
2089 | |
2090 | |
2091 | |
2092 | |
2093 | |
2094 | |
2095 | |
2096 | |
2097 | OMPReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
2098 | SourceLocation ColonLoc, SourceLocation EndLoc, unsigned N, |
2099 | NestedNameSpecifierLoc QualifierLoc, |
2100 | const DeclarationNameInfo &NameInfo) |
2101 | : OMPVarListClause<OMPReductionClause>(OMPC_reduction, StartLoc, |
2102 | LParenLoc, EndLoc, N), |
2103 | OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc), |
2104 | QualifierLoc(QualifierLoc), NameInfo(NameInfo) {} |
2105 | |
2106 | |
2107 | |
2108 | |
2109 | explicit OMPReductionClause(unsigned N) |
2110 | : OMPVarListClause<OMPReductionClause>(OMPC_reduction, SourceLocation(), |
2111 | SourceLocation(), SourceLocation(), |
2112 | N), |
2113 | OMPClauseWithPostUpdate(this) {} |
2114 | |
2115 | |
2116 | void setColonLoc(SourceLocation CL) { ColonLoc = CL; } |
2117 | |
2118 | |
2119 | void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; } |
2120 | |
2121 | |
2122 | void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; } |
2123 | |
2124 | |
2125 | |
2126 | |
2127 | void setPrivates(ArrayRef<Expr *> Privates); |
2128 | |
2129 | |
2130 | MutableArrayRef<Expr *> getPrivates() { |
2131 | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
2132 | } |
2133 | ArrayRef<const Expr *> getPrivates() const { |
2134 | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
2135 | } |
2136 | |
2137 | |
2138 | |
2139 | |
2140 | void setLHSExprs(ArrayRef<Expr *> LHSExprs); |
2141 | |
2142 | |
2143 | MutableArrayRef<Expr *> getLHSExprs() { |
2144 | return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size()); |
2145 | } |
2146 | ArrayRef<const Expr *> getLHSExprs() const { |
2147 | return llvm::makeArrayRef(getPrivates().end(), varlist_size()); |
2148 | } |
2149 | |
2150 | |
2151 | |
2152 | |
2153 | |
2154 | |
2155 | void setRHSExprs(ArrayRef<Expr *> RHSExprs); |
2156 | |
2157 | |
2158 | MutableArrayRef<Expr *> getRHSExprs() { |
2159 | return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size()); |
2160 | } |
2161 | ArrayRef<const Expr *> getRHSExprs() const { |
2162 | return llvm::makeArrayRef(getLHSExprs().end(), varlist_size()); |
2163 | } |
2164 | |
2165 | |
2166 | |
2167 | |
2168 | |
2169 | void setReductionOps(ArrayRef<Expr *> ReductionOps); |
2170 | |
2171 | |
2172 | MutableArrayRef<Expr *> getReductionOps() { |
2173 | return MutableArrayRef<Expr *>(getRHSExprs().end(), varlist_size()); |
2174 | } |
2175 | ArrayRef<const Expr *> getReductionOps() const { |
2176 | return llvm::makeArrayRef(getRHSExprs().end(), varlist_size()); |
2177 | } |
2178 | |
2179 | public: |
2180 | |
2181 | |
2182 | |
2183 | |
2184 | |
2185 | |
2186 | |
2187 | |
2188 | |
2189 | |
2190 | |
2191 | |
2192 | |
2193 | |
2194 | |
2195 | |
2196 | |
2197 | |
2198 | |
2199 | |
2200 | |
2201 | |
2202 | |
2203 | |
2204 | |
2205 | |
2206 | |
2207 | |
2208 | |
2209 | |
2210 | |
2211 | |
2212 | static OMPReductionClause * |
2213 | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
2214 | SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL, |
2215 | NestedNameSpecifierLoc QualifierLoc, |
2216 | const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates, |
2217 | ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs, |
2218 | ArrayRef<Expr *> ReductionOps, Stmt *PreInit, Expr *PostUpdate); |
2219 | |
2220 | |
2221 | |
2222 | |
2223 | |
2224 | static OMPReductionClause *CreateEmpty(const ASTContext &C, unsigned N); |
2225 | |
2226 | |
2227 | SourceLocation getColonLoc() const { return ColonLoc; } |
2228 | |
2229 | |
2230 | const DeclarationNameInfo &getNameInfo() const { return NameInfo; } |
2231 | |
2232 | |
2233 | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
2234 | |
2235 | using helper_expr_iterator = MutableArrayRef<Expr *>::iterator; |
2236 | using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator; |
2237 | using helper_expr_range = llvm::iterator_range<helper_expr_iterator>; |
2238 | using helper_expr_const_range = |
2239 | llvm::iterator_range<helper_expr_const_iterator>; |
2240 | |
2241 | helper_expr_const_range privates() const { |
2242 | return helper_expr_const_range(getPrivates().begin(), getPrivates().end()); |
2243 | } |
2244 | |
2245 | helper_expr_range privates() { |
2246 | return helper_expr_range(getPrivates().begin(), getPrivates().end()); |
2247 | } |
2248 | |
2249 | helper_expr_const_range lhs_exprs() const { |
2250 | return helper_expr_const_range(getLHSExprs().begin(), getLHSExprs().end()); |
2251 | } |
2252 | |
2253 | helper_expr_range lhs_exprs() { |
2254 | return helper_expr_range(getLHSExprs().begin(), getLHSExprs().end()); |
2255 | } |
2256 | |
2257 | helper_expr_const_range rhs_exprs() const { |
2258 | return helper_expr_const_range(getRHSExprs().begin(), getRHSExprs().end()); |
2259 | } |
2260 | |
2261 | helper_expr_range rhs_exprs() { |
2262 | return helper_expr_range(getRHSExprs().begin(), getRHSExprs().end()); |
2263 | } |
2264 | |
2265 | helper_expr_const_range reduction_ops() const { |
2266 | return helper_expr_const_range(getReductionOps().begin(), |
2267 | getReductionOps().end()); |
2268 | } |
2269 | |
2270 | helper_expr_range reduction_ops() { |
2271 | return helper_expr_range(getReductionOps().begin(), |
2272 | getReductionOps().end()); |
2273 | } |
2274 | |
2275 | child_range children() { |
2276 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
2277 | reinterpret_cast<Stmt **>(varlist_end())); |
2278 | } |
2279 | |
2280 | static bool classof(const OMPClause *T) { |
2281 | return T->getClauseKind() == OMPC_reduction; |
2282 | } |
2283 | }; |
2284 | |
2285 | |
2286 | |
2287 | |
2288 | |
2289 | |
2290 | |
2291 | |
2292 | |
2293 | class OMPTaskReductionClause final |
2294 | : public OMPVarListClause<OMPTaskReductionClause>, |
2295 | public OMPClauseWithPostUpdate, |
2296 | private llvm::TrailingObjects<OMPTaskReductionClause, Expr *> { |
2297 | friend class OMPClauseReader; |
2298 | friend OMPVarListClause; |
2299 | friend TrailingObjects; |
2300 | |
2301 | |
2302 | SourceLocation ColonLoc; |
2303 | |
2304 | |
2305 | NestedNameSpecifierLoc QualifierLoc; |
2306 | |
2307 | |
2308 | DeclarationNameInfo NameInfo; |
2309 | |
2310 | |
2311 | |
2312 | |
2313 | |
2314 | |
2315 | |
2316 | |
2317 | |
2318 | |
2319 | OMPTaskReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
2320 | SourceLocation ColonLoc, SourceLocation EndLoc, |
2321 | unsigned N, NestedNameSpecifierLoc QualifierLoc, |
2322 | const DeclarationNameInfo &NameInfo) |
2323 | : OMPVarListClause<OMPTaskReductionClause>(OMPC_task_reduction, StartLoc, |
2324 | LParenLoc, EndLoc, N), |
2325 | OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc), |
2326 | QualifierLoc(QualifierLoc), NameInfo(NameInfo) {} |
2327 | |
2328 | |
2329 | |
2330 | |
2331 | explicit OMPTaskReductionClause(unsigned N) |
2332 | : OMPVarListClause<OMPTaskReductionClause>( |
2333 | OMPC_task_reduction, SourceLocation(), SourceLocation(), |
2334 | SourceLocation(), N), |
2335 | OMPClauseWithPostUpdate(this) {} |
2336 | |
2337 | |
2338 | void setColonLoc(SourceLocation CL) { ColonLoc = CL; } |
2339 | |
2340 | |
2341 | void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; } |
2342 | |
2343 | |
2344 | void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; } |
2345 | |
2346 | |
2347 | |
2348 | void setPrivates(ArrayRef<Expr *> Privates); |
2349 | |
2350 | |
2351 | MutableArrayRef<Expr *> getPrivates() { |
2352 | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
2353 | } |
2354 | ArrayRef<const Expr *> getPrivates() const { |
2355 | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
2356 | } |
2357 | |
2358 | |
2359 | |
2360 | |
2361 | void setLHSExprs(ArrayRef<Expr *> LHSExprs); |
2362 | |
2363 | |
2364 | MutableArrayRef<Expr *> getLHSExprs() { |
2365 | return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size()); |
2366 | } |
2367 | ArrayRef<const Expr *> getLHSExprs() const { |
2368 | return llvm::makeArrayRef(getPrivates().end(), varlist_size()); |
2369 | } |
2370 | |
2371 | |
2372 | |
2373 | |
2374 | |
2375 | void setRHSExprs(ArrayRef<Expr *> RHSExprs); |
2376 | |
2377 | |
2378 | MutableArrayRef<Expr *> getRHSExprs() { |
2379 | return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size()); |
2380 | } |
2381 | ArrayRef<const Expr *> getRHSExprs() const { |
2382 | return llvm::makeArrayRef(getLHSExprs().end(), varlist_size()); |
2383 | } |
2384 | |
2385 | |
2386 | |
2387 | |
2388 | |
2389 | void setReductionOps(ArrayRef<Expr *> ReductionOps); |
2390 | |
2391 | |
2392 | MutableArrayRef<Expr *> getReductionOps() { |
2393 | return MutableArrayRef<Expr *>(getRHSExprs().end(), varlist_size()); |
2394 | } |
2395 | ArrayRef<const Expr *> getReductionOps() const { |
2396 | return llvm::makeArrayRef(getRHSExprs().end(), varlist_size()); |
2397 | } |
2398 | |
2399 | public: |
2400 | |
2401 | |
2402 | |
2403 | |
2404 | |
2405 | |
2406 | |
2407 | |
2408 | |
2409 | |
2410 | |
2411 | |
2412 | |
2413 | |
2414 | |
2415 | |
2416 | |
2417 | |
2418 | |
2419 | |
2420 | |
2421 | |
2422 | |
2423 | |
2424 | |
2425 | |
2426 | |
2427 | |
2428 | |
2429 | |
2430 | |
2431 | |
2432 | static OMPTaskReductionClause * |
2433 | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
2434 | SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL, |
2435 | NestedNameSpecifierLoc QualifierLoc, |
2436 | const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates, |
2437 | ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs, |
2438 | ArrayRef<Expr *> ReductionOps, Stmt *PreInit, Expr *PostUpdate); |
2439 | |
2440 | |
2441 | |
2442 | |
2443 | |
2444 | static OMPTaskReductionClause *CreateEmpty(const ASTContext &C, unsigned N); |
2445 | |
2446 | |
2447 | SourceLocation getColonLoc() const { return ColonLoc; } |
2448 | |
2449 | |
2450 | const DeclarationNameInfo &getNameInfo() const { return NameInfo; } |
2451 | |
2452 | |
2453 | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
2454 | |
2455 | using helper_expr_iterator = MutableArrayRef<Expr *>::iterator; |
2456 | using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator; |
2457 | using helper_expr_range = llvm::iterator_range<helper_expr_iterator>; |
2458 | using helper_expr_const_range = |
2459 | llvm::iterator_range<helper_expr_const_iterator>; |
2460 | |
2461 | helper_expr_const_range privates() const { |
2462 | return helper_expr_const_range(getPrivates().begin(), getPrivates().end()); |
2463 | } |
2464 | |
2465 | helper_expr_range privates() { |
2466 | return helper_expr_range(getPrivates().begin(), getPrivates().end()); |
2467 | } |
2468 | |
2469 | helper_expr_const_range lhs_exprs() const { |
2470 | return helper_expr_const_range(getLHSExprs().begin(), getLHSExprs().end()); |
2471 | } |
2472 | |
2473 | helper_expr_range lhs_exprs() { |
2474 | return helper_expr_range(getLHSExprs().begin(), getLHSExprs().end()); |
2475 | } |
2476 | |
2477 | helper_expr_const_range rhs_exprs() const { |
2478 | return helper_expr_const_range(getRHSExprs().begin(), getRHSExprs().end()); |
2479 | } |
2480 | |
2481 | helper_expr_range rhs_exprs() { |
2482 | return helper_expr_range(getRHSExprs().begin(), getRHSExprs().end()); |
2483 | } |
2484 | |
2485 | helper_expr_const_range reduction_ops() const { |
2486 | return helper_expr_const_range(getReductionOps().begin(), |
2487 | getReductionOps().end()); |
2488 | } |
2489 | |
2490 | helper_expr_range reduction_ops() { |
2491 | return helper_expr_range(getReductionOps().begin(), |
2492 | getReductionOps().end()); |
2493 | } |
2494 | |
2495 | child_range children() { |
2496 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
2497 | reinterpret_cast<Stmt **>(varlist_end())); |
2498 | } |
2499 | |
2500 | static bool classof(const OMPClause *T) { |
2501 | return T->getClauseKind() == OMPC_task_reduction; |
2502 | } |
2503 | }; |
2504 | |
2505 | |
2506 | |
2507 | |
2508 | |
2509 | |
2510 | |
2511 | |
2512 | class OMPInReductionClause final |
2513 | : public OMPVarListClause<OMPInReductionClause>, |
2514 | public OMPClauseWithPostUpdate, |
2515 | private llvm::TrailingObjects<OMPInReductionClause, Expr *> { |
2516 | friend class OMPClauseReader; |
2517 | friend OMPVarListClause; |
2518 | friend TrailingObjects; |
2519 | |
2520 | |
2521 | SourceLocation ColonLoc; |
2522 | |
2523 | |
2524 | NestedNameSpecifierLoc QualifierLoc; |
2525 | |
2526 | |
2527 | DeclarationNameInfo NameInfo; |
2528 | |
2529 | |
2530 | |
2531 | |
2532 | |
2533 | |
2534 | |
2535 | |
2536 | |
2537 | |
2538 | OMPInReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
2539 | SourceLocation ColonLoc, SourceLocation EndLoc, |
2540 | unsigned N, NestedNameSpecifierLoc QualifierLoc, |
2541 | const DeclarationNameInfo &NameInfo) |
2542 | : OMPVarListClause<OMPInReductionClause>(OMPC_in_reduction, StartLoc, |
2543 | LParenLoc, EndLoc, N), |
2544 | OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc), |
2545 | QualifierLoc(QualifierLoc), NameInfo(NameInfo) {} |
2546 | |
2547 | |
2548 | |
2549 | |
2550 | explicit OMPInReductionClause(unsigned N) |
2551 | : OMPVarListClause<OMPInReductionClause>( |
2552 | OMPC_in_reduction, SourceLocation(), SourceLocation(), |
2553 | SourceLocation(), N), |
2554 | OMPClauseWithPostUpdate(this) {} |
2555 | |
2556 | |
2557 | void setColonLoc(SourceLocation CL) { ColonLoc = CL; } |
2558 | |
2559 | |
2560 | void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; } |
2561 | |
2562 | |
2563 | void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; } |
2564 | |
2565 | |
2566 | |
2567 | void setPrivates(ArrayRef<Expr *> Privates); |
2568 | |
2569 | |
2570 | MutableArrayRef<Expr *> getPrivates() { |
2571 | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
2572 | } |
2573 | ArrayRef<const Expr *> getPrivates() const { |
2574 | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
2575 | } |
2576 | |
2577 | |
2578 | |
2579 | |
2580 | void setLHSExprs(ArrayRef<Expr *> LHSExprs); |
2581 | |
2582 | |
2583 | MutableArrayRef<Expr *> getLHSExprs() { |
2584 | return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size()); |
2585 | } |
2586 | ArrayRef<const Expr *> getLHSExprs() const { |
2587 | return llvm::makeArrayRef(getPrivates().end(), varlist_size()); |
2588 | } |
2589 | |
2590 | |
2591 | |
2592 | |
2593 | |
2594 | void setRHSExprs(ArrayRef<Expr *> RHSExprs); |
2595 | |
2596 | |
2597 | MutableArrayRef<Expr *> getRHSExprs() { |
2598 | return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size()); |
2599 | } |
2600 | ArrayRef<const Expr *> getRHSExprs() const { |
2601 | return llvm::makeArrayRef(getLHSExprs().end(), varlist_size()); |
2602 | } |
2603 | |
2604 | |
2605 | |
2606 | |
2607 | |
2608 | void setReductionOps(ArrayRef<Expr *> ReductionOps); |
2609 | |
2610 | |
2611 | MutableArrayRef<Expr *> getReductionOps() { |
2612 | return MutableArrayRef<Expr *>(getRHSExprs().end(), varlist_size()); |
2613 | } |
2614 | ArrayRef<const Expr *> getReductionOps() const { |
2615 | return llvm::makeArrayRef(getRHSExprs().end(), varlist_size()); |
2616 | } |
2617 | |
2618 | |
2619 | void setTaskgroupDescriptors(ArrayRef<Expr *> ReductionOps); |
2620 | |
2621 | |
2622 | MutableArrayRef<Expr *> getTaskgroupDescriptors() { |
2623 | return MutableArrayRef<Expr *>(getReductionOps().end(), varlist_size()); |
2624 | } |
2625 | ArrayRef<const Expr *> getTaskgroupDescriptors() const { |
2626 | return llvm::makeArrayRef(getReductionOps().end(), varlist_size()); |
2627 | } |
2628 | |
2629 | public: |
2630 | |
2631 | |
2632 | |
2633 | |
2634 | |
2635 | |
2636 | |
2637 | |
2638 | |
2639 | |
2640 | |
2641 | |
2642 | |
2643 | |
2644 | |
2645 | |
2646 | |
2647 | |
2648 | |
2649 | |
2650 | |
2651 | |
2652 | |
2653 | |
2654 | |
2655 | |
2656 | |
2657 | |
2658 | |
2659 | |
2660 | |
2661 | |
2662 | |
2663 | |
2664 | static OMPInReductionClause * |
2665 | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
2666 | SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL, |
2667 | NestedNameSpecifierLoc QualifierLoc, |
2668 | const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates, |
2669 | ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs, |
2670 | ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> TaskgroupDescriptors, |
2671 | Stmt *PreInit, Expr *PostUpdate); |
2672 | |
2673 | |
2674 | |
2675 | |
2676 | |
2677 | static OMPInReductionClause *CreateEmpty(const ASTContext &C, unsigned N); |
2678 | |
2679 | |
2680 | SourceLocation getColonLoc() const { return ColonLoc; } |
2681 | |
2682 | |
2683 | const DeclarationNameInfo &getNameInfo() const { return NameInfo; } |
2684 | |
2685 | |
2686 | NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; } |
2687 | |
2688 | using helper_expr_iterator = MutableArrayRef<Expr *>::iterator; |
2689 | using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator; |
2690 | using helper_expr_range = llvm::iterator_range<helper_expr_iterator>; |
2691 | using helper_expr_const_range = |
2692 | llvm::iterator_range<helper_expr_const_iterator>; |
2693 | |
2694 | helper_expr_const_range privates() const { |
2695 | return helper_expr_const_range(getPrivates().begin(), getPrivates().end()); |
2696 | } |
2697 | |
2698 | helper_expr_range privates() { |
2699 | return helper_expr_range(getPrivates().begin(), getPrivates().end()); |
2700 | } |
2701 | |
2702 | helper_expr_const_range lhs_exprs() const { |
2703 | return helper_expr_const_range(getLHSExprs().begin(), getLHSExprs().end()); |
2704 | } |
2705 | |
2706 | helper_expr_range lhs_exprs() { |
2707 | return helper_expr_range(getLHSExprs().begin(), getLHSExprs().end()); |
2708 | } |
2709 | |
2710 | helper_expr_const_range rhs_exprs() const { |
2711 | return helper_expr_const_range(getRHSExprs().begin(), getRHSExprs().end()); |
2712 | } |
2713 | |
2714 | helper_expr_range rhs_exprs() { |
2715 | return helper_expr_range(getRHSExprs().begin(), getRHSExprs().end()); |
2716 | } |
2717 | |
2718 | helper_expr_const_range reduction_ops() const { |
2719 | return helper_expr_const_range(getReductionOps().begin(), |
2720 | getReductionOps().end()); |
2721 | } |
2722 | |
2723 | helper_expr_range reduction_ops() { |
2724 | return helper_expr_range(getReductionOps().begin(), |
2725 | getReductionOps().end()); |
2726 | } |
2727 | |
2728 | helper_expr_const_range taskgroup_descriptors() const { |
2729 | return helper_expr_const_range(getTaskgroupDescriptors().begin(), |
2730 | getTaskgroupDescriptors().end()); |
2731 | } |
2732 | |
2733 | helper_expr_range taskgroup_descriptors() { |
2734 | return helper_expr_range(getTaskgroupDescriptors().begin(), |
2735 | getTaskgroupDescriptors().end()); |
2736 | } |
2737 | |
2738 | child_range children() { |
2739 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
2740 | reinterpret_cast<Stmt **>(varlist_end())); |
2741 | } |
2742 | |
2743 | static bool classof(const OMPClause *T) { |
2744 | return T->getClauseKind() == OMPC_in_reduction; |
2745 | } |
2746 | }; |
2747 | |
2748 | |
2749 | |
2750 | |
2751 | |
2752 | |
2753 | |
2754 | |
2755 | |
2756 | class OMPLinearClause final |
2757 | : public OMPVarListClause<OMPLinearClause>, |
2758 | public OMPClauseWithPostUpdate, |
2759 | private llvm::TrailingObjects<OMPLinearClause, Expr *> { |
2760 | friend class OMPClauseReader; |
2761 | friend OMPVarListClause; |
2762 | friend TrailingObjects; |
2763 | |
2764 | |
2765 | OpenMPLinearClauseKind Modifier = OMPC_LINEAR_val; |
2766 | |
2767 | |
2768 | SourceLocation ModifierLoc; |
2769 | |
2770 | |
2771 | SourceLocation ColonLoc; |
2772 | |
2773 | |
2774 | void setStep(Expr *Step) { *(getFinals().end()) = Step; } |
2775 | |
2776 | |
2777 | void setCalcStep(Expr *CalcStep) { *(getFinals().end() + 1) = CalcStep; } |
2778 | |
2779 | |
2780 | |
2781 | |
2782 | |
2783 | |
2784 | |
2785 | |
2786 | OMPLinearClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
2787 | OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, |
2788 | SourceLocation ColonLoc, SourceLocation EndLoc, |
2789 | unsigned NumVars) |
2790 | : OMPVarListClause<OMPLinearClause>(OMPC_linear, StartLoc, LParenLoc, |
2791 | EndLoc, NumVars), |
2792 | OMPClauseWithPostUpdate(this), Modifier(Modifier), |
2793 | ModifierLoc(ModifierLoc), ColonLoc(ColonLoc) {} |
2794 | |
2795 | |
2796 | |
2797 | |
2798 | explicit OMPLinearClause(unsigned NumVars) |
2799 | : OMPVarListClause<OMPLinearClause>(OMPC_linear, SourceLocation(), |
2800 | SourceLocation(), SourceLocation(), |
2801 | NumVars), |
2802 | OMPClauseWithPostUpdate(this) {} |
2803 | |
2804 | |
2805 | |
2806 | |
2807 | |
2808 | |
2809 | |
2810 | |
2811 | |
2812 | |
2813 | |
2814 | |
2815 | |
2816 | MutableArrayRef<Expr *> getPrivates() { |
2817 | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
2818 | } |
2819 | ArrayRef<const Expr *> getPrivates() const { |
2820 | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
2821 | } |
2822 | |
2823 | MutableArrayRef<Expr *> getInits() { |
2824 | return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size()); |
2825 | } |
2826 | ArrayRef<const Expr *> getInits() const { |
2827 | return llvm::makeArrayRef(getPrivates().end(), varlist_size()); |
2828 | } |
2829 | |
2830 | |
2831 | MutableArrayRef<Expr *> getUpdates() { |
2832 | return MutableArrayRef<Expr *>(getInits().end(), varlist_size()); |
2833 | } |
2834 | ArrayRef<const Expr *> getUpdates() const { |
2835 | return llvm::makeArrayRef(getInits().end(), varlist_size()); |
2836 | } |
2837 | |
2838 | |
2839 | MutableArrayRef<Expr *> getFinals() { |
2840 | return MutableArrayRef<Expr *>(getUpdates().end(), varlist_size()); |
2841 | } |
2842 | ArrayRef<const Expr *> getFinals() const { |
2843 | return llvm::makeArrayRef(getUpdates().end(), varlist_size()); |
2844 | } |
2845 | |
2846 | |
2847 | |
2848 | void setPrivates(ArrayRef<Expr *> PL); |
2849 | |
2850 | |
2851 | |
2852 | void setInits(ArrayRef<Expr *> IL); |
2853 | |
2854 | public: |
2855 | |
2856 | |
2857 | |
2858 | |
2859 | |
2860 | |
2861 | |
2862 | |
2863 | |
2864 | |
2865 | |
2866 | |
2867 | |
2868 | |
2869 | |
2870 | |
2871 | |
2872 | |
2873 | |
2874 | static OMPLinearClause * |
2875 | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
2876 | OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, |
2877 | SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL, |
2878 | ArrayRef<Expr *> PL, ArrayRef<Expr *> IL, Expr *Step, Expr *CalcStep, |
2879 | Stmt *PreInit, Expr *PostUpdate); |
2880 | |
2881 | |
2882 | |
2883 | |
2884 | |
2885 | static OMPLinearClause *CreateEmpty(const ASTContext &C, unsigned NumVars); |
2886 | |
2887 | |
2888 | void setModifier(OpenMPLinearClauseKind Kind) { Modifier = Kind; } |
2889 | |
2890 | |
2891 | OpenMPLinearClauseKind getModifier() const { return Modifier; } |
2892 | |
2893 | |
2894 | void setModifierLoc(SourceLocation Loc) { ModifierLoc = Loc; } |
2895 | |
2896 | |
2897 | SourceLocation getModifierLoc() const { return ModifierLoc; } |
2898 | |
2899 | |
2900 | void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; } |
2901 | |
2902 | |
2903 | SourceLocation getColonLoc() const { return ColonLoc; } |
2904 | |
2905 | |
2906 | Expr *getStep() { return *(getFinals().end()); } |
2907 | |
2908 | |
2909 | const Expr *getStep() const { return *(getFinals().end()); } |
2910 | |
2911 | |
2912 | Expr *getCalcStep() { return *(getFinals().end() + 1); } |
2913 | |
2914 | |
2915 | const Expr *getCalcStep() const { return *(getFinals().end() + 1); } |
2916 | |
2917 | |
2918 | |
2919 | void setUpdates(ArrayRef<Expr *> UL); |
2920 | |
2921 | |
2922 | |
2923 | void setFinals(ArrayRef<Expr *> FL); |
2924 | |
2925 | using privates_iterator = MutableArrayRef<Expr *>::iterator; |
2926 | using privates_const_iterator = ArrayRef<const Expr *>::iterator; |
2927 | using privates_range = llvm::iterator_range<privates_iterator>; |
2928 | using privates_const_range = llvm::iterator_range<privates_const_iterator>; |
2929 | |
2930 | privates_range privates() { |
2931 | return privates_range(getPrivates().begin(), getPrivates().end()); |
2932 | } |
2933 | |
2934 | privates_const_range privates() const { |
2935 | return privates_const_range(getPrivates().begin(), getPrivates().end()); |
2936 | } |
2937 | |
2938 | using inits_iterator = MutableArrayRef<Expr *>::iterator; |
2939 | using inits_const_iterator = ArrayRef<const Expr *>::iterator; |
2940 | using inits_range = llvm::iterator_range<inits_iterator>; |
2941 | using inits_const_range = llvm::iterator_range<inits_const_iterator>; |
2942 | |
2943 | inits_range inits() { |
2944 | return inits_range(getInits().begin(), getInits().end()); |
2945 | } |
2946 | |
2947 | inits_const_range inits() const { |
2948 | return inits_const_range(getInits().begin(), getInits().end()); |
2949 | } |
2950 | |
2951 | using updates_iterator = MutableArrayRef<Expr *>::iterator; |
2952 | using updates_const_iterator = ArrayRef<const Expr *>::iterator; |
2953 | using updates_range = llvm::iterator_range<updates_iterator>; |
2954 | using updates_const_range = llvm::iterator_range<updates_const_iterator>; |
2955 | |
2956 | updates_range updates() { |
2957 | return updates_range(getUpdates().begin(), getUpdates().end()); |
2958 | } |
2959 | |
2960 | updates_const_range updates() const { |
2961 | return updates_const_range(getUpdates().begin(), getUpdates().end()); |
2962 | } |
2963 | |
2964 | using finals_iterator = MutableArrayRef<Expr *>::iterator; |
2965 | using finals_const_iterator = ArrayRef<const Expr *>::iterator; |
2966 | using finals_range = llvm::iterator_range<finals_iterator>; |
2967 | using finals_const_range = llvm::iterator_range<finals_const_iterator>; |
2968 | |
2969 | finals_range finals() { |
2970 | return finals_range(getFinals().begin(), getFinals().end()); |
2971 | } |
2972 | |
2973 | finals_const_range finals() const { |
2974 | return finals_const_range(getFinals().begin(), getFinals().end()); |
2975 | } |
2976 | |
2977 | child_range children() { |
2978 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
2979 | reinterpret_cast<Stmt **>(varlist_end())); |
2980 | } |
2981 | |
2982 | static bool classof(const OMPClause *T) { |
2983 | return T->getClauseKind() == OMPC_linear; |
2984 | } |
2985 | }; |
2986 | |
2987 | |
2988 | |
2989 | |
2990 | |
2991 | |
2992 | |
2993 | |
2994 | |
2995 | class OMPAlignedClause final |
2996 | : public OMPVarListClause<OMPAlignedClause>, |
2997 | private llvm::TrailingObjects<OMPAlignedClause, Expr *> { |
2998 | friend class OMPClauseReader; |
2999 | friend OMPVarListClause; |
3000 | friend TrailingObjects; |
3001 | |
3002 | |
3003 | SourceLocation ColonLoc; |
3004 | |
3005 | |
3006 | void setAlignment(Expr *A) { *varlist_end() = A; } |
3007 | |
3008 | |
3009 | |
3010 | |
3011 | |
3012 | |
3013 | |
3014 | |
3015 | OMPAlignedClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
3016 | SourceLocation ColonLoc, SourceLocation EndLoc, |
3017 | unsigned NumVars) |
3018 | : OMPVarListClause<OMPAlignedClause>(OMPC_aligned, StartLoc, LParenLoc, |
3019 | EndLoc, NumVars), |
3020 | ColonLoc(ColonLoc) {} |
3021 | |
3022 | |
3023 | |
3024 | |
3025 | explicit OMPAlignedClause(unsigned NumVars) |
3026 | : OMPVarListClause<OMPAlignedClause>(OMPC_aligned, SourceLocation(), |
3027 | SourceLocation(), SourceLocation(), |
3028 | NumVars) {} |
3029 | |
3030 | public: |
3031 | |
3032 | |
3033 | |
3034 | |
3035 | |
3036 | |
3037 | |
3038 | |
3039 | |
3040 | static OMPAlignedClause *Create(const ASTContext &C, SourceLocation StartLoc, |
3041 | SourceLocation LParenLoc, |
3042 | SourceLocation ColonLoc, |
3043 | SourceLocation EndLoc, ArrayRef<Expr *> VL, |
3044 | Expr *A); |
3045 | |
3046 | |
3047 | |
3048 | |
3049 | |
3050 | static OMPAlignedClause *CreateEmpty(const ASTContext &C, unsigned NumVars); |
3051 | |
3052 | |
3053 | void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; } |
3054 | |
3055 | |
3056 | SourceLocation getColonLoc() const { return ColonLoc; } |
3057 | |
3058 | |
3059 | Expr *getAlignment() { return *varlist_end(); } |
3060 | |
3061 | |
3062 | const Expr *getAlignment() const { return *varlist_end(); } |
3063 | |
3064 | child_range children() { |
3065 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
3066 | reinterpret_cast<Stmt **>(varlist_end())); |
3067 | } |
3068 | |
3069 | static bool classof(const OMPClause *T) { |
3070 | return T->getClauseKind() == OMPC_aligned; |
3071 | } |
3072 | }; |
3073 | |
3074 | |
3075 | |
3076 | |
3077 | |
3078 | |
3079 | |
3080 | |
3081 | class OMPCopyinClause final |
3082 | : public OMPVarListClause<OMPCopyinClause>, |
3083 | private llvm::TrailingObjects<OMPCopyinClause, Expr *> { |
3084 | |
3085 | |
3086 | |
3087 | |
3088 | |
3089 | |
3090 | |
3091 | |
3092 | |
3093 | |
3094 | |
3095 | |
3096 | |
3097 | friend class OMPClauseReader; |
3098 | friend OMPVarListClause; |
3099 | friend TrailingObjects; |
3100 | |
3101 | |
3102 | |
3103 | |
3104 | |
3105 | |
3106 | |
3107 | OMPCopyinClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
3108 | SourceLocation EndLoc, unsigned N) |
3109 | : OMPVarListClause<OMPCopyinClause>(OMPC_copyin, StartLoc, LParenLoc, |
3110 | EndLoc, N) {} |
3111 | |
3112 | |
3113 | |
3114 | |
3115 | explicit OMPCopyinClause(unsigned N) |
3116 | : OMPVarListClause<OMPCopyinClause>(OMPC_copyin, SourceLocation(), |
3117 | SourceLocation(), SourceLocation(), |
3118 | N) {} |
3119 | |
3120 | |
3121 | |
3122 | |
3123 | void setSourceExprs(ArrayRef<Expr *> SrcExprs); |
3124 | |
3125 | |
3126 | MutableArrayRef<Expr *> getSourceExprs() { |
3127 | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
3128 | } |
3129 | ArrayRef<const Expr *> getSourceExprs() const { |
3130 | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
3131 | } |
3132 | |
3133 | |
3134 | |
3135 | |
3136 | void setDestinationExprs(ArrayRef<Expr *> DstExprs); |
3137 | |
3138 | |
3139 | MutableArrayRef<Expr *> getDestinationExprs() { |
3140 | return MutableArrayRef<Expr *>(getSourceExprs().end(), varlist_size()); |
3141 | } |
3142 | ArrayRef<const Expr *> getDestinationExprs() const { |
3143 | return llvm::makeArrayRef(getSourceExprs().end(), varlist_size()); |
3144 | } |
3145 | |
3146 | |
3147 | |
3148 | |
3149 | |
3150 | void setAssignmentOps(ArrayRef<Expr *> AssignmentOps); |
3151 | |
3152 | |
3153 | MutableArrayRef<Expr *> getAssignmentOps() { |
3154 | return MutableArrayRef<Expr *>(getDestinationExprs().end(), varlist_size()); |
3155 | } |
3156 | ArrayRef<const Expr *> getAssignmentOps() const { |
3157 | return llvm::makeArrayRef(getDestinationExprs().end(), varlist_size()); |
3158 | } |
3159 | |
3160 | public: |
3161 | |
3162 | |
3163 | |
3164 | |
3165 | |
3166 | |
3167 | |
3168 | |
3169 | |
3170 | |
3171 | |
3172 | |
3173 | |
3174 | |
3175 | |
3176 | |
3177 | |
3178 | |
3179 | |
3180 | |
3181 | |
3182 | static OMPCopyinClause * |
3183 | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
3184 | SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs, |
3185 | ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps); |
3186 | |
3187 | |
3188 | |
3189 | |
3190 | |
3191 | static OMPCopyinClause *CreateEmpty(const ASTContext &C, unsigned N); |
3192 | |
3193 | using helper_expr_iterator = MutableArrayRef<Expr *>::iterator; |
3194 | using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator; |
3195 | using helper_expr_range = llvm::iterator_range<helper_expr_iterator>; |
3196 | using helper_expr_const_range = |
3197 | llvm::iterator_range<helper_expr_const_iterator>; |
3198 | |
3199 | helper_expr_const_range source_exprs() const { |
3200 | return helper_expr_const_range(getSourceExprs().begin(), |
3201 | getSourceExprs().end()); |
3202 | } |
3203 | |
3204 | helper_expr_range source_exprs() { |
3205 | return helper_expr_range(getSourceExprs().begin(), getSourceExprs().end()); |
3206 | } |
3207 | |
3208 | helper_expr_const_range destination_exprs() const { |
3209 | return helper_expr_const_range(getDestinationExprs().begin(), |
3210 | getDestinationExprs().end()); |
3211 | } |
3212 | |
3213 | helper_expr_range destination_exprs() { |
3214 | return helper_expr_range(getDestinationExprs().begin(), |
3215 | getDestinationExprs().end()); |
3216 | } |
3217 | |
3218 | helper_expr_const_range assignment_ops() const { |
3219 | return helper_expr_const_range(getAssignmentOps().begin(), |
3220 | getAssignmentOps().end()); |
3221 | } |
3222 | |
3223 | helper_expr_range assignment_ops() { |
3224 | return helper_expr_range(getAssignmentOps().begin(), |
3225 | getAssignmentOps().end()); |
3226 | } |
3227 | |
3228 | child_range children() { |
3229 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
3230 | reinterpret_cast<Stmt **>(varlist_end())); |
3231 | } |
3232 | |
3233 | static bool classof(const OMPClause *T) { |
3234 | return T->getClauseKind() == OMPC_copyin; |
3235 | } |
3236 | }; |
3237 | |
3238 | |
3239 | |
3240 | |
3241 | |
3242 | |
3243 | |
3244 | |
3245 | |
3246 | class OMPCopyprivateClause final |
3247 | : public OMPVarListClause<OMPCopyprivateClause>, |
3248 | private llvm::TrailingObjects<OMPCopyprivateClause, Expr *> { |
3249 | friend class OMPClauseReader; |
3250 | friend OMPVarListClause; |
3251 | friend TrailingObjects; |
3252 | |
3253 | |
3254 | |
3255 | |
3256 | |
3257 | |
3258 | |
3259 | OMPCopyprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
3260 | SourceLocation EndLoc, unsigned N) |
3261 | : OMPVarListClause<OMPCopyprivateClause>(OMPC_copyprivate, StartLoc, |
3262 | LParenLoc, EndLoc, N) {} |
3263 | |
3264 | |
3265 | |
3266 | |
3267 | explicit OMPCopyprivateClause(unsigned N) |
3268 | : OMPVarListClause<OMPCopyprivateClause>( |
3269 | OMPC_copyprivate, SourceLocation(), SourceLocation(), |
3270 | SourceLocation(), N) {} |
3271 | |
3272 | |
3273 | |
3274 | |
3275 | void setSourceExprs(ArrayRef<Expr *> SrcExprs); |
3276 | |
3277 | |
3278 | MutableArrayRef<Expr *> getSourceExprs() { |
3279 | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
3280 | } |
3281 | ArrayRef<const Expr *> getSourceExprs() const { |
3282 | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
3283 | } |
3284 | |
3285 | |
3286 | |
3287 | |
3288 | void setDestinationExprs(ArrayRef<Expr *> DstExprs); |
3289 | |
3290 | |
3291 | MutableArrayRef<Expr *> getDestinationExprs() { |
3292 | return MutableArrayRef<Expr *>(getSourceExprs().end(), varlist_size()); |
3293 | } |
3294 | ArrayRef<const Expr *> getDestinationExprs() const { |
3295 | return llvm::makeArrayRef(getSourceExprs().end(), varlist_size()); |
3296 | } |
3297 | |
3298 | |
3299 | |
3300 | |
3301 | |
3302 | void setAssignmentOps(ArrayRef<Expr *> AssignmentOps); |
3303 | |
3304 | |
3305 | MutableArrayRef<Expr *> getAssignmentOps() { |
3306 | return MutableArrayRef<Expr *>(getDestinationExprs().end(), varlist_size()); |
3307 | } |
3308 | ArrayRef<const Expr *> getAssignmentOps() const { |
3309 | return llvm::makeArrayRef(getDestinationExprs().end(), varlist_size()); |
3310 | } |
3311 | |
3312 | public: |
3313 | |
3314 | |
3315 | |
3316 | |
3317 | |
3318 | |
3319 | |
3320 | |
3321 | |
3322 | |
3323 | |
3324 | |
3325 | |
3326 | |
3327 | |
3328 | |
3329 | |
3330 | |
3331 | |
3332 | |
3333 | static OMPCopyprivateClause * |
3334 | Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, |
3335 | SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs, |
3336 | ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps); |
3337 | |
3338 | |
3339 | |
3340 | |
3341 | |
3342 | static OMPCopyprivateClause *CreateEmpty(const ASTContext &C, unsigned N); |
3343 | |
3344 | using helper_expr_iterator = MutableArrayRef<Expr *>::iterator; |
3345 | using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator; |
3346 | using helper_expr_range = llvm::iterator_range<helper_expr_iterator>; |
3347 | using helper_expr_const_range = |
3348 | llvm::iterator_range<helper_expr_const_iterator>; |
3349 | |
3350 | helper_expr_const_range source_exprs() const { |
3351 | return helper_expr_const_range(getSourceExprs().begin(), |
3352 | getSourceExprs().end()); |
3353 | } |
3354 | |
3355 | helper_expr_range source_exprs() { |
3356 | return helper_expr_range(getSourceExprs().begin(), getSourceExprs().end()); |
3357 | } |
3358 | |
3359 | helper_expr_const_range destination_exprs() const { |
3360 | return helper_expr_const_range(getDestinationExprs().begin(), |
3361 | getDestinationExprs().end()); |
3362 | } |
3363 | |
3364 | helper_expr_range destination_exprs() { |
3365 | return helper_expr_range(getDestinationExprs().begin(), |
3366 | getDestinationExprs().end()); |
3367 | } |
3368 | |
3369 | helper_expr_const_range assignment_ops() const { |
3370 | return helper_expr_const_range(getAssignmentOps().begin(), |
3371 | getAssignmentOps().end()); |
3372 | } |
3373 | |
3374 | helper_expr_range assignment_ops() { |
3375 | return helper_expr_range(getAssignmentOps().begin(), |
3376 | getAssignmentOps().end()); |
3377 | } |
3378 | |
3379 | child_range children() { |
3380 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
3381 | reinterpret_cast<Stmt **>(varlist_end())); |
3382 | } |
3383 | |
3384 | static bool classof(const OMPClause *T) { |
3385 | return T->getClauseKind() == OMPC_copyprivate; |
3386 | } |
3387 | }; |
3388 | |
3389 | |
3390 | |
3391 | |
3392 | |
3393 | |
3394 | |
3395 | |
3396 | |
3397 | |
3398 | |
3399 | |
3400 | |
3401 | class OMPFlushClause final |
3402 | : public OMPVarListClause<OMPFlushClause>, |
3403 | private llvm::TrailingObjects<OMPFlushClause, Expr *> { |
3404 | friend OMPVarListClause; |
3405 | friend TrailingObjects; |
3406 | |
3407 | |
3408 | |
3409 | |
3410 | |
3411 | |
3412 | |
3413 | OMPFlushClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
3414 | SourceLocation EndLoc, unsigned N) |
3415 | : OMPVarListClause<OMPFlushClause>(OMPC_flush, StartLoc, LParenLoc, |
3416 | EndLoc, N) {} |
3417 | |
3418 | |
3419 | |
3420 | |
3421 | explicit OMPFlushClause(unsigned N) |
3422 | : OMPVarListClause<OMPFlushClause>(OMPC_flush, SourceLocation(), |
3423 | SourceLocation(), SourceLocation(), |
3424 | N) {} |
3425 | |
3426 | public: |
3427 | |
3428 | |
3429 | |
3430 | |
3431 | |
3432 | |
3433 | |
3434 | static OMPFlushClause *Create(const ASTContext &C, SourceLocation StartLoc, |
3435 | SourceLocation LParenLoc, SourceLocation EndLoc, |
3436 | ArrayRef<Expr *> VL); |
3437 | |
3438 | |
3439 | |
3440 | |
3441 | |
3442 | static OMPFlushClause *CreateEmpty(const ASTContext &C, unsigned N); |
3443 | |
3444 | child_range children() { |
3445 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
3446 | reinterpret_cast<Stmt **>(varlist_end())); |
3447 | } |
3448 | |
3449 | static bool classof(const OMPClause *T) { |
3450 | return T->getClauseKind() == OMPC_flush; |
3451 | } |
3452 | }; |
3453 | |
3454 | |
3455 | |
3456 | |
3457 | |
3458 | |
3459 | |
3460 | |
3461 | |
3462 | class OMPDependClause final |
3463 | : public OMPVarListClause<OMPDependClause>, |
3464 | private llvm::TrailingObjects<OMPDependClause, Expr *> { |
3465 | friend class OMPClauseReader; |
3466 | friend OMPVarListClause; |
3467 | friend TrailingObjects; |
3468 | |
3469 | |
3470 | OpenMPDependClauseKind DepKind = OMPC_DEPEND_unknown; |
3471 | |
3472 | |
3473 | SourceLocation DepLoc; |
3474 | |
3475 | |
3476 | SourceLocation ColonLoc; |
3477 | |
3478 | |
3479 | unsigned NumLoops = 0; |
3480 | |
3481 | |
3482 | |
3483 | |
3484 | |
3485 | |
3486 | |
3487 | |
3488 | |
3489 | OMPDependClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
3490 | SourceLocation EndLoc, unsigned N, unsigned NumLoops) |
3491 | : OMPVarListClause<OMPDependClause>(OMPC_depend, StartLoc, LParenLoc, |
3492 | EndLoc, N), NumLoops(NumLoops) {} |
3493 | |
3494 | |
3495 | |
3496 | |
3497 | |
3498 | |
3499 | explicit OMPDependClause(unsigned N, unsigned NumLoops) |
3500 | : OMPVarListClause<OMPDependClause>(OMPC_depend, SourceLocation(), |
3501 | SourceLocation(), SourceLocation(), |
3502 | N), |
3503 | NumLoops(NumLoops) {} |
3504 | |
3505 | |
3506 | void setDependencyKind(OpenMPDependClauseKind K) { DepKind = K; } |
3507 | |
3508 | |
3509 | void setDependencyLoc(SourceLocation Loc) { DepLoc = Loc; } |
3510 | |
3511 | |
3512 | void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; } |
3513 | |
3514 | public: |
3515 | |
3516 | |
3517 | |
3518 | |
3519 | |
3520 | |
3521 | |
3522 | |
3523 | |
3524 | |
3525 | |
3526 | |
3527 | static OMPDependClause *Create(const ASTContext &C, SourceLocation StartLoc, |
3528 | SourceLocation LParenLoc, |
3529 | SourceLocation EndLoc, |
3530 | OpenMPDependClauseKind DepKind, |
3531 | SourceLocation DepLoc, SourceLocation ColonLoc, |
3532 | ArrayRef<Expr *> VL, unsigned NumLoops); |
3533 | |
3534 | |
3535 | |
3536 | |
3537 | |
3538 | |
3539 | |
3540 | static OMPDependClause *CreateEmpty(const ASTContext &C, unsigned N, |
3541 | unsigned NumLoops); |
3542 | |
3543 | |
3544 | OpenMPDependClauseKind getDependencyKind() const { return DepKind; } |
3545 | |
3546 | |
3547 | SourceLocation getDependencyLoc() const { return DepLoc; } |
3548 | |
3549 | |
3550 | SourceLocation getColonLoc() const { return ColonLoc; } |
3551 | |
3552 | |
3553 | unsigned getNumLoops() const { return NumLoops; } |
3554 | |
3555 | |
3556 | |
3557 | void setLoopData(unsigned NumLoop, Expr *Cnt); |
3558 | |
3559 | |
3560 | Expr *getLoopData(unsigned NumLoop); |
3561 | const Expr *getLoopData(unsigned NumLoop) const; |
3562 | |
3563 | child_range children() { |
3564 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
3565 | reinterpret_cast<Stmt **>(varlist_end())); |
3566 | } |
3567 | |
3568 | static bool classof(const OMPClause *T) { |
3569 | return T->getClauseKind() == OMPC_depend; |
3570 | } |
3571 | }; |
3572 | |
3573 | |
3574 | |
3575 | |
3576 | |
3577 | |
3578 | |
3579 | |
3580 | |
3581 | class OMPDeviceClause : public OMPClause, public OMPClauseWithPreInit { |
3582 | friend class OMPClauseReader; |
3583 | |
3584 | |
3585 | SourceLocation LParenLoc; |
3586 | |
3587 | |
3588 | Stmt *Device = nullptr; |
3589 | |
3590 | |
3591 | |
3592 | |
3593 | void setDevice(Expr *E) { Device = E; } |
3594 | |
3595 | public: |
3596 | |
3597 | |
3598 | |
3599 | |
3600 | |
3601 | |
3602 | |
3603 | |
3604 | OMPDeviceClause(Expr *E, Stmt *HelperE, OpenMPDirectiveKind CaptureRegion, |
3605 | SourceLocation StartLoc, SourceLocation LParenLoc, |
3606 | SourceLocation EndLoc) |
3607 | : OMPClause(OMPC_device, StartLoc, EndLoc), OMPClauseWithPreInit(this), |
3608 | LParenLoc(LParenLoc), Device(E) { |
3609 | setPreInitStmt(HelperE, CaptureRegion); |
3610 | } |
3611 | |
3612 | |
3613 | OMPDeviceClause() |
3614 | : OMPClause(OMPC_device, SourceLocation(), SourceLocation()), |
3615 | OMPClauseWithPreInit(this) {} |
3616 | |
3617 | |
3618 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
3619 | |
3620 | |
3621 | SourceLocation getLParenLoc() const { return LParenLoc; } |
3622 | |
3623 | |
3624 | Expr *getDevice() { return cast<Expr>(Device); } |
3625 | |
3626 | |
3627 | Expr *getDevice() const { return cast<Expr>(Device); } |
3628 | |
3629 | child_range children() { return child_range(&Device, &Device + 1); } |
3630 | |
3631 | static bool classof(const OMPClause *T) { |
3632 | return T->getClauseKind() == OMPC_device; |
3633 | } |
3634 | }; |
3635 | |
3636 | |
3637 | |
3638 | |
3639 | |
3640 | |
3641 | |
3642 | class OMPThreadsClause : public OMPClause { |
3643 | public: |
3644 | |
3645 | |
3646 | |
3647 | |
3648 | OMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc) |
3649 | : OMPClause(OMPC_threads, StartLoc, EndLoc) {} |
3650 | |
3651 | |
3652 | OMPThreadsClause() |
3653 | : OMPClause(OMPC_threads, SourceLocation(), SourceLocation()) {} |
3654 | |
3655 | child_range children() { |
3656 | return child_range(child_iterator(), child_iterator()); |
3657 | } |
3658 | |
3659 | static bool classof(const OMPClause *T) { |
3660 | return T->getClauseKind() == OMPC_threads; |
3661 | } |
3662 | }; |
3663 | |
3664 | |
3665 | |
3666 | |
3667 | |
3668 | |
3669 | |
3670 | class OMPSIMDClause : public OMPClause { |
3671 | public: |
3672 | |
3673 | |
3674 | |
3675 | |
3676 | OMPSIMDClause(SourceLocation StartLoc, SourceLocation EndLoc) |
3677 | : OMPClause(OMPC_simd, StartLoc, EndLoc) {} |
3678 | |
3679 | |
3680 | OMPSIMDClause() : OMPClause(OMPC_simd, SourceLocation(), SourceLocation()) {} |
3681 | |
3682 | child_range children() { |
3683 | return child_range(child_iterator(), child_iterator()); |
3684 | } |
3685 | |
3686 | static bool classof(const OMPClause *T) { |
3687 | return T->getClauseKind() == OMPC_simd; |
3688 | } |
3689 | }; |
3690 | |
3691 | |
3692 | |
3693 | class OMPClauseMappableExprCommon { |
3694 | public: |
3695 | |
3696 | |
3697 | |
3698 | |
3699 | |
3700 | |
3701 | class MappableComponent { |
3702 | |
3703 | Expr *AssociatedExpression = nullptr; |
3704 | |
3705 | |
3706 | |
3707 | |
3708 | ValueDecl *AssociatedDeclaration = nullptr; |
3709 | |
3710 | public: |
3711 | explicit MappableComponent() = default; |
3712 | explicit MappableComponent(Expr *AssociatedExpression, |
3713 | ValueDecl *AssociatedDeclaration) |
3714 | : AssociatedExpression(AssociatedExpression), |
3715 | AssociatedDeclaration( |
3716 | AssociatedDeclaration |
3717 | ? cast<ValueDecl>(AssociatedDeclaration->getCanonicalDecl()) |
3718 | : nullptr) {} |
3719 | |
3720 | Expr *getAssociatedExpression() const { return AssociatedExpression; } |
3721 | |
3722 | ValueDecl *getAssociatedDeclaration() const { |
3723 | return AssociatedDeclaration; |
3724 | } |
3725 | }; |
3726 | |
3727 | |
3728 | |
3729 | using MappableExprComponentList = SmallVector<MappableComponent, 8>; |
3730 | using MappableExprComponentListRef = ArrayRef<MappableComponent>; |
3731 | |
3732 | |
3733 | |
3734 | |
3735 | using MappableExprComponentLists = SmallVector<MappableExprComponentList, 8>; |
3736 | using MappableExprComponentListsRef = ArrayRef<MappableExprComponentList>; |
3737 | |
3738 | protected: |
3739 | |
3740 | static unsigned |
3741 | getComponentsTotalNumber(MappableExprComponentListsRef ComponentLists); |
3742 | |
3743 | |
3744 | |
3745 | static unsigned |
3746 | getUniqueDeclarationsTotalNumber(ArrayRef<const ValueDecl *> Declarations); |
3747 | }; |
3748 | |
3749 | |
3750 | |
3751 | struct OMPMappableExprListSizeTy { |
3752 | |
3753 | unsigned NumVars; |
3754 | |
3755 | unsigned NumUniqueDeclarations; |
3756 | |
3757 | unsigned NumComponentLists; |
3758 | |
3759 | unsigned NumComponents; |
3760 | OMPMappableExprListSizeTy() = default; |
3761 | OMPMappableExprListSizeTy(unsigned NumVars, unsigned NumUniqueDeclarations, |
3762 | unsigned NumComponentLists, unsigned NumComponents) |
3763 | : NumVars(NumVars), NumUniqueDeclarations(NumUniqueDeclarations), |
3764 | NumComponentLists(NumComponentLists), NumComponents(NumComponents) {} |
3765 | }; |
3766 | |
3767 | |
3768 | |
3769 | |
3770 | |
3771 | template <class T> |
3772 | class OMPMappableExprListClause : public OMPVarListClause<T>, |
3773 | public OMPClauseMappableExprCommon { |
3774 | friend class OMPClauseReader; |
3775 | |
3776 | |
3777 | unsigned NumUniqueDeclarations; |
3778 | |
3779 | |
3780 | unsigned NumComponentLists; |
3781 | |
3782 | |
3783 | unsigned NumComponents; |
3784 | |
3785 | |
3786 | NestedNameSpecifierLoc MapperQualifierLoc; |
3787 | |
3788 | |
3789 | DeclarationNameInfo MapperIdInfo; |
3790 | |
3791 | protected: |
3792 | |
3793 | |
3794 | |
3795 | |
3796 | |
3797 | |
3798 | |
3799 | |
3800 | |
3801 | |
3802 | |
3803 | |
3804 | |
3805 | |
3806 | |
3807 | |
3808 | OMPMappableExprListClause( |
3809 | OpenMPClauseKind K, const OMPVarListLocTy &Locs, |
3810 | const OMPMappableExprListSizeTy &Sizes, |
3811 | NestedNameSpecifierLoc *MapperQualifierLocPtr = nullptr, |
3812 | DeclarationNameInfo *MapperIdInfoPtr = nullptr) |
3813 | : OMPVarListClause<T>(K, Locs.StartLoc, Locs.LParenLoc, Locs.EndLoc, |
3814 | Sizes.NumVars), |
3815 | NumUniqueDeclarations(Sizes.NumUniqueDeclarations), |
3816 | NumComponentLists(Sizes.NumComponentLists), |
3817 | NumComponents(Sizes.NumComponents) { |
3818 | if (MapperQualifierLocPtr) |
3819 | MapperQualifierLoc = *MapperQualifierLocPtr; |
3820 | if (MapperIdInfoPtr) |
3821 | MapperIdInfo = *MapperIdInfoPtr; |
3822 | } |
3823 | |
3824 | |
3825 | |
3826 | MutableArrayRef<ValueDecl *> getUniqueDeclsRef() { |
3827 | return MutableArrayRef<ValueDecl *>( |
3828 | static_cast<T *>(this)->template getTrailingObjects<ValueDecl *>(), |
3829 | NumUniqueDeclarations); |
3830 | } |
3831 | |
3832 | |
3833 | |
3834 | ArrayRef<ValueDecl *> getUniqueDeclsRef() const { |
3835 | return ArrayRef<ValueDecl *>( |
3836 | static_cast<const T *>(this) |
3837 | ->template getTrailingObjects<ValueDecl *>(), |
3838 | NumUniqueDeclarations); |
3839 | } |
3840 | |
3841 | |
3842 | |
3843 | void setUniqueDecls(ArrayRef<ValueDecl *> UDs) { |
3844 | (0) . __assert_fail ("UDs.size() == NumUniqueDeclarations && \"Unexpected amount of unique declarations.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3845, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(UDs.size() == NumUniqueDeclarations && |
3845 | (0) . __assert_fail ("UDs.size() == NumUniqueDeclarations && \"Unexpected amount of unique declarations.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3845, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Unexpected amount of unique declarations."); |
3846 | std::copy(UDs.begin(), UDs.end(), getUniqueDeclsRef().begin()); |
3847 | } |
3848 | |
3849 | |
3850 | |
3851 | MutableArrayRef<unsigned> getDeclNumListsRef() { |
3852 | return MutableArrayRef<unsigned>( |
3853 | static_cast<T *>(this)->template getTrailingObjects<unsigned>(), |
3854 | NumUniqueDeclarations); |
3855 | } |
3856 | |
3857 | |
3858 | |
3859 | ArrayRef<unsigned> getDeclNumListsRef() const { |
3860 | return ArrayRef<unsigned>( |
3861 | static_cast<const T *>(this)->template getTrailingObjects<unsigned>(), |
3862 | NumUniqueDeclarations); |
3863 | } |
3864 | |
3865 | |
3866 | |
3867 | void setDeclNumLists(ArrayRef<unsigned> DNLs) { |
3868 | (0) . __assert_fail ("DNLs.size() == NumUniqueDeclarations && \"Unexpected amount of list numbers.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3869, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(DNLs.size() == NumUniqueDeclarations && |
3869 | (0) . __assert_fail ("DNLs.size() == NumUniqueDeclarations && \"Unexpected amount of list numbers.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3869, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Unexpected amount of list numbers."); |
3870 | std::copy(DNLs.begin(), DNLs.end(), getDeclNumListsRef().begin()); |
3871 | } |
3872 | |
3873 | |
3874 | |
3875 | MutableArrayRef<unsigned> getComponentListSizesRef() { |
3876 | return MutableArrayRef<unsigned>( |
3877 | static_cast<T *>(this)->template getTrailingObjects<unsigned>() + |
3878 | NumUniqueDeclarations, |
3879 | NumComponentLists); |
3880 | } |
3881 | |
3882 | |
3883 | |
3884 | ArrayRef<unsigned> getComponentListSizesRef() const { |
3885 | return ArrayRef<unsigned>( |
3886 | static_cast<const T *>(this)->template getTrailingObjects<unsigned>() + |
3887 | NumUniqueDeclarations, |
3888 | NumComponentLists); |
3889 | } |
3890 | |
3891 | |
3892 | |
3893 | void setComponentListSizes(ArrayRef<unsigned> CLSs) { |
3894 | (0) . __assert_fail ("CLSs.size() == NumComponentLists && \"Unexpected amount of component lists.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3895, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(CLSs.size() == NumComponentLists && |
3895 | (0) . __assert_fail ("CLSs.size() == NumComponentLists && \"Unexpected amount of component lists.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3895, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Unexpected amount of component lists."); |
3896 | std::copy(CLSs.begin(), CLSs.end(), getComponentListSizesRef().begin()); |
3897 | } |
3898 | |
3899 | |
3900 | MutableArrayRef<MappableComponent> getComponentsRef() { |
3901 | return MutableArrayRef<MappableComponent>( |
3902 | static_cast<T *>(this) |
3903 | ->template getTrailingObjects<MappableComponent>(), |
3904 | NumComponents); |
3905 | } |
3906 | |
3907 | |
3908 | ArrayRef<MappableComponent> getComponentsRef() const { |
3909 | return ArrayRef<MappableComponent>( |
3910 | static_cast<const T *>(this) |
3911 | ->template getTrailingObjects<MappableComponent>(), |
3912 | NumComponents); |
3913 | } |
3914 | |
3915 | |
3916 | |
3917 | |
3918 | void setComponents(ArrayRef<MappableComponent> Components, |
3919 | ArrayRef<unsigned> CLSs) { |
3920 | (0) . __assert_fail ("Components.size() == NumComponents && \"Unexpected amount of component lists.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3921, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Components.size() == NumComponents && |
3921 | (0) . __assert_fail ("Components.size() == NumComponents && \"Unexpected amount of component lists.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3921, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Unexpected amount of component lists."); |
3922 | (0) . __assert_fail ("CLSs.size() == NumComponentLists && \"Unexpected amount of list sizes.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3923, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(CLSs.size() == NumComponentLists && |
3923 | (0) . __assert_fail ("CLSs.size() == NumComponentLists && \"Unexpected amount of list sizes.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3923, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Unexpected amount of list sizes."); |
3924 | std::copy(Components.begin(), Components.end(), getComponentsRef().begin()); |
3925 | } |
3926 | |
3927 | |
3928 | |
3929 | void setClauseInfo(ArrayRef<ValueDecl *> Declarations, |
3930 | MappableExprComponentListsRef ComponentLists) { |
3931 | |
3932 | |
3933 | (0) . __assert_fail ("getUniqueDeclarationsTotalNumber(Declarations) == NumUniqueDeclarations && \"Unexpected number of mappable expression info entries!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3935, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(getUniqueDeclarationsTotalNumber(Declarations) == |
3934 | (0) . __assert_fail ("getUniqueDeclarationsTotalNumber(Declarations) == NumUniqueDeclarations && \"Unexpected number of mappable expression info entries!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3935, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> NumUniqueDeclarations && |
3935 | (0) . __assert_fail ("getUniqueDeclarationsTotalNumber(Declarations) == NumUniqueDeclarations && \"Unexpected number of mappable expression info entries!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3935, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Unexpected number of mappable expression info entries!"); |
3936 | (0) . __assert_fail ("getComponentsTotalNumber(ComponentLists) == NumComponents && \"Unexpected total number of components!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3937, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(getComponentsTotalNumber(ComponentLists) == NumComponents && |
3937 | (0) . __assert_fail ("getComponentsTotalNumber(ComponentLists) == NumComponents && \"Unexpected total number of components!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3937, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Unexpected total number of components!"); |
3938 | (0) . __assert_fail ("Declarations.size() == ComponentLists.size() && \"Declaration and component lists size is not consistent!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3939, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Declarations.size() == ComponentLists.size() && |
3939 | (0) . __assert_fail ("Declarations.size() == ComponentLists.size() && \"Declaration and component lists size is not consistent!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3939, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Declaration and component lists size is not consistent!"); |
3940 | (0) . __assert_fail ("Declarations.size() == NumComponentLists && \"Unexpected declaration and component lists size!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3941, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Declarations.size() == NumComponentLists && |
3941 | (0) . __assert_fail ("Declarations.size() == NumComponentLists && \"Unexpected declaration and component lists size!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3941, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Unexpected declaration and component lists size!"); |
3942 | |
3943 | |
3944 | |
3945 | |
3946 | llvm::MapVector<ValueDecl *, SmallVector<MappableExprComponentListRef, 8>> |
3947 | ComponentListMap; |
3948 | { |
3949 | auto CI = ComponentLists.begin(); |
3950 | for (auto DI = Declarations.begin(), DE = Declarations.end(); DI != DE; |
3951 | ++DI, ++CI) { |
3952 | (0) . __assert_fail ("!CI->empty() && \"Invalid component list!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 3952, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(!CI->empty() && "Invalid component list!"); |
3953 | ComponentListMap[*DI].push_back(*CI); |
3954 | } |
3955 | } |
3956 | |
3957 | |
3958 | auto UniqueDeclarations = getUniqueDeclsRef(); |
3959 | auto UDI = UniqueDeclarations.begin(); |
3960 | |
3961 | auto DeclNumLists = getDeclNumListsRef(); |
3962 | auto DNLI = DeclNumLists.begin(); |
3963 | |
3964 | auto ComponentListSizes = getComponentListSizesRef(); |
3965 | auto CLSI = ComponentListSizes.begin(); |
3966 | |
3967 | auto Components = getComponentsRef(); |
3968 | auto CI = Components.begin(); |
3969 | |
3970 | |
3971 | unsigned PrevSize = 0u; |
3972 | |
3973 | |
3974 | for (auto &M : ComponentListMap) { |
3975 | |
3976 | auto *D = M.first; |
3977 | |
3978 | auto CL = M.second; |
3979 | |
3980 | |
3981 | *UDI = D; |
3982 | ++UDI; |
3983 | |
3984 | *DNLI = CL.size(); |
3985 | ++DNLI; |
3986 | |
3987 | |
3988 | |
3989 | for (auto C : CL) { |
3990 | |
3991 | PrevSize += C.size(); |
3992 | |
3993 | |
3994 | *CLSI = PrevSize; |
3995 | ++CLSI; |
3996 | |
3997 | |
3998 | CI = std::copy(C.begin(), C.end(), CI); |
3999 | } |
4000 | } |
4001 | } |
4002 | |
4003 | |
4004 | void setMapperQualifierLoc(NestedNameSpecifierLoc NNSL) { |
4005 | MapperQualifierLoc = NNSL; |
4006 | } |
4007 | |
4008 | |
4009 | void setMapperIdInfo(DeclarationNameInfo MapperId) { |
4010 | MapperIdInfo = MapperId; |
4011 | } |
4012 | |
4013 | |
4014 | |
4015 | MutableArrayRef<Expr *> getUDMapperRefs() { |
4016 | return llvm::makeMutableArrayRef<Expr *>( |
4017 | static_cast<T *>(this)->template getTrailingObjects<Expr *>() + |
4018 | OMPVarListClause<T>::varlist_size(), |
4019 | OMPVarListClause<T>::varlist_size()); |
4020 | } |
4021 | |
4022 | |
4023 | |
4024 | ArrayRef<Expr *> getUDMapperRefs() const { |
4025 | return llvm::makeArrayRef<Expr *>( |
4026 | static_cast<T *>(this)->template getTrailingObjects<Expr *>() + |
4027 | OMPVarListClause<T>::varlist_size(), |
4028 | OMPVarListClause<T>::varlist_size()); |
4029 | } |
4030 | |
4031 | |
4032 | |
4033 | void setUDMapperRefs(ArrayRef<Expr *> DMDs) { |
4034 | (0) . __assert_fail ("DMDs.size() == OMPVarListClause..varlist_size() && \"Unexpected number of user-defined mappers.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4035, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(DMDs.size() == OMPVarListClause<T>::varlist_size() && |
4035 | (0) . __assert_fail ("DMDs.size() == OMPVarListClause..varlist_size() && \"Unexpected number of user-defined mappers.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4035, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Unexpected number of user-defined mappers."); |
4036 | std::copy(DMDs.begin(), DMDs.end(), getUDMapperRefs().begin()); |
4037 | } |
4038 | |
4039 | public: |
4040 | |
4041 | unsigned getUniqueDeclarationsNum() const { return NumUniqueDeclarations; } |
4042 | |
4043 | |
4044 | unsigned getTotalComponentListNum() const { return NumComponentLists; } |
4045 | |
4046 | |
4047 | |
4048 | unsigned getTotalComponentsNum() const { return NumComponents; } |
4049 | |
4050 | |
4051 | NestedNameSpecifierLoc getMapperQualifierLoc() const { |
4052 | return MapperQualifierLoc; |
4053 | } |
4054 | |
4055 | |
4056 | const DeclarationNameInfo &getMapperIdInfo() const { return MapperIdInfo; } |
4057 | |
4058 | |
4059 | |
4060 | class const_component_lists_iterator |
4061 | : public llvm::iterator_adaptor_base< |
4062 | const_component_lists_iterator, |
4063 | MappableExprComponentListRef::const_iterator, |
4064 | std::forward_iterator_tag, MappableComponent, ptrdiff_t, |
4065 | MappableComponent, MappableComponent> { |
4066 | |
4067 | ArrayRef<ValueDecl *>::iterator DeclCur; |
4068 | |
4069 | |
4070 | ArrayRef<unsigned>::iterator NumListsCur; |
4071 | |
4072 | |
4073 | unsigned RemainingLists = 0; |
4074 | |
4075 | |
4076 | |
4077 | unsigned PrevListSize = 0; |
4078 | |
4079 | |
4080 | |
4081 | ArrayRef<unsigned>::const_iterator ListSizeCur; |
4082 | ArrayRef<unsigned>::const_iterator ListSizeEnd; |
4083 | |
4084 | |
4085 | MappableExprComponentListRef::const_iterator End; |
4086 | |
4087 | public: |
4088 | |
4089 | explicit const_component_lists_iterator( |
4090 | ArrayRef<ValueDecl *> UniqueDecls, ArrayRef<unsigned> DeclsListNum, |
4091 | ArrayRef<unsigned> CumulativeListSizes, |
4092 | MappableExprComponentListRef Components) |
4093 | : const_component_lists_iterator::iterator_adaptor_base( |
4094 | Components.begin()), |
4095 | DeclCur(UniqueDecls.begin()), NumListsCur(DeclsListNum.begin()), |
4096 | ListSizeCur(CumulativeListSizes.begin()), |
4097 | ListSizeEnd(CumulativeListSizes.end()), End(Components.end()) { |
4098 | (0) . __assert_fail ("UniqueDecls.size() == DeclsListNum.size() && \"Inconsistent number of declarations and list sizes!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4099, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(UniqueDecls.size() == DeclsListNum.size() && |
4099 | (0) . __assert_fail ("UniqueDecls.size() == DeclsListNum.size() && \"Inconsistent number of declarations and list sizes!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4099, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Inconsistent number of declarations and list sizes!"); |
4100 | if (!DeclsListNum.empty()) |
4101 | RemainingLists = *NumListsCur; |
4102 | } |
4103 | |
4104 | |
4105 | |
4106 | explicit const_component_lists_iterator( |
4107 | const ValueDecl *Declaration, ArrayRef<ValueDecl *> UniqueDecls, |
4108 | ArrayRef<unsigned> DeclsListNum, ArrayRef<unsigned> CumulativeListSizes, |
4109 | MappableExprComponentListRef Components) |
4110 | : const_component_lists_iterator(UniqueDecls, DeclsListNum, |
4111 | CumulativeListSizes, Components) { |
4112 | |
4113 | |
4114 | |
4115 | for (; DeclCur != UniqueDecls.end(); ++DeclCur, ++NumListsCur) { |
4116 | if (*DeclCur == Declaration) |
4117 | break; |
4118 | |
4119 | (0) . __assert_fail ("*NumListsCur > 0 && \"No lists associated with declaration??\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4119, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(*NumListsCur > 0 && "No lists associated with declaration??"); |
4120 | |
4121 | |
4122 | |
4123 | std::advance(ListSizeCur, *NumListsCur - 1); |
4124 | PrevListSize = *ListSizeCur; |
4125 | ++ListSizeCur; |
4126 | } |
4127 | |
4128 | |
4129 | |
4130 | if (ListSizeCur == CumulativeListSizes.end()) { |
4131 | this->I = End; |
4132 | RemainingLists = 0u; |
4133 | return; |
4134 | } |
4135 | |
4136 | |
4137 | |
4138 | RemainingLists = *NumListsCur; |
4139 | |
4140 | |
4141 | ListSizeEnd = ListSizeCur; |
4142 | std::advance(ListSizeEnd, RemainingLists); |
4143 | |
4144 | |
4145 | |
4146 | std::advance(this->I, PrevListSize); |
4147 | } |
4148 | |
4149 | |
4150 | |
4151 | std::pair<const ValueDecl *, MappableExprComponentListRef> |
4152 | operator*() const { |
4153 | (0) . __assert_fail ("ListSizeCur != ListSizeEnd && \"Invalid iterator!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4153, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(ListSizeCur != ListSizeEnd && "Invalid iterator!"); |
4154 | return std::make_pair( |
4155 | *DeclCur, |
4156 | MappableExprComponentListRef(&*this->I, *ListSizeCur - PrevListSize)); |
4157 | } |
4158 | std::pair<const ValueDecl *, MappableExprComponentListRef> |
4159 | operator->() const { |
4160 | return **this; |
4161 | } |
4162 | |
4163 | |
4164 | const_component_lists_iterator &operator++() { |
4165 | (0) . __assert_fail ("ListSizeCur != ListSizeEnd && RemainingLists && \"Invalid iterator!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4166, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(ListSizeCur != ListSizeEnd && RemainingLists && |
4166 | (0) . __assert_fail ("ListSizeCur != ListSizeEnd && RemainingLists && \"Invalid iterator!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4166, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Invalid iterator!"); |
4167 | |
4168 | |
4169 | |
4170 | if (std::next(ListSizeCur) == ListSizeEnd) { |
4171 | this->I = End; |
4172 | RemainingLists = 0; |
4173 | } else { |
4174 | std::advance(this->I, *ListSizeCur - PrevListSize); |
4175 | PrevListSize = *ListSizeCur; |
4176 | |
4177 | |
4178 | if (!(--RemainingLists)) { |
4179 | ++DeclCur; |
4180 | ++NumListsCur; |
4181 | RemainingLists = *NumListsCur; |
4182 | (0) . __assert_fail ("RemainingLists && \"No lists in the following declaration??\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4182, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(RemainingLists && "No lists in the following declaration??"); |
4183 | } |
4184 | } |
4185 | |
4186 | ++ListSizeCur; |
4187 | return *this; |
4188 | } |
4189 | }; |
4190 | |
4191 | using const_component_lists_range = |
4192 | llvm::iterator_range<const_component_lists_iterator>; |
4193 | |
4194 | |
4195 | const_component_lists_iterator component_lists_begin() const { |
4196 | return const_component_lists_iterator( |
4197 | getUniqueDeclsRef(), getDeclNumListsRef(), getComponentListSizesRef(), |
4198 | getComponentsRef()); |
4199 | } |
4200 | const_component_lists_iterator component_lists_end() const { |
4201 | return const_component_lists_iterator( |
4202 | ArrayRef<ValueDecl *>(), ArrayRef<unsigned>(), ArrayRef<unsigned>(), |
4203 | MappableExprComponentListRef(getComponentsRef().end(), |
4204 | getComponentsRef().end())); |
4205 | } |
4206 | const_component_lists_range component_lists() const { |
4207 | return {component_lists_begin(), component_lists_end()}; |
4208 | } |
4209 | |
4210 | |
4211 | |
4212 | const_component_lists_iterator |
4213 | decl_component_lists_begin(const ValueDecl *VD) const { |
4214 | return const_component_lists_iterator( |
4215 | VD, getUniqueDeclsRef(), getDeclNumListsRef(), |
4216 | getComponentListSizesRef(), getComponentsRef()); |
4217 | } |
4218 | const_component_lists_iterator decl_component_lists_end() const { |
4219 | return component_lists_end(); |
4220 | } |
4221 | const_component_lists_range decl_component_lists(const ValueDecl *VD) const { |
4222 | return {decl_component_lists_begin(VD), decl_component_lists_end()}; |
4223 | } |
4224 | |
4225 | |
4226 | |
4227 | using const_all_decls_iterator = ArrayRef<ValueDecl *>::iterator; |
4228 | using const_all_decls_range = llvm::iterator_range<const_all_decls_iterator>; |
4229 | |
4230 | const_all_decls_range all_decls() const { |
4231 | auto A = getUniqueDeclsRef(); |
4232 | return const_all_decls_range(A.begin(), A.end()); |
4233 | } |
4234 | |
4235 | using const_all_num_lists_iterator = ArrayRef<unsigned>::iterator; |
4236 | using const_all_num_lists_range = |
4237 | llvm::iterator_range<const_all_num_lists_iterator>; |
4238 | |
4239 | const_all_num_lists_range all_num_lists() const { |
4240 | auto A = getDeclNumListsRef(); |
4241 | return const_all_num_lists_range(A.begin(), A.end()); |
4242 | } |
4243 | |
4244 | using const_all_lists_sizes_iterator = ArrayRef<unsigned>::iterator; |
4245 | using const_all_lists_sizes_range = |
4246 | llvm::iterator_range<const_all_lists_sizes_iterator>; |
4247 | |
4248 | const_all_lists_sizes_range all_lists_sizes() const { |
4249 | auto A = getComponentListSizesRef(); |
4250 | return const_all_lists_sizes_range(A.begin(), A.end()); |
4251 | } |
4252 | |
4253 | using const_all_components_iterator = ArrayRef<MappableComponent>::iterator; |
4254 | using const_all_components_range = |
4255 | llvm::iterator_range<const_all_components_iterator>; |
4256 | |
4257 | const_all_components_range all_components() const { |
4258 | auto A = getComponentsRef(); |
4259 | return const_all_components_range(A.begin(), A.end()); |
4260 | } |
4261 | |
4262 | using mapperlist_iterator = MutableArrayRef<Expr *>::iterator; |
4263 | using mapperlist_const_iterator = ArrayRef<const Expr *>::iterator; |
4264 | using mapperlist_range = llvm::iterator_range<mapperlist_iterator>; |
4265 | using mapperlist_const_range = |
4266 | llvm::iterator_range<mapperlist_const_iterator>; |
4267 | |
4268 | mapperlist_iterator mapperlist_begin() { return getUDMapperRefs().begin(); } |
4269 | mapperlist_iterator mapperlist_end() { return getUDMapperRefs().end(); } |
4270 | mapperlist_const_iterator mapperlist_begin() const { |
4271 | return getUDMapperRefs().begin(); |
4272 | } |
4273 | mapperlist_const_iterator mapperlist_end() const { |
4274 | return getUDMapperRefs().end(); |
4275 | } |
4276 | mapperlist_range mapperlists() { |
4277 | return mapperlist_range(mapperlist_begin(), mapperlist_end()); |
4278 | } |
4279 | mapperlist_const_range mapperlists() const { |
4280 | return mapperlist_const_range(mapperlist_begin(), mapperlist_end()); |
4281 | } |
4282 | }; |
4283 | |
4284 | |
4285 | |
4286 | |
4287 | |
4288 | |
4289 | |
4290 | |
4291 | |
4292 | class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>, |
4293 | private llvm::TrailingObjects< |
4294 | OMPMapClause, Expr *, ValueDecl *, unsigned, |
4295 | OMPClauseMappableExprCommon::MappableComponent> { |
4296 | friend class OMPClauseReader; |
4297 | friend OMPMappableExprListClause; |
4298 | friend OMPVarListClause; |
4299 | friend TrailingObjects; |
4300 | |
4301 | |
4302 | |
4303 | size_t numTrailingObjects(OverloadToken<Expr *>) const { |
4304 | |
4305 | |
4306 | return 2 * varlist_size(); |
4307 | } |
4308 | size_t numTrailingObjects(OverloadToken<ValueDecl *>) const { |
4309 | return getUniqueDeclarationsNum(); |
4310 | } |
4311 | size_t numTrailingObjects(OverloadToken<unsigned>) const { |
4312 | return getUniqueDeclarationsNum() + getTotalComponentListNum(); |
4313 | } |
4314 | |
4315 | public: |
4316 | |
4317 | static constexpr unsigned NumberOfModifiers = |
4318 | OMPC_MAP_MODIFIER_last - OMPC_MAP_MODIFIER_unknown - 1; |
4319 | |
4320 | private: |
4321 | |
4322 | OpenMPMapModifierKind MapTypeModifiers[NumberOfModifiers] = { |
4323 | OMPC_MAP_MODIFIER_unknown, OMPC_MAP_MODIFIER_unknown, |
4324 | OMPC_MAP_MODIFIER_unknown}; |
4325 | |
4326 | |
4327 | SourceLocation MapTypeModifiersLoc[NumberOfModifiers]; |
4328 | |
4329 | |
4330 | OpenMPMapClauseKind MapType = OMPC_MAP_unknown; |
4331 | |
4332 | |
4333 | bool MapTypeIsImplicit = false; |
4334 | |
4335 | |
4336 | SourceLocation MapLoc; |
4337 | |
4338 | |
4339 | SourceLocation ColonLoc; |
4340 | |
4341 | |
4342 | |
4343 | |
4344 | |
4345 | |
4346 | |
4347 | |
4348 | |
4349 | |
4350 | |
4351 | |
4352 | |
4353 | |
4354 | |
4355 | |
4356 | |
4357 | |
4358 | |
4359 | |
4360 | |
4361 | explicit OMPMapClause(ArrayRef<OpenMPMapModifierKind> MapModifiers, |
4362 | ArrayRef<SourceLocation> MapModifiersLoc, |
4363 | NestedNameSpecifierLoc MapperQualifierLoc, |
4364 | DeclarationNameInfo MapperIdInfo, |
4365 | OpenMPMapClauseKind MapType, bool MapTypeIsImplicit, |
4366 | SourceLocation MapLoc, const OMPVarListLocTy &Locs, |
4367 | const OMPMappableExprListSizeTy &Sizes) |
4368 | : OMPMappableExprListClause(OMPC_map, Locs, Sizes, &MapperQualifierLoc, |
4369 | &MapperIdInfo), |
4370 | MapType(MapType), MapTypeIsImplicit(MapTypeIsImplicit), MapLoc(MapLoc) { |
4371 | (0) . __assert_fail ("llvm..array_lengthof(MapTypeModifiers) == MapModifiers.size() && \"Unexpected number of map type modifiers.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4372, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(llvm::array_lengthof(MapTypeModifiers) == MapModifiers.size() && |
4372 | (0) . __assert_fail ("llvm..array_lengthof(MapTypeModifiers) == MapModifiers.size() && \"Unexpected number of map type modifiers.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4372, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Unexpected number of map type modifiers."); |
4373 | llvm::copy(MapModifiers, std::begin(MapTypeModifiers)); |
4374 | |
4375 | (0) . __assert_fail ("llvm..array_lengthof(MapTypeModifiersLoc) == MapModifiersLoc.size() && \"Unexpected number of map type modifier locations.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4377, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(llvm::array_lengthof(MapTypeModifiersLoc) == |
4376 | (0) . __assert_fail ("llvm..array_lengthof(MapTypeModifiersLoc) == MapModifiersLoc.size() && \"Unexpected number of map type modifier locations.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4377, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> MapModifiersLoc.size() && |
4377 | (0) . __assert_fail ("llvm..array_lengthof(MapTypeModifiersLoc) == MapModifiersLoc.size() && \"Unexpected number of map type modifier locations.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4377, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Unexpected number of map type modifier locations."); |
4378 | llvm::copy(MapModifiersLoc, std::begin(MapTypeModifiersLoc)); |
4379 | } |
4380 | |
4381 | |
4382 | |
4383 | |
4384 | |
4385 | |
4386 | |
4387 | |
4388 | explicit OMPMapClause(const OMPMappableExprListSizeTy &Sizes) |
4389 | : OMPMappableExprListClause(OMPC_map, OMPVarListLocTy(), Sizes) {} |
4390 | |
4391 | |
4392 | |
4393 | |
4394 | |
4395 | void setMapTypeModifier(unsigned I, OpenMPMapModifierKind T) { |
4396 | (0) . __assert_fail ("I < NumberOfModifiers && \"Unexpected index to store map type modifier, exceeds array size.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4397, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(I < NumberOfModifiers && |
4397 | (0) . __assert_fail ("I < NumberOfModifiers && \"Unexpected index to store map type modifier, exceeds array size.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4397, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Unexpected index to store map type modifier, exceeds array size."); |
4398 | MapTypeModifiers[I] = T; |
4399 | } |
4400 | |
4401 | |
4402 | |
4403 | |
4404 | |
4405 | void setMapTypeModifierLoc(unsigned I, SourceLocation TLoc) { |
4406 | (0) . __assert_fail ("I < NumberOfModifiers && \"Index to store map type modifier location exceeds array size.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4407, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(I < NumberOfModifiers && |
4407 | (0) . __assert_fail ("I < NumberOfModifiers && \"Index to store map type modifier location exceeds array size.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4407, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Index to store map type modifier location exceeds array size."); |
4408 | MapTypeModifiersLoc[I] = TLoc; |
4409 | } |
4410 | |
4411 | |
4412 | |
4413 | |
4414 | void setMapType(OpenMPMapClauseKind T) { MapType = T; } |
4415 | |
4416 | |
4417 | |
4418 | |
4419 | void setMapLoc(SourceLocation TLoc) { MapLoc = TLoc; } |
4420 | |
4421 | |
4422 | void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; } |
4423 | |
4424 | public: |
4425 | |
4426 | |
4427 | |
4428 | |
4429 | |
4430 | |
4431 | |
4432 | |
4433 | |
4434 | |
4435 | |
4436 | |
4437 | |
4438 | |
4439 | |
4440 | |
4441 | |
4442 | |
4443 | |
4444 | static OMPMapClause * |
4445 | Create(const ASTContext &C, const OMPVarListLocTy &Locs, |
4446 | ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations, |
4447 | MappableExprComponentListsRef ComponentLists, |
4448 | ArrayRef<Expr *> UDMapperRefs, |
4449 | ArrayRef<OpenMPMapModifierKind> MapModifiers, |
4450 | ArrayRef<SourceLocation> MapModifiersLoc, |
4451 | NestedNameSpecifierLoc UDMQualifierLoc, DeclarationNameInfo MapperId, |
4452 | OpenMPMapClauseKind Type, bool TypeIsImplicit, SourceLocation TypeLoc); |
4453 | |
4454 | |
4455 | |
4456 | |
4457 | |
4458 | |
4459 | |
4460 | |
4461 | |
4462 | |
4463 | |
4464 | static OMPMapClause *CreateEmpty(const ASTContext &C, |
4465 | const OMPMappableExprListSizeTy &Sizes); |
4466 | |
4467 | |
4468 | OpenMPMapClauseKind getMapType() const LLVM_READONLY { return MapType; } |
4469 | |
4470 | |
4471 | |
4472 | |
4473 | |
4474 | |
4475 | bool isImplicitMapType() const LLVM_READONLY { return MapTypeIsImplicit; } |
4476 | |
4477 | |
4478 | |
4479 | |
4480 | OpenMPMapModifierKind getMapTypeModifier(unsigned Cnt) const LLVM_READONLY { |
4481 | (0) . __assert_fail ("Cnt < NumberOfModifiers && \"Requested modifier exceeds the total number of modifiers.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4482, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Cnt < NumberOfModifiers && |
4482 | (0) . __assert_fail ("Cnt < NumberOfModifiers && \"Requested modifier exceeds the total number of modifiers.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4482, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Requested modifier exceeds the total number of modifiers."); |
4483 | return MapTypeModifiers[Cnt]; |
4484 | } |
4485 | |
4486 | |
4487 | |
4488 | |
4489 | |
4490 | SourceLocation getMapTypeModifierLoc(unsigned Cnt) const LLVM_READONLY { |
4491 | (0) . __assert_fail ("Cnt < NumberOfModifiers && \"Requested modifier location exceeds total number of modifiers.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4492, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Cnt < NumberOfModifiers && |
4492 | (0) . __assert_fail ("Cnt < NumberOfModifiers && \"Requested modifier location exceeds total number of modifiers.\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/OpenMPClause.h", 4492, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true"> "Requested modifier location exceeds total number of modifiers."); |
4493 | return MapTypeModifiersLoc[Cnt]; |
4494 | } |
4495 | |
4496 | |
4497 | ArrayRef<OpenMPMapModifierKind> getMapTypeModifiers() const LLVM_READONLY { |
4498 | return llvm::makeArrayRef(MapTypeModifiers); |
4499 | } |
4500 | |
4501 | |
4502 | ArrayRef<SourceLocation> getMapTypeModifiersLoc() const LLVM_READONLY { |
4503 | return llvm::makeArrayRef(MapTypeModifiersLoc); |
4504 | } |
4505 | |
4506 | |
4507 | SourceLocation getMapLoc() const LLVM_READONLY { return MapLoc; } |
4508 | |
4509 | |
4510 | SourceLocation getColonLoc() const { return ColonLoc; } |
4511 | |
4512 | child_range children() { |
4513 | return child_range( |
4514 | reinterpret_cast<Stmt **>(varlist_begin()), |
4515 | reinterpret_cast<Stmt **>(varlist_end())); |
4516 | } |
4517 | |
4518 | static bool classof(const OMPClause *T) { |
4519 | return T->getClauseKind() == OMPC_map; |
4520 | } |
4521 | }; |
4522 | |
4523 | |
4524 | |
4525 | |
4526 | |
4527 | |
4528 | |
4529 | |
4530 | |
4531 | class OMPNumTeamsClause : public OMPClause, public OMPClauseWithPreInit { |
4532 | friend class OMPClauseReader; |
4533 | |
4534 | |
4535 | SourceLocation LParenLoc; |
4536 | |
4537 | |
4538 | Stmt *NumTeams = nullptr; |
4539 | |
4540 | |
4541 | |
4542 | |
4543 | void setNumTeams(Expr *E) { NumTeams = E; } |
4544 | |
4545 | public: |
4546 | |
4547 | |
4548 | |
4549 | |
4550 | |
4551 | |
4552 | |
4553 | |
4554 | |
4555 | OMPNumTeamsClause(Expr *E, Stmt *HelperE, OpenMPDirectiveKind CaptureRegion, |
4556 | SourceLocation StartLoc, SourceLocation LParenLoc, |
4557 | SourceLocation EndLoc) |
4558 | : OMPClause(OMPC_num_teams, StartLoc, EndLoc), OMPClauseWithPreInit(this), |
4559 | LParenLoc(LParenLoc), NumTeams(E) { |
4560 | setPreInitStmt(HelperE, CaptureRegion); |
4561 | } |
4562 | |
4563 | |
4564 | OMPNumTeamsClause() |
4565 | : OMPClause(OMPC_num_teams, SourceLocation(), SourceLocation()), |
4566 | OMPClauseWithPreInit(this) {} |
4567 | |
4568 | |
4569 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
4570 | |
4571 | |
4572 | SourceLocation getLParenLoc() const { return LParenLoc; } |
4573 | |
4574 | |
4575 | Expr *getNumTeams() { return cast<Expr>(NumTeams); } |
4576 | |
4577 | |
4578 | Expr *getNumTeams() const { return cast<Expr>(NumTeams); } |
4579 | |
4580 | child_range children() { return child_range(&NumTeams, &NumTeams + 1); } |
4581 | |
4582 | static bool classof(const OMPClause *T) { |
4583 | return T->getClauseKind() == OMPC_num_teams; |
4584 | } |
4585 | }; |
4586 | |
4587 | |
4588 | |
4589 | |
4590 | |
4591 | |
4592 | |
4593 | |
4594 | |
4595 | class OMPThreadLimitClause : public OMPClause, public OMPClauseWithPreInit { |
4596 | friend class OMPClauseReader; |
4597 | |
4598 | |
4599 | SourceLocation LParenLoc; |
4600 | |
4601 | |
4602 | Stmt *ThreadLimit = nullptr; |
4603 | |
4604 | |
4605 | |
4606 | |
4607 | void setThreadLimit(Expr *E) { ThreadLimit = E; } |
4608 | |
4609 | public: |
4610 | |
4611 | |
4612 | |
4613 | |
4614 | |
4615 | |
4616 | |
4617 | |
4618 | |
4619 | OMPThreadLimitClause(Expr *E, Stmt *HelperE, |
4620 | OpenMPDirectiveKind CaptureRegion, |
4621 | SourceLocation StartLoc, SourceLocation LParenLoc, |
4622 | SourceLocation EndLoc) |
4623 | : OMPClause(OMPC_thread_limit, StartLoc, EndLoc), |
4624 | OMPClauseWithPreInit(this), LParenLoc(LParenLoc), ThreadLimit(E) { |
4625 | setPreInitStmt(HelperE, CaptureRegion); |
4626 | } |
4627 | |
4628 | |
4629 | OMPThreadLimitClause() |
4630 | : OMPClause(OMPC_thread_limit, SourceLocation(), SourceLocation()), |
4631 | OMPClauseWithPreInit(this) {} |
4632 | |
4633 | |
4634 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
4635 | |
4636 | |
4637 | SourceLocation getLParenLoc() const { return LParenLoc; } |
4638 | |
4639 | |
4640 | Expr *getThreadLimit() { return cast<Expr>(ThreadLimit); } |
4641 | |
4642 | |
4643 | Expr *getThreadLimit() const { return cast<Expr>(ThreadLimit); } |
4644 | |
4645 | child_range children() { return child_range(&ThreadLimit, &ThreadLimit + 1); } |
4646 | |
4647 | static bool classof(const OMPClause *T) { |
4648 | return T->getClauseKind() == OMPC_thread_limit; |
4649 | } |
4650 | }; |
4651 | |
4652 | |
4653 | |
4654 | |
4655 | |
4656 | |
4657 | |
4658 | |
4659 | |
4660 | class OMPPriorityClause : public OMPClause { |
4661 | friend class OMPClauseReader; |
4662 | |
4663 | |
4664 | SourceLocation LParenLoc; |
4665 | |
4666 | |
4667 | Stmt *Priority = nullptr; |
4668 | |
4669 | |
4670 | |
4671 | |
4672 | void setPriority(Expr *E) { Priority = E; } |
4673 | |
4674 | public: |
4675 | |
4676 | |
4677 | |
4678 | |
4679 | |
4680 | |
4681 | OMPPriorityClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, |
4682 | SourceLocation EndLoc) |
4683 | : OMPClause(OMPC_priority, StartLoc, EndLoc), LParenLoc(LParenLoc), |
4684 | Priority(E) {} |
4685 | |
4686 | |
4687 | OMPPriorityClause() |
4688 | : OMPClause(OMPC_priority, SourceLocation(), SourceLocation()) {} |
4689 | |
4690 | |
4691 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
4692 | |
4693 | |
4694 | SourceLocation getLParenLoc() const { return LParenLoc; } |
4695 | |
4696 | |
4697 | Expr *getPriority() { return cast<Expr>(Priority); } |
4698 | |
4699 | |
4700 | Expr *getPriority() const { return cast<Expr>(Priority); } |
4701 | |
4702 | child_range children() { return child_range(&Priority, &Priority + 1); } |
4703 | |
4704 | static bool classof(const OMPClause *T) { |
4705 | return T->getClauseKind() == OMPC_priority; |
4706 | } |
4707 | }; |
4708 | |
4709 | |
4710 | |
4711 | |
4712 | |
4713 | |
4714 | |
4715 | |
4716 | |
4717 | class OMPGrainsizeClause : public OMPClause { |
4718 | friend class OMPClauseReader; |
4719 | |
4720 | |
4721 | SourceLocation LParenLoc; |
4722 | |
4723 | |
4724 | Stmt *Grainsize = nullptr; |
4725 | |
4726 | |
4727 | void setGrainsize(Expr *Size) { Grainsize = Size; } |
4728 | |
4729 | public: |
4730 | |
4731 | |
4732 | |
4733 | |
4734 | |
4735 | OMPGrainsizeClause(Expr *Size, SourceLocation StartLoc, |
4736 | SourceLocation LParenLoc, SourceLocation EndLoc) |
4737 | : OMPClause(OMPC_grainsize, StartLoc, EndLoc), LParenLoc(LParenLoc), |
4738 | Grainsize(Size) {} |
4739 | |
4740 | |
4741 | explicit OMPGrainsizeClause() |
4742 | : OMPClause(OMPC_grainsize, SourceLocation(), SourceLocation()) {} |
4743 | |
4744 | |
4745 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
4746 | |
4747 | |
4748 | SourceLocation getLParenLoc() const { return LParenLoc; } |
4749 | |
4750 | |
4751 | Expr *getGrainsize() const { return cast_or_null<Expr>(Grainsize); } |
4752 | |
4753 | child_range children() { return child_range(&Grainsize, &Grainsize + 1); } |
4754 | |
4755 | static bool classof(const OMPClause *T) { |
4756 | return T->getClauseKind() == OMPC_grainsize; |
4757 | } |
4758 | }; |
4759 | |
4760 | |
4761 | |
4762 | |
4763 | |
4764 | |
4765 | |
4766 | class OMPNogroupClause : public OMPClause { |
4767 | public: |
4768 | |
4769 | |
4770 | |
4771 | |
4772 | OMPNogroupClause(SourceLocation StartLoc, SourceLocation EndLoc) |
4773 | : OMPClause(OMPC_nogroup, StartLoc, EndLoc) {} |
4774 | |
4775 | |
4776 | OMPNogroupClause() |
4777 | : OMPClause(OMPC_nogroup, SourceLocation(), SourceLocation()) {} |
4778 | |
4779 | child_range children() { |
4780 | return child_range(child_iterator(), child_iterator()); |
4781 | } |
4782 | |
4783 | static bool classof(const OMPClause *T) { |
4784 | return T->getClauseKind() == OMPC_nogroup; |
4785 | } |
4786 | }; |
4787 | |
4788 | |
4789 | |
4790 | |
4791 | |
4792 | |
4793 | |
4794 | |
4795 | |
4796 | class OMPNumTasksClause : public OMPClause { |
4797 | friend class OMPClauseReader; |
4798 | |
4799 | |
4800 | SourceLocation LParenLoc; |
4801 | |
4802 | |
4803 | Stmt *NumTasks = nullptr; |
4804 | |
4805 | |
4806 | void setNumTasks(Expr *Size) { NumTasks = Size; } |
4807 | |
4808 | public: |
4809 | |
4810 | |
4811 | |
4812 | |
4813 | |
4814 | OMPNumTasksClause(Expr *Size, SourceLocation StartLoc, |
4815 | SourceLocation LParenLoc, SourceLocation EndLoc) |
4816 | : OMPClause(OMPC_num_tasks, StartLoc, EndLoc), LParenLoc(LParenLoc), |
4817 | NumTasks(Size) {} |
4818 | |
4819 | |
4820 | explicit OMPNumTasksClause() |
4821 | : OMPClause(OMPC_num_tasks, SourceLocation(), SourceLocation()) {} |
4822 | |
4823 | |
4824 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
4825 | |
4826 | |
4827 | SourceLocation getLParenLoc() const { return LParenLoc; } |
4828 | |
4829 | |
4830 | Expr *getNumTasks() const { return cast_or_null<Expr>(NumTasks); } |
4831 | |
4832 | child_range children() { return child_range(&NumTasks, &NumTasks + 1); } |
4833 | |
4834 | static bool classof(const OMPClause *T) { |
4835 | return T->getClauseKind() == OMPC_num_tasks; |
4836 | } |
4837 | }; |
4838 | |
4839 | |
4840 | |
4841 | |
4842 | |
4843 | |
4844 | |
4845 | |
4846 | class OMPHintClause : public OMPClause { |
4847 | friend class OMPClauseReader; |
4848 | |
4849 | |
4850 | SourceLocation LParenLoc; |
4851 | |
4852 | |
4853 | Stmt *Hint = nullptr; |
4854 | |
4855 | |
4856 | void setHint(Expr *H) { Hint = H; } |
4857 | |
4858 | public: |
4859 | |
4860 | |
4861 | |
4862 | |
4863 | |
4864 | |
4865 | OMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, |
4866 | SourceLocation EndLoc) |
4867 | : OMPClause(OMPC_hint, StartLoc, EndLoc), LParenLoc(LParenLoc), |
4868 | Hint(Hint) {} |
4869 | |
4870 | |
4871 | OMPHintClause() : OMPClause(OMPC_hint, SourceLocation(), SourceLocation()) {} |
4872 | |
4873 | |
4874 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
4875 | |
4876 | |
4877 | SourceLocation getLParenLoc() const { return LParenLoc; } |
4878 | |
4879 | |
4880 | Expr *getHint() const { return cast_or_null<Expr>(Hint); } |
4881 | |
4882 | child_range children() { return child_range(&Hint, &Hint + 1); } |
4883 | |
4884 | static bool classof(const OMPClause *T) { |
4885 | return T->getClauseKind() == OMPC_hint; |
4886 | } |
4887 | }; |
4888 | |
4889 | |
4890 | |
4891 | |
4892 | |
4893 | |
4894 | |
4895 | |
4896 | |
4897 | class OMPDistScheduleClause : public OMPClause, public OMPClauseWithPreInit { |
4898 | friend class OMPClauseReader; |
4899 | |
4900 | |
4901 | SourceLocation LParenLoc; |
4902 | |
4903 | |
4904 | OpenMPDistScheduleClauseKind Kind = OMPC_DIST_SCHEDULE_unknown; |
4905 | |
4906 | |
4907 | SourceLocation KindLoc; |
4908 | |
4909 | |
4910 | SourceLocation CommaLoc; |
4911 | |
4912 | |
4913 | Expr *ChunkSize = nullptr; |
4914 | |
4915 | |
4916 | |
4917 | |
4918 | void setDistScheduleKind(OpenMPDistScheduleClauseKind K) { Kind = K; } |
4919 | |
4920 | |
4921 | |
4922 | |
4923 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
4924 | |
4925 | |
4926 | |
4927 | |
4928 | void setDistScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; } |
4929 | |
4930 | |
4931 | |
4932 | |
4933 | void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; } |
4934 | |
4935 | |
4936 | |
4937 | |
4938 | void setChunkSize(Expr *E) { ChunkSize = E; } |
4939 | |
4940 | public: |
4941 | |
4942 | |
4943 | |
4944 | |
4945 | |
4946 | |
4947 | |
4948 | |
4949 | |
4950 | |
4951 | |
4952 | OMPDistScheduleClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
4953 | SourceLocation KLoc, SourceLocation CommaLoc, |
4954 | SourceLocation EndLoc, |
4955 | OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, |
4956 | Stmt *HelperChunkSize) |
4957 | : OMPClause(OMPC_dist_schedule, StartLoc, EndLoc), |
4958 | OMPClauseWithPreInit(this), LParenLoc(LParenLoc), Kind(Kind), |
4959 | KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) { |
4960 | setPreInitStmt(HelperChunkSize); |
4961 | } |
4962 | |
4963 | |
4964 | explicit OMPDistScheduleClause() |
4965 | : OMPClause(OMPC_dist_schedule, SourceLocation(), SourceLocation()), |
4966 | OMPClauseWithPreInit(this) {} |
4967 | |
4968 | |
4969 | OpenMPDistScheduleClauseKind getDistScheduleKind() const { return Kind; } |
4970 | |
4971 | |
4972 | SourceLocation getLParenLoc() { return LParenLoc; } |
4973 | |
4974 | |
4975 | SourceLocation getDistScheduleKindLoc() { return KindLoc; } |
4976 | |
4977 | |
4978 | SourceLocation getCommaLoc() { return CommaLoc; } |
4979 | |
4980 | |
4981 | Expr *getChunkSize() { return ChunkSize; } |
4982 | |
4983 | |
4984 | const Expr *getChunkSize() const { return ChunkSize; } |
4985 | |
4986 | child_range children() { |
4987 | return child_range(reinterpret_cast<Stmt **>(&ChunkSize), |
4988 | reinterpret_cast<Stmt **>(&ChunkSize) + 1); |
4989 | } |
4990 | |
4991 | static bool classof(const OMPClause *T) { |
4992 | return T->getClauseKind() == OMPC_dist_schedule; |
4993 | } |
4994 | }; |
4995 | |
4996 | |
4997 | |
4998 | |
4999 | |
5000 | |
5001 | |
5002 | |
5003 | class OMPDefaultmapClause : public OMPClause { |
5004 | friend class OMPClauseReader; |
5005 | |
5006 | |
5007 | SourceLocation LParenLoc; |
5008 | |
5009 | |
5010 | OpenMPDefaultmapClauseModifier Modifier = OMPC_DEFAULTMAP_MODIFIER_unknown; |
5011 | |
5012 | |
5013 | SourceLocation ModifierLoc; |
5014 | |
5015 | |
5016 | OpenMPDefaultmapClauseKind Kind = OMPC_DEFAULTMAP_unknown; |
5017 | |
5018 | |
5019 | SourceLocation KindLoc; |
5020 | |
5021 | |
5022 | |
5023 | |
5024 | void setDefaultmapKind(OpenMPDefaultmapClauseKind K) { Kind = K; } |
5025 | |
5026 | |
5027 | |
5028 | |
5029 | void setDefaultmapModifier(OpenMPDefaultmapClauseModifier M) { |
5030 | Modifier = M; |
5031 | } |
5032 | |
5033 | |
5034 | void setDefaultmapModifierLoc(SourceLocation Loc) { |
5035 | ModifierLoc = Loc; |
5036 | } |
5037 | |
5038 | |
5039 | |
5040 | |
5041 | void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } |
5042 | |
5043 | |
5044 | |
5045 | |
5046 | void setDefaultmapKindLoc(SourceLocation KLoc) { KindLoc = KLoc; } |
5047 | |
5048 | public: |
5049 | |
5050 | |
5051 | |
5052 | |
5053 | |
5054 | |
5055 | |
5056 | |
5057 | |
5058 | OMPDefaultmapClause(SourceLocation StartLoc, SourceLocation LParenLoc, |
5059 | SourceLocation MLoc, SourceLocation KLoc, |
5060 | SourceLocation EndLoc, OpenMPDefaultmapClauseKind Kind, |
5061 | OpenMPDefaultmapClauseModifier M) |
5062 | : OMPClause(OMPC_defaultmap, StartLoc, EndLoc), LParenLoc(LParenLoc), |
5063 | Modifier(M), ModifierLoc(MLoc), Kind(Kind), KindLoc(KLoc) {} |
5064 | |
5065 | |
5066 | explicit OMPDefaultmapClause() |
5067 | : OMPClause(OMPC_defaultmap, SourceLocation(), SourceLocation()) {} |
5068 | |
5069 | |
5070 | OpenMPDefaultmapClauseKind getDefaultmapKind() const { return Kind; } |
5071 | |
5072 | |
5073 | OpenMPDefaultmapClauseModifier getDefaultmapModifier() const { |
5074 | return Modifier; |
5075 | } |
5076 | |
5077 | |
5078 | SourceLocation getLParenLoc() { return LParenLoc; } |
5079 | |
5080 | |
5081 | SourceLocation getDefaultmapKindLoc() { return KindLoc; } |
5082 | |
5083 | |
5084 | SourceLocation getDefaultmapModifierLoc() const { |
5085 | return ModifierLoc; |
5086 | } |
5087 | |
5088 | child_range children() { |
5089 | return child_range(child_iterator(), child_iterator()); |
5090 | } |
5091 | |
5092 | static bool classof(const OMPClause *T) { |
5093 | return T->getClauseKind() == OMPC_defaultmap; |
5094 | } |
5095 | }; |
5096 | |
5097 | |
5098 | |
5099 | |
5100 | |
5101 | |
5102 | |
5103 | |
5104 | |
5105 | class OMPToClause final : public OMPMappableExprListClause<OMPToClause>, |
5106 | private llvm::TrailingObjects< |
5107 | OMPToClause, Expr *, ValueDecl *, unsigned, |
5108 | OMPClauseMappableExprCommon::MappableComponent> { |
5109 | friend class OMPClauseReader; |
5110 | friend OMPMappableExprListClause; |
5111 | friend OMPVarListClause; |
5112 | friend TrailingObjects; |
5113 | |
5114 | |
5115 | |
5116 | |
5117 | |
5118 | |
5119 | |
5120 | |
5121 | |
5122 | |
5123 | |
5124 | |
5125 | |
5126 | |
5127 | explicit OMPToClause(NestedNameSpecifierLoc MapperQualifierLoc, |
5128 | DeclarationNameInfo MapperIdInfo, |
5129 | const OMPVarListLocTy &Locs, |
5130 | const OMPMappableExprListSizeTy &Sizes) |
5131 | : OMPMappableExprListClause(OMPC_to, Locs, Sizes, &MapperQualifierLoc, |
5132 | &MapperIdInfo) {} |
5133 | |
5134 | |
5135 | |
5136 | |
5137 | |
5138 | |
5139 | |
5140 | |
5141 | explicit OMPToClause(const OMPMappableExprListSizeTy &Sizes) |
5142 | : OMPMappableExprListClause(OMPC_to, OMPVarListLocTy(), Sizes) {} |
5143 | |
5144 | |
5145 | |
5146 | size_t numTrailingObjects(OverloadToken<Expr *>) const { |
5147 | |
5148 | |
5149 | return 2 * varlist_size(); |
5150 | } |
5151 | size_t numTrailingObjects(OverloadToken<ValueDecl *>) const { |
5152 | return getUniqueDeclarationsNum(); |
5153 | } |
5154 | size_t numTrailingObjects(OverloadToken<unsigned>) const { |
5155 | return getUniqueDeclarationsNum() + getTotalComponentListNum(); |
5156 | } |
5157 | |
5158 | public: |
5159 | |
5160 | |
5161 | |
5162 | |
5163 | |
5164 | |
5165 | |
5166 | |
5167 | |
5168 | |
5169 | |
5170 | |
5171 | |
5172 | |
5173 | static OMPToClause *Create(const ASTContext &C, const OMPVarListLocTy &Locs, |
5174 | ArrayRef<Expr *> Vars, |
5175 | ArrayRef<ValueDecl *> Declarations, |
5176 | MappableExprComponentListsRef ComponentLists, |
5177 | ArrayRef<Expr *> UDMapperRefs, |
5178 | NestedNameSpecifierLoc UDMQualifierLoc, |
5179 | DeclarationNameInfo MapperId); |
5180 | |
5181 | |
5182 | |
5183 | |
5184 | |
5185 | |
5186 | |
5187 | |
5188 | |
5189 | static OMPToClause *CreateEmpty(const ASTContext &C, |
5190 | const OMPMappableExprListSizeTy &Sizes); |
5191 | |
5192 | child_range children() { |
5193 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
5194 | reinterpret_cast<Stmt **>(varlist_end())); |
5195 | } |
5196 | |
5197 | static bool classof(const OMPClause *T) { |
5198 | return T->getClauseKind() == OMPC_to; |
5199 | } |
5200 | }; |
5201 | |
5202 | |
5203 | |
5204 | |
5205 | |
5206 | |
5207 | |
5208 | |
5209 | |
5210 | class OMPFromClause final |
5211 | : public OMPMappableExprListClause<OMPFromClause>, |
5212 | private llvm::TrailingObjects< |
5213 | OMPFromClause, Expr *, ValueDecl *, unsigned, |
5214 | OMPClauseMappableExprCommon::MappableComponent> { |
5215 | friend class OMPClauseReader; |
5216 | friend OMPMappableExprListClause; |
5217 | friend OMPVarListClause; |
5218 | friend TrailingObjects; |
5219 | |
5220 | |
5221 | |
5222 | |
5223 | |
5224 | |
5225 | |
5226 | |
5227 | |
5228 | |
5229 | |
5230 | |
5231 | |
5232 | |
5233 | explicit OMPFromClause(NestedNameSpecifierLoc MapperQualifierLoc, |
5234 | DeclarationNameInfo MapperIdInfo, |
5235 | const OMPVarListLocTy &Locs, |
5236 | const OMPMappableExprListSizeTy &Sizes) |
5237 | : OMPMappableExprListClause(OMPC_from, Locs, Sizes, &MapperQualifierLoc, |
5238 | &MapperIdInfo) {} |
5239 | |
5240 | |
5241 | |
5242 | |
5243 | |
5244 | |
5245 | |
5246 | |
5247 | explicit OMPFromClause(const OMPMappableExprListSizeTy &Sizes) |
5248 | : OMPMappableExprListClause(OMPC_from, OMPVarListLocTy(), Sizes) {} |
5249 | |
5250 | |
5251 | |
5252 | size_t numTrailingObjects(OverloadToken<Expr *>) const { |
5253 | |
5254 | |
5255 | return 2 * varlist_size(); |
5256 | } |
5257 | size_t numTrailingObjects(OverloadToken<ValueDecl *>) const { |
5258 | return getUniqueDeclarationsNum(); |
5259 | } |
5260 | size_t numTrailingObjects(OverloadToken<unsigned>) const { |
5261 | return getUniqueDeclarationsNum() + getTotalComponentListNum(); |
5262 | } |
5263 | |
5264 | public: |
5265 | |
5266 | |
5267 | |
5268 | |
5269 | |
5270 | |
5271 | |
5272 | |
5273 | |
5274 | |
5275 | |
5276 | |
5277 | |
5278 | |
5279 | static OMPFromClause *Create(const ASTContext &C, const OMPVarListLocTy &Locs, |
5280 | ArrayRef<Expr *> Vars, |
5281 | ArrayRef<ValueDecl *> Declarations, |
5282 | MappableExprComponentListsRef ComponentLists, |
5283 | ArrayRef<Expr *> UDMapperRefs, |
5284 | NestedNameSpecifierLoc UDMQualifierLoc, |
5285 | DeclarationNameInfo MapperId); |
5286 | |
5287 | |
5288 | |
5289 | |
5290 | |
5291 | |
5292 | |
5293 | |
5294 | |
5295 | static OMPFromClause *CreateEmpty(const ASTContext &C, |
5296 | const OMPMappableExprListSizeTy &Sizes); |
5297 | |
5298 | child_range children() { |
5299 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
5300 | reinterpret_cast<Stmt **>(varlist_end())); |
5301 | } |
5302 | |
5303 | static bool classof(const OMPClause *T) { |
5304 | return T->getClauseKind() == OMPC_from; |
5305 | } |
5306 | }; |
5307 | |
5308 | |
5309 | |
5310 | |
5311 | |
5312 | |
5313 | |
5314 | |
5315 | |
5316 | class OMPUseDevicePtrClause final |
5317 | : public OMPMappableExprListClause<OMPUseDevicePtrClause>, |
5318 | private llvm::TrailingObjects< |
5319 | OMPUseDevicePtrClause, Expr *, ValueDecl *, unsigned, |
5320 | OMPClauseMappableExprCommon::MappableComponent> { |
5321 | friend class OMPClauseReader; |
5322 | friend OMPMappableExprListClause; |
5323 | friend OMPVarListClause; |
5324 | friend TrailingObjects; |
5325 | |
5326 | |
5327 | |
5328 | |
5329 | |
5330 | |
5331 | |
5332 | |
5333 | |
5334 | |
5335 | |
5336 | explicit OMPUseDevicePtrClause(const OMPVarListLocTy &Locs, |
5337 | const OMPMappableExprListSizeTy &Sizes) |
5338 | : OMPMappableExprListClause(OMPC_use_device_ptr, Locs, Sizes) {} |
5339 | |
5340 | |
5341 | |
5342 | |
5343 | |
5344 | |
5345 | |
5346 | |
5347 | explicit OMPUseDevicePtrClause(const OMPMappableExprListSizeTy &Sizes) |
5348 | : OMPMappableExprListClause(OMPC_use_device_ptr, OMPVarListLocTy(), |
5349 | Sizes) {} |
5350 | |
5351 | |
5352 | |
5353 | size_t numTrailingObjects(OverloadToken<Expr *>) const { |
5354 | return 3 * varlist_size(); |
5355 | } |
5356 | size_t numTrailingObjects(OverloadToken<ValueDecl *>) const { |
5357 | return getUniqueDeclarationsNum(); |
5358 | } |
5359 | size_t numTrailingObjects(OverloadToken<unsigned>) const { |
5360 | return getUniqueDeclarationsNum() + getTotalComponentListNum(); |
5361 | } |
5362 | |
5363 | |
5364 | |
5365 | |
5366 | void setPrivateCopies(ArrayRef<Expr *> VL); |
5367 | |
5368 | |
5369 | |
5370 | MutableArrayRef<Expr *> getPrivateCopies() { |
5371 | return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); |
5372 | } |
5373 | ArrayRef<const Expr *> getPrivateCopies() const { |
5374 | return llvm::makeArrayRef(varlist_end(), varlist_size()); |
5375 | } |
5376 | |
5377 | |
5378 | |
5379 | |
5380 | void setInits(ArrayRef<Expr *> VL); |
5381 | |
5382 | |
5383 | |
5384 | MutableArrayRef<Expr *> getInits() { |
5385 | return MutableArrayRef<Expr *>(getPrivateCopies().end(), varlist_size()); |
5386 | } |
5387 | ArrayRef<const Expr *> getInits() const { |
5388 | return llvm::makeArrayRef(getPrivateCopies().end(), varlist_size()); |
5389 | } |
5390 | |
5391 | public: |
5392 | |
5393 | |
5394 | |
5395 | |
5396 | |
5397 | |
5398 | |
5399 | |
5400 | |
5401 | |
5402 | |
5403 | static OMPUseDevicePtrClause * |
5404 | Create(const ASTContext &C, const OMPVarListLocTy &Locs, |
5405 | ArrayRef<Expr *> Vars, ArrayRef<Expr *> PrivateVars, |
5406 | ArrayRef<Expr *> Inits, ArrayRef<ValueDecl *> Declarations, |
5407 | MappableExprComponentListsRef ComponentLists); |
5408 | |
5409 | |
5410 | |
5411 | |
5412 | |
5413 | |
5414 | |
5415 | |
5416 | |
5417 | static OMPUseDevicePtrClause * |
5418 | CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes); |
5419 | |
5420 | using private_copies_iterator = MutableArrayRef<Expr *>::iterator; |
5421 | using private_copies_const_iterator = ArrayRef<const Expr *>::iterator; |
5422 | using private_copies_range = llvm::iterator_range<private_copies_iterator>; |
5423 | using private_copies_const_range = |
5424 | llvm::iterator_range<private_copies_const_iterator>; |
5425 | |
5426 | private_copies_range private_copies() { |
5427 | return private_copies_range(getPrivateCopies().begin(), |
5428 | getPrivateCopies().end()); |
5429 | } |
5430 | |
5431 | private_copies_const_range private_copies() const { |
5432 | return private_copies_const_range(getPrivateCopies().begin(), |
5433 | getPrivateCopies().end()); |
5434 | } |
5435 | |
5436 | using inits_iterator = MutableArrayRef<Expr *>::iterator; |
5437 | using inits_const_iterator = ArrayRef<const Expr *>::iterator; |
5438 | using inits_range = llvm::iterator_range<inits_iterator>; |
5439 | using inits_const_range = llvm::iterator_range<inits_const_iterator>; |
5440 | |
5441 | inits_range inits() { |
5442 | return inits_range(getInits().begin(), getInits().end()); |
5443 | } |
5444 | |
5445 | inits_const_range inits() const { |
5446 | return inits_const_range(getInits().begin(), getInits().end()); |
5447 | } |
5448 | |
5449 | child_range children() { |
5450 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
5451 | reinterpret_cast<Stmt **>(varlist_end())); |
5452 | } |
5453 | |
5454 | static bool classof(const OMPClause *T) { |
5455 | return T->getClauseKind() == OMPC_use_device_ptr; |
5456 | } |
5457 | }; |
5458 | |
5459 | |
5460 | |
5461 | |
5462 | |
5463 | |
5464 | |
5465 | |
5466 | |
5467 | class OMPIsDevicePtrClause final |
5468 | : public OMPMappableExprListClause<OMPIsDevicePtrClause>, |
5469 | private llvm::TrailingObjects< |
5470 | OMPIsDevicePtrClause, Expr *, ValueDecl *, unsigned, |
5471 | OMPClauseMappableExprCommon::MappableComponent> { |
5472 | friend class OMPClauseReader; |
5473 | friend OMPMappableExprListClause; |
5474 | friend OMPVarListClause; |
5475 | friend TrailingObjects; |
5476 | |
5477 | |
5478 | |
5479 | |
5480 | |
5481 | |
5482 | |
5483 | |
5484 | |
5485 | |
5486 | |
5487 | explicit OMPIsDevicePtrClause(const OMPVarListLocTy &Locs, |
5488 | const OMPMappableExprListSizeTy &Sizes) |
5489 | : OMPMappableExprListClause(OMPC_is_device_ptr, Locs, Sizes) {} |
5490 | |
5491 | |
5492 | |
5493 | |
5494 | |
5495 | |
5496 | |
5497 | |
5498 | explicit OMPIsDevicePtrClause(const OMPMappableExprListSizeTy &Sizes) |
5499 | : OMPMappableExprListClause(OMPC_is_device_ptr, OMPVarListLocTy(), |
5500 | Sizes) {} |
5501 | |
5502 | |
5503 | |
5504 | size_t numTrailingObjects(OverloadToken<Expr *>) const { |
5505 | return varlist_size(); |
5506 | } |
5507 | size_t numTrailingObjects(OverloadToken<ValueDecl *>) const { |
5508 | return getUniqueDeclarationsNum(); |
5509 | } |
5510 | size_t numTrailingObjects(OverloadToken<unsigned>) const { |
5511 | return getUniqueDeclarationsNum() + getTotalComponentListNum(); |
5512 | } |
5513 | |
5514 | public: |
5515 | |
5516 | |
5517 | |
5518 | |
5519 | |
5520 | |
5521 | |
5522 | |
5523 | |
5524 | static OMPIsDevicePtrClause * |
5525 | Create(const ASTContext &C, const OMPVarListLocTy &Locs, |
5526 | ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations, |
5527 | MappableExprComponentListsRef ComponentLists); |
5528 | |
5529 | |
5530 | |
5531 | |
5532 | |
5533 | |
5534 | |
5535 | |
5536 | |
5537 | static OMPIsDevicePtrClause * |
5538 | CreateEmpty(const ASTContext &C, const OMPMappableExprListSizeTy &Sizes); |
5539 | |
5540 | child_range children() { |
5541 | return child_range(reinterpret_cast<Stmt **>(varlist_begin()), |
5542 | reinterpret_cast<Stmt **>(varlist_end())); |
5543 | } |
5544 | |
5545 | static bool classof(const OMPClause *T) { |
5546 | return T->getClauseKind() == OMPC_is_device_ptr; |
5547 | } |
5548 | }; |
5549 | |
5550 | |
5551 | |
5552 | template<class ImplClass, template <typename> class Ptr, typename RetTy> |
5553 | class OMPClauseVisitorBase { |
5554 | public: |
5555 | #define PTR(CLASS) typename Ptr<CLASS>::type |
5556 | #define DISPATCH(CLASS) \ |
5557 | return static_cast<ImplClass*>(this)->Visit##CLASS(static_cast<PTR(CLASS)>(S)) |
5558 | |
5559 | #define OPENMP_CLAUSE(Name, Class) \ |
5560 | RetTy Visit ## Class (PTR(Class) S) { DISPATCH(Class); } |
5561 | #include "clang/Basic/OpenMPKinds.def" |
5562 | |
5563 | RetTy Visit(PTR(OMPClause) S) { |
5564 | |
5565 | switch (S->getClauseKind()) { |
5566 | default: llvm_unreachable("Unknown clause kind!"); |
5567 | #define OPENMP_CLAUSE(Name, Class) \ |
5568 | case OMPC_ ## Name : return Visit ## Class(static_cast<PTR(Class)>(S)); |
5569 | #include "clang/Basic/OpenMPKinds.def" |
5570 | } |
5571 | } |
5572 | |
5573 | RetTy VisitOMPClause(PTR(OMPClause) Node) { return RetTy(); } |
5574 | #undef PTR |
5575 | #undef DISPATCH |
5576 | }; |
5577 | |
5578 | template <typename T> |
5579 | using const_ptr = typename std::add_pointer<typename std::add_const<T>::type>; |
5580 | |
5581 | template<class ImplClass, typename RetTy = void> |
5582 | class OMPClauseVisitor : |
5583 | public OMPClauseVisitorBase <ImplClass, std::add_pointer, RetTy> {}; |
5584 | template<class ImplClass, typename RetTy = void> |
5585 | class ConstOMPClauseVisitor : |
5586 | public OMPClauseVisitorBase <ImplClass, const_ptr, RetTy> {}; |
5587 | |
5588 | class OMPClausePrinter final : public OMPClauseVisitor<OMPClausePrinter> { |
5589 | raw_ostream &OS; |
5590 | const PrintingPolicy &Policy; |
5591 | |
5592 | |
5593 | template <typename T> void VisitOMPClauseList(T *Node, char StartSym); |
5594 | |
5595 | public: |
5596 | OMPClausePrinter(raw_ostream &OS, const PrintingPolicy &Policy) |
5597 | : OS(OS), Policy(Policy) {} |
5598 | |
5599 | #define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *S); |
5600 | #include "clang/Basic/OpenMPKinds.def" |
5601 | }; |
5602 | |
5603 | } |
5604 | |
5605 | #endif |
5606 | |