1 //===- OpenMPClause.h - Classes for OpenMP clauses --------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 /// \brief This file defines OpenMP AST classes for clauses.
11 /// There are clauses for executable directives, clauses for declarative
12 /// directives and clauses which can be used in both kinds of directives.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_CLANG_AST_OPENMPCLAUSE_H
17 #define LLVM_CLANG_AST_OPENMPCLAUSE_H
19 #include "clang/AST/Expr.h"
20 #include "clang/AST/Stmt.h"
21 #include "clang/Basic/OpenMPKinds.h"
22 #include "clang/Basic/SourceLocation.h"
26 //===----------------------------------------------------------------------===//
27 // AST classes for clauses.
28 //===----------------------------------------------------------------------===//
30 /// \brief This is a basic class for representing single OpenMP clause.
33 /// \brief Starting location of the clause (the clause keyword).
34 SourceLocation StartLoc;
35 /// \brief Ending location of the clause.
36 SourceLocation EndLoc;
37 /// \brief Kind of the clause.
38 OpenMPClauseKind Kind;
41 OMPClause(OpenMPClauseKind K, SourceLocation StartLoc, SourceLocation EndLoc)
42 : StartLoc(StartLoc), EndLoc(EndLoc), Kind(K) {}
45 /// \brief Returns the starting location of the clause.
46 SourceLocation getLocStart() const { return StartLoc; }
47 /// \brief Returns the ending location of the clause.
48 SourceLocation getLocEnd() const { return EndLoc; }
50 /// \brief Sets the starting location of the clause.
51 void setLocStart(SourceLocation Loc) { StartLoc = Loc; }
52 /// \brief Sets the ending location of the clause.
53 void setLocEnd(SourceLocation Loc) { EndLoc = Loc; }
55 /// \brief Returns kind of OpenMP clause (private, shared, reduction, etc.).
56 OpenMPClauseKind getClauseKind() const { return Kind; }
58 bool isImplicit() const { return StartLoc.isInvalid(); }
61 ConstStmtRange children() const {
62 return const_cast<OMPClause *>(this)->children();
64 static bool classof(const OMPClause *T) { return true; }
67 /// \brief This represents clauses with the list of variables like 'private',
68 /// 'firstprivate', 'copyin', 'shared', or 'reduction' clauses in the
69 /// '#pragma omp ...' directives.
70 template <class T> class OMPVarListClause : public OMPClause {
71 friend class OMPClauseReader;
72 /// \brief Location of '('.
73 SourceLocation LParenLoc;
74 /// \brief Number of variables in the list.
78 /// \brief Fetches list of variables associated with this clause.
79 MutableArrayRef<Expr *> getVarRefs() {
80 return MutableArrayRef<Expr *>(
81 reinterpret_cast<Expr **>(
82 reinterpret_cast<char *>(this) +
83 llvm::RoundUpToAlignment(sizeof(T), llvm::alignOf<Expr *>())),
87 /// \brief Sets the list of variables for this clause.
88 void setVarRefs(ArrayRef<Expr *> VL) {
89 assert(VL.size() == NumVars &&
90 "Number of variables is not the same as the preallocated buffer");
93 reinterpret_cast<Expr **>(
94 reinterpret_cast<char *>(this) +
95 llvm::RoundUpToAlignment(sizeof(T), llvm::alignOf<Expr *>())));
98 /// \brief Build a clause with \a N variables
100 /// \param K Kind of the clause.
101 /// \param StartLoc Starting location of the clause (the clause keyword).
102 /// \param LParenLoc Location of '('.
103 /// \param EndLoc Ending location of the clause.
104 /// \param N Number of the variables in the clause.
106 OMPVarListClause(OpenMPClauseKind K, SourceLocation StartLoc,
107 SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N)
108 : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
111 typedef MutableArrayRef<Expr *>::iterator varlist_iterator;
112 typedef ArrayRef<const Expr *>::iterator varlist_const_iterator;
113 typedef llvm::iterator_range<varlist_iterator> varlist_range;
114 typedef llvm::iterator_range<varlist_const_iterator> varlist_const_range;
116 unsigned varlist_size() const { return NumVars; }
117 bool varlist_empty() const { return NumVars == 0; }
119 varlist_range varlists() {
120 return varlist_range(varlist_begin(), varlist_end());
122 varlist_const_range varlists() const {
123 return varlist_const_range(varlist_begin(), varlist_end());
126 varlist_iterator varlist_begin() { return getVarRefs().begin(); }
127 varlist_iterator varlist_end() { return getVarRefs().end(); }
128 varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
129 varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
131 /// \brief Sets the location of '('.
132 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
133 /// \brief Returns the location of '('.
134 SourceLocation getLParenLoc() const { return LParenLoc; }
136 /// \brief Fetches list of all variables in the clause.
137 ArrayRef<const Expr *> getVarRefs() const {
138 return ArrayRef<const Expr *>(
139 reinterpret_cast<const Expr *const *>(
140 reinterpret_cast<const char *>(this) +
141 llvm::RoundUpToAlignment(sizeof(T), llvm::alignOf<Expr *>())),
146 /// \brief This represents 'if' clause in the '#pragma omp ...' directive.
149 /// #pragma omp parallel if(a > 5)
151 /// In this example directive '#pragma omp parallel' has simple 'if'
152 /// clause with condition 'a > 5'.
154 class OMPIfClause : public OMPClause {
155 friend class OMPClauseReader;
156 /// \brief Location of '('.
157 SourceLocation LParenLoc;
158 /// \brief Condition of the 'if' clause.
161 /// \brief Set condition.
163 void setCondition(Expr *Cond) { Condition = Cond; }
166 /// \brief Build 'if' clause with condition \a Cond.
168 /// \param StartLoc Starting location of the clause.
169 /// \param LParenLoc Location of '('.
170 /// \param Cond Condition of the clause.
171 /// \param EndLoc Ending location of the clause.
173 OMPIfClause(Expr *Cond, SourceLocation StartLoc, SourceLocation LParenLoc,
174 SourceLocation EndLoc)
175 : OMPClause(OMPC_if, StartLoc, EndLoc), LParenLoc(LParenLoc),
178 /// \brief Build an empty clause.
181 : OMPClause(OMPC_if, SourceLocation(), SourceLocation()),
182 LParenLoc(SourceLocation()), Condition(nullptr) {}
184 /// \brief Sets the location of '('.
185 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
186 /// \brief Returns the location of '('.
187 SourceLocation getLParenLoc() const { return LParenLoc; }
189 /// \brief Returns condition.
190 Expr *getCondition() const { return cast_or_null<Expr>(Condition); }
192 static bool classof(const OMPClause *T) {
193 return T->getClauseKind() == OMPC_if;
196 StmtRange children() { return StmtRange(&Condition, &Condition + 1); }
199 /// \brief This represents 'final' clause in the '#pragma omp ...' directive.
202 /// #pragma omp task final(a > 5)
204 /// In this example directive '#pragma omp task' has simple 'final'
205 /// clause with condition 'a > 5'.
207 class OMPFinalClause : public OMPClause {
208 friend class OMPClauseReader;
209 /// \brief Location of '('.
210 SourceLocation LParenLoc;
211 /// \brief Condition of the 'if' clause.
214 /// \brief Set condition.
216 void setCondition(Expr *Cond) { Condition = Cond; }
219 /// \brief Build 'final' clause with condition \a Cond.
221 /// \param StartLoc Starting location of the clause.
222 /// \param LParenLoc Location of '('.
223 /// \param Cond Condition of the clause.
224 /// \param EndLoc Ending location of the clause.
226 OMPFinalClause(Expr *Cond, SourceLocation StartLoc, SourceLocation LParenLoc,
227 SourceLocation EndLoc)
228 : OMPClause(OMPC_final, StartLoc, EndLoc), LParenLoc(LParenLoc),
231 /// \brief Build an empty clause.
234 : OMPClause(OMPC_final, SourceLocation(), SourceLocation()),
235 LParenLoc(SourceLocation()), Condition(nullptr) {}
237 /// \brief Sets the location of '('.
238 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
239 /// \brief Returns the location of '('.
240 SourceLocation getLParenLoc() const { return LParenLoc; }
242 /// \brief Returns condition.
243 Expr *getCondition() const { return cast_or_null<Expr>(Condition); }
245 static bool classof(const OMPClause *T) {
246 return T->getClauseKind() == OMPC_final;
249 StmtRange children() { return StmtRange(&Condition, &Condition + 1); }
252 /// \brief This represents 'num_threads' clause in the '#pragma omp ...'
256 /// #pragma omp parallel num_threads(6)
258 /// In this example directive '#pragma omp parallel' has simple 'num_threads'
259 /// clause with number of threads '6'.
261 class OMPNumThreadsClause : public OMPClause {
262 friend class OMPClauseReader;
263 /// \brief Location of '('.
264 SourceLocation LParenLoc;
265 /// \brief Condition of the 'num_threads' clause.
268 /// \brief Set condition.
270 void setNumThreads(Expr *NThreads) { NumThreads = NThreads; }
273 /// \brief Build 'num_threads' clause with condition \a NumThreads.
275 /// \param NumThreads Number of threads for the construct.
276 /// \param StartLoc Starting location of the clause.
277 /// \param LParenLoc Location of '('.
278 /// \param EndLoc Ending location of the clause.
280 OMPNumThreadsClause(Expr *NumThreads, SourceLocation StartLoc,
281 SourceLocation LParenLoc, SourceLocation EndLoc)
282 : OMPClause(OMPC_num_threads, StartLoc, EndLoc), LParenLoc(LParenLoc),
283 NumThreads(NumThreads) {}
285 /// \brief Build an empty clause.
287 OMPNumThreadsClause()
288 : OMPClause(OMPC_num_threads, SourceLocation(), SourceLocation()),
289 LParenLoc(SourceLocation()), NumThreads(nullptr) {}
291 /// \brief Sets the location of '('.
292 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
293 /// \brief Returns the location of '('.
294 SourceLocation getLParenLoc() const { return LParenLoc; }
296 /// \brief Returns number of threads.
297 Expr *getNumThreads() const { return cast_or_null<Expr>(NumThreads); }
299 static bool classof(const OMPClause *T) {
300 return T->getClauseKind() == OMPC_num_threads;
303 StmtRange children() { return StmtRange(&NumThreads, &NumThreads + 1); }
306 /// \brief This represents 'safelen' clause in the '#pragma omp ...'
310 /// #pragma omp simd safelen(4)
312 /// In this example directive '#pragma omp simd' has clause 'safelen'
313 /// with single expression '4'.
314 /// If the safelen clause is used then no two iterations executed
315 /// concurrently with SIMD instructions can have a greater distance
316 /// in the logical iteration space than its value. The parameter of
317 /// the safelen clause must be a constant positive integer expression.
319 class OMPSafelenClause : public OMPClause {
320 friend class OMPClauseReader;
321 /// \brief Location of '('.
322 SourceLocation LParenLoc;
323 /// \brief Safe iteration space distance.
326 /// \brief Set safelen.
327 void setSafelen(Expr *Len) { Safelen = Len; }
330 /// \brief Build 'safelen' clause.
332 /// \param Len Expression associated with this clause.
333 /// \param StartLoc Starting location of the clause.
334 /// \param EndLoc Ending location of the clause.
336 OMPSafelenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc,
337 SourceLocation EndLoc)
338 : OMPClause(OMPC_safelen, StartLoc, EndLoc), LParenLoc(LParenLoc),
341 /// \brief Build an empty clause.
343 explicit OMPSafelenClause()
344 : OMPClause(OMPC_safelen, SourceLocation(), SourceLocation()),
345 LParenLoc(SourceLocation()), Safelen(nullptr) {}
347 /// \brief Sets the location of '('.
348 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
349 /// \brief Returns the location of '('.
350 SourceLocation getLParenLoc() const { return LParenLoc; }
352 /// \brief Return safe iteration space distance.
353 Expr *getSafelen() const { return cast_or_null<Expr>(Safelen); }
355 static bool classof(const OMPClause *T) {
356 return T->getClauseKind() == OMPC_safelen;
359 StmtRange children() { return StmtRange(&Safelen, &Safelen + 1); }
362 /// \brief This represents 'collapse' clause in the '#pragma omp ...'
366 /// #pragma omp simd collapse(3)
368 /// In this example directive '#pragma omp simd' has clause 'collapse'
369 /// with single expression '3'.
370 /// The parameter must be a constant positive integer expression, it specifies
371 /// the number of nested loops that should be collapsed into a single iteration
374 class OMPCollapseClause : public OMPClause {
375 friend class OMPClauseReader;
376 /// \brief Location of '('.
377 SourceLocation LParenLoc;
378 /// \brief Number of for-loops.
381 /// \brief Set the number of associated for-loops.
382 void setNumForLoops(Expr *Num) { NumForLoops = Num; }
385 /// \brief Build 'collapse' clause.
387 /// \param Num Expression associated with this clause.
388 /// \param StartLoc Starting location of the clause.
389 /// \param LParenLoc Location of '('.
390 /// \param EndLoc Ending location of the clause.
392 OMPCollapseClause(Expr *Num, SourceLocation StartLoc,
393 SourceLocation LParenLoc, SourceLocation EndLoc)
394 : OMPClause(OMPC_collapse, StartLoc, EndLoc), LParenLoc(LParenLoc),
397 /// \brief Build an empty clause.
399 explicit OMPCollapseClause()
400 : OMPClause(OMPC_collapse, SourceLocation(), SourceLocation()),
401 LParenLoc(SourceLocation()), NumForLoops(nullptr) {}
403 /// \brief Sets the location of '('.
404 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
405 /// \brief Returns the location of '('.
406 SourceLocation getLParenLoc() const { return LParenLoc; }
408 /// \brief Return the number of associated for-loops.
409 Expr *getNumForLoops() const { return cast_or_null<Expr>(NumForLoops); }
411 static bool classof(const OMPClause *T) {
412 return T->getClauseKind() == OMPC_collapse;
415 StmtRange children() { return StmtRange(&NumForLoops, &NumForLoops + 1); }
418 /// \brief This represents 'default' clause in the '#pragma omp ...' directive.
421 /// #pragma omp parallel default(shared)
423 /// In this example directive '#pragma omp parallel' has simple 'default'
424 /// clause with kind 'shared'.
426 class OMPDefaultClause : public OMPClause {
427 friend class OMPClauseReader;
428 /// \brief Location of '('.
429 SourceLocation LParenLoc;
430 /// \brief A kind of the 'default' clause.
431 OpenMPDefaultClauseKind Kind;
432 /// \brief Start location of the kind in source code.
433 SourceLocation KindKwLoc;
435 /// \brief Set kind of the clauses.
437 /// \param K Argument of clause.
439 void setDefaultKind(OpenMPDefaultClauseKind K) { Kind = K; }
441 /// \brief Set argument location.
443 /// \param KLoc Argument location.
445 void setDefaultKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
448 /// \brief Build 'default' clause with argument \a A ('none' or 'shared').
450 /// \param A Argument of the clause ('none' or 'shared').
451 /// \param ALoc Starting location of the argument.
452 /// \param StartLoc Starting location of the clause.
453 /// \param LParenLoc Location of '('.
454 /// \param EndLoc Ending location of the clause.
456 OMPDefaultClause(OpenMPDefaultClauseKind A, SourceLocation ALoc,
457 SourceLocation StartLoc, SourceLocation LParenLoc,
458 SourceLocation EndLoc)
459 : OMPClause(OMPC_default, StartLoc, EndLoc), LParenLoc(LParenLoc),
460 Kind(A), KindKwLoc(ALoc) {}
462 /// \brief Build an empty clause.
465 : OMPClause(OMPC_default, SourceLocation(), SourceLocation()),
466 LParenLoc(SourceLocation()), Kind(OMPC_DEFAULT_unknown),
467 KindKwLoc(SourceLocation()) {}
469 /// \brief Sets the location of '('.
470 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
471 /// \brief Returns the location of '('.
472 SourceLocation getLParenLoc() const { return LParenLoc; }
474 /// \brief Returns kind of the clause.
475 OpenMPDefaultClauseKind getDefaultKind() const { return Kind; }
477 /// \brief Returns location of clause kind.
478 SourceLocation getDefaultKindKwLoc() const { return KindKwLoc; }
480 static bool classof(const OMPClause *T) {
481 return T->getClauseKind() == OMPC_default;
484 StmtRange children() { return StmtRange(); }
487 /// \brief This represents 'proc_bind' clause in the '#pragma omp ...'
491 /// #pragma omp parallel proc_bind(master)
493 /// In this example directive '#pragma omp parallel' has simple 'proc_bind'
494 /// clause with kind 'master'.
496 class OMPProcBindClause : public OMPClause {
497 friend class OMPClauseReader;
498 /// \brief Location of '('.
499 SourceLocation LParenLoc;
500 /// \brief A kind of the 'proc_bind' clause.
501 OpenMPProcBindClauseKind Kind;
502 /// \brief Start location of the kind in source code.
503 SourceLocation KindKwLoc;
505 /// \brief Set kind of the clause.
507 /// \param K Kind of clause.
509 void setProcBindKind(OpenMPProcBindClauseKind K) { Kind = K; }
511 /// \brief Set clause kind location.
513 /// \param KLoc Kind location.
515 void setProcBindKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
518 /// \brief Build 'proc_bind' clause with argument \a A ('master', 'close' or
521 /// \param A Argument of the clause ('master', 'close' or 'spread').
522 /// \param ALoc Starting location of the argument.
523 /// \param StartLoc Starting location of the clause.
524 /// \param LParenLoc Location of '('.
525 /// \param EndLoc Ending location of the clause.
527 OMPProcBindClause(OpenMPProcBindClauseKind A, SourceLocation ALoc,
528 SourceLocation StartLoc, SourceLocation LParenLoc,
529 SourceLocation EndLoc)
530 : OMPClause(OMPC_proc_bind, StartLoc, EndLoc), LParenLoc(LParenLoc),
531 Kind(A), KindKwLoc(ALoc) {}
533 /// \brief Build an empty clause.
536 : OMPClause(OMPC_proc_bind, SourceLocation(), SourceLocation()),
537 LParenLoc(SourceLocation()), Kind(OMPC_PROC_BIND_unknown),
538 KindKwLoc(SourceLocation()) {}
540 /// \brief Sets the location of '('.
541 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
542 /// \brief Returns the location of '('.
543 SourceLocation getLParenLoc() const { return LParenLoc; }
545 /// \brief Returns kind of the clause.
546 OpenMPProcBindClauseKind getProcBindKind() const { return Kind; }
548 /// \brief Returns location of clause kind.
549 SourceLocation getProcBindKindKwLoc() const { return KindKwLoc; }
551 static bool classof(const OMPClause *T) {
552 return T->getClauseKind() == OMPC_proc_bind;
555 StmtRange children() { return StmtRange(); }
558 /// \brief This represents 'schedule' clause in the '#pragma omp ...' directive.
561 /// #pragma omp for schedule(static, 3)
563 /// In this example directive '#pragma omp for' has 'schedule' clause with
564 /// arguments 'static' and '3'.
566 class OMPScheduleClause : public OMPClause {
567 friend class OMPClauseReader;
568 /// \brief Location of '('.
569 SourceLocation LParenLoc;
570 /// \brief A kind of the 'schedule' clause.
571 OpenMPScheduleClauseKind Kind;
572 /// \brief Start location of the schedule ind in source code.
573 SourceLocation KindLoc;
574 /// \brief Location of ',' (if any).
575 SourceLocation CommaLoc;
576 /// \brief Chunk size.
579 /// \brief Set schedule kind.
581 /// \param K Schedule kind.
583 void setScheduleKind(OpenMPScheduleClauseKind K) { Kind = K; }
584 /// \brief Sets the location of '('.
586 /// \param Loc Location of '('.
588 void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
589 /// \brief Set schedule kind start location.
591 /// \param KLoc Schedule kind location.
593 void setScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
594 /// \brief Set location of ','.
596 /// \param Loc Location of ','.
598 void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; }
599 /// \brief Set chunk size.
601 /// \param E Chunk size.
603 void setChunkSize(Expr *E) { ChunkSize = E; }
606 /// \brief Build 'schedule' clause with schedule kind \a Kind and chunk size
607 /// expression \a ChunkSize.
609 /// \param StartLoc Starting location of the clause.
610 /// \param LParenLoc Location of '('.
611 /// \param KLoc Starting location of the argument.
612 /// \param CommaLoc Location of ','.
613 /// \param EndLoc Ending location of the clause.
614 /// \param Kind Schedule kind.
615 /// \param ChunkSize Chunk size.
617 OMPScheduleClause(SourceLocation StartLoc, SourceLocation LParenLoc,
618 SourceLocation KLoc, SourceLocation CommaLoc,
619 SourceLocation EndLoc, OpenMPScheduleClauseKind Kind,
621 : OMPClause(OMPC_schedule, StartLoc, EndLoc), LParenLoc(LParenLoc),
622 Kind(Kind), KindLoc(KLoc), CommaLoc(CommaLoc), ChunkSize(ChunkSize) {}
624 /// \brief Build an empty clause.
626 explicit OMPScheduleClause()
627 : OMPClause(OMPC_schedule, SourceLocation(), SourceLocation()),
628 Kind(OMPC_SCHEDULE_unknown), ChunkSize(nullptr) {}
630 /// \brief Get kind of the clause.
632 OpenMPScheduleClauseKind getScheduleKind() const { return Kind; }
633 /// \brief Get location of '('.
635 SourceLocation getLParenLoc() { return LParenLoc; }
636 /// \brief Get kind location.
638 SourceLocation getScheduleKindLoc() { return KindLoc; }
639 /// \brief Get location of ','.
641 SourceLocation getCommaLoc() { return CommaLoc; }
642 /// \brief Get chunk size.
644 Expr *getChunkSize() { return dyn_cast_or_null<Expr>(ChunkSize); }
645 /// \brief Get chunk size.
647 Expr *getChunkSize() const { return dyn_cast_or_null<Expr>(ChunkSize); }
649 static bool classof(const OMPClause *T) {
650 return T->getClauseKind() == OMPC_schedule;
653 StmtRange children() { return StmtRange(&ChunkSize, &ChunkSize + 1); }
656 /// \brief This represents 'ordered' clause in the '#pragma omp ...' directive.
659 /// #pragma omp for ordered
661 /// In this example directive '#pragma omp for' has 'ordered' clause.
663 class OMPOrderedClause : public OMPClause {
665 /// \brief Build 'ordered' clause.
667 /// \param StartLoc Starting location of the clause.
668 /// \param EndLoc Ending location of the clause.
670 OMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc)
671 : OMPClause(OMPC_ordered, StartLoc, EndLoc) {}
673 /// \brief Build an empty clause.
676 : OMPClause(OMPC_ordered, SourceLocation(), SourceLocation()) {}
678 static bool classof(const OMPClause *T) {
679 return T->getClauseKind() == OMPC_ordered;
682 StmtRange children() { return StmtRange(); }
685 /// \brief This represents 'nowait' clause in the '#pragma omp ...' directive.
688 /// #pragma omp for nowait
690 /// In this example directive '#pragma omp for' has 'nowait' clause.
692 class OMPNowaitClause : public OMPClause {
694 /// \brief Build 'nowait' clause.
696 /// \param StartLoc Starting location of the clause.
697 /// \param EndLoc Ending location of the clause.
699 OMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc)
700 : OMPClause(OMPC_nowait, StartLoc, EndLoc) {}
702 /// \brief Build an empty clause.
705 : OMPClause(OMPC_nowait, SourceLocation(), SourceLocation()) {}
707 static bool classof(const OMPClause *T) {
708 return T->getClauseKind() == OMPC_nowait;
711 StmtRange children() { return StmtRange(); }
714 /// \brief This represents 'untied' clause in the '#pragma omp ...' directive.
717 /// #pragma omp task untied
719 /// In this example directive '#pragma omp task' has 'untied' clause.
721 class OMPUntiedClause : public OMPClause {
723 /// \brief Build 'untied' clause.
725 /// \param StartLoc Starting location of the clause.
726 /// \param EndLoc Ending location of the clause.
728 OMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc)
729 : OMPClause(OMPC_untied, StartLoc, EndLoc) {}
731 /// \brief Build an empty clause.
734 : OMPClause(OMPC_untied, SourceLocation(), SourceLocation()) {}
736 static bool classof(const OMPClause *T) {
737 return T->getClauseKind() == OMPC_untied;
740 StmtRange children() { return StmtRange(); }
743 /// \brief This represents 'mergeable' clause in the '#pragma omp ...'
747 /// #pragma omp task mergeable
749 /// In this example directive '#pragma omp task' has 'mergeable' clause.
751 class OMPMergeableClause : public OMPClause {
753 /// \brief Build 'mergeable' clause.
755 /// \param StartLoc Starting location of the clause.
756 /// \param EndLoc Ending location of the clause.
758 OMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc)
759 : OMPClause(OMPC_mergeable, StartLoc, EndLoc) {}
761 /// \brief Build an empty clause.
764 : OMPClause(OMPC_mergeable, SourceLocation(), SourceLocation()) {}
766 static bool classof(const OMPClause *T) {
767 return T->getClauseKind() == OMPC_mergeable;
770 StmtRange children() { return StmtRange(); }
773 /// \brief This represents clause 'private' in the '#pragma omp ...' directives.
776 /// #pragma omp parallel private(a,b)
778 /// In this example directive '#pragma omp parallel' has clause 'private'
779 /// with the variables 'a' and 'b'.
781 class OMPPrivateClause : public OMPVarListClause<OMPPrivateClause> {
782 /// \brief Build clause with number of variables \a N.
784 /// \param StartLoc Starting location of the clause.
785 /// \param LParenLoc Location of '('.
786 /// \param EndLoc Ending location of the clause.
787 /// \param N Number of the variables in the clause.
789 OMPPrivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
790 SourceLocation EndLoc, unsigned N)
791 : OMPVarListClause<OMPPrivateClause>(OMPC_private, StartLoc, LParenLoc,
794 /// \brief Build an empty clause.
796 /// \param N Number of variables.
798 explicit OMPPrivateClause(unsigned N)
799 : OMPVarListClause<OMPPrivateClause>(OMPC_private, SourceLocation(),
800 SourceLocation(), SourceLocation(),
804 /// \brief Creates clause with a list of variables \a VL.
806 /// \param C AST context.
807 /// \param StartLoc Starting location of the clause.
808 /// \param LParenLoc Location of '('.
809 /// \param EndLoc Ending location of the clause.
810 /// \param VL List of references to the variables.
812 static OMPPrivateClause *Create(const ASTContext &C, SourceLocation StartLoc,
813 SourceLocation LParenLoc,
814 SourceLocation EndLoc, ArrayRef<Expr *> VL);
815 /// \brief Creates an empty clause with the place for \a N variables.
817 /// \param C AST context.
818 /// \param N The number of variables.
820 static OMPPrivateClause *CreateEmpty(const ASTContext &C, unsigned N);
822 StmtRange children() {
823 return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
824 reinterpret_cast<Stmt **>(varlist_end()));
827 static bool classof(const OMPClause *T) {
828 return T->getClauseKind() == OMPC_private;
832 /// \brief This represents clause 'firstprivate' in the '#pragma omp ...'
836 /// #pragma omp parallel firstprivate(a,b)
838 /// In this example directive '#pragma omp parallel' has clause 'firstprivate'
839 /// with the variables 'a' and 'b'.
841 class OMPFirstprivateClause : public OMPVarListClause<OMPFirstprivateClause> {
842 /// \brief Build clause with number of variables \a N.
844 /// \param StartLoc Starting location of the clause.
845 /// \param LParenLoc Location of '('.
846 /// \param EndLoc Ending location of the clause.
847 /// \param N Number of the variables in the clause.
849 OMPFirstprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
850 SourceLocation EndLoc, unsigned N)
851 : OMPVarListClause<OMPFirstprivateClause>(OMPC_firstprivate, StartLoc,
852 LParenLoc, EndLoc, N) {}
854 /// \brief Build an empty clause.
856 /// \param N Number of variables.
858 explicit OMPFirstprivateClause(unsigned N)
859 : OMPVarListClause<OMPFirstprivateClause>(
860 OMPC_firstprivate, SourceLocation(), SourceLocation(),
861 SourceLocation(), N) {}
864 /// \brief Creates clause with a list of variables \a VL.
866 /// \param C AST context.
867 /// \param StartLoc Starting location of the clause.
868 /// \param LParenLoc Location of '('.
869 /// \param EndLoc Ending location of the clause.
870 /// \param VL List of references to the variables.
872 static OMPFirstprivateClause *
873 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
874 SourceLocation EndLoc, ArrayRef<Expr *> VL);
875 /// \brief Creates an empty clause with the place for \a N variables.
877 /// \param C AST context.
878 /// \param N The number of variables.
880 static OMPFirstprivateClause *CreateEmpty(const ASTContext &C, unsigned N);
882 StmtRange children() {
883 return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
884 reinterpret_cast<Stmt **>(varlist_end()));
887 static bool classof(const OMPClause *T) {
888 return T->getClauseKind() == OMPC_firstprivate;
892 /// \brief This represents clause 'lastprivate' in the '#pragma omp ...'
896 /// #pragma omp simd lastprivate(a,b)
898 /// In this example directive '#pragma omp simd' has clause 'lastprivate'
899 /// with the variables 'a' and 'b'.
901 class OMPLastprivateClause : public OMPVarListClause<OMPLastprivateClause> {
902 /// \brief Build clause with number of variables \a N.
904 /// \param StartLoc Starting location of the clause.
905 /// \param LParenLoc Location of '('.
906 /// \param EndLoc Ending location of the clause.
907 /// \param N Number of the variables in the clause.
909 OMPLastprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
910 SourceLocation EndLoc, unsigned N)
911 : OMPVarListClause<OMPLastprivateClause>(OMPC_lastprivate, StartLoc,
912 LParenLoc, EndLoc, N) {}
914 /// \brief Build an empty clause.
916 /// \param N Number of variables.
918 explicit OMPLastprivateClause(unsigned N)
919 : OMPVarListClause<OMPLastprivateClause>(
920 OMPC_lastprivate, SourceLocation(), SourceLocation(),
921 SourceLocation(), N) {}
924 /// \brief Creates clause with a list of variables \a VL.
926 /// \param C AST context.
927 /// \param StartLoc Starting location of the clause.
928 /// \param LParenLoc Location of '('.
929 /// \param EndLoc Ending location of the clause.
930 /// \param VL List of references to the variables.
932 static OMPLastprivateClause *
933 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
934 SourceLocation EndLoc, ArrayRef<Expr *> VL);
935 /// \brief Creates an empty clause with the place for \a N variables.
937 /// \param C AST context.
938 /// \param N The number of variables.
940 static OMPLastprivateClause *CreateEmpty(const ASTContext &C, unsigned N);
942 StmtRange children() {
943 return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
944 reinterpret_cast<Stmt **>(varlist_end()));
947 static bool classof(const OMPClause *T) {
948 return T->getClauseKind() == OMPC_lastprivate;
952 /// \brief This represents clause 'shared' in the '#pragma omp ...' directives.
955 /// #pragma omp parallel shared(a,b)
957 /// In this example directive '#pragma omp parallel' has clause 'shared'
958 /// with the variables 'a' and 'b'.
960 class OMPSharedClause : public OMPVarListClause<OMPSharedClause> {
961 /// \brief Build clause with number of variables \a N.
963 /// \param StartLoc Starting location of the clause.
964 /// \param LParenLoc Location of '('.
965 /// \param EndLoc Ending location of the clause.
966 /// \param N Number of the variables in the clause.
968 OMPSharedClause(SourceLocation StartLoc, SourceLocation LParenLoc,
969 SourceLocation EndLoc, unsigned N)
970 : OMPVarListClause<OMPSharedClause>(OMPC_shared, StartLoc, LParenLoc,
973 /// \brief Build an empty clause.
975 /// \param N Number of variables.
977 explicit OMPSharedClause(unsigned N)
978 : OMPVarListClause<OMPSharedClause>(OMPC_shared, SourceLocation(),
979 SourceLocation(), SourceLocation(),
983 /// \brief Creates clause with a list of variables \a VL.
985 /// \param C AST context.
986 /// \param StartLoc Starting location of the clause.
987 /// \param LParenLoc Location of '('.
988 /// \param EndLoc Ending location of the clause.
989 /// \param VL List of references to the variables.
991 static OMPSharedClause *Create(const ASTContext &C, SourceLocation StartLoc,
992 SourceLocation LParenLoc,
993 SourceLocation EndLoc, ArrayRef<Expr *> VL);
994 /// \brief Creates an empty clause with \a N variables.
996 /// \param C AST context.
997 /// \param N The number of variables.
999 static OMPSharedClause *CreateEmpty(const ASTContext &C, unsigned N);
1001 StmtRange children() {
1002 return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
1003 reinterpret_cast<Stmt **>(varlist_end()));
1006 static bool classof(const OMPClause *T) {
1007 return T->getClauseKind() == OMPC_shared;
1011 /// \brief This represents clause 'reduction' in the '#pragma omp ...'
1015 /// #pragma omp parallel reduction(+:a,b)
1017 /// In this example directive '#pragma omp parallel' has clause 'reduction'
1018 /// with operator '+' and the variables 'a' and 'b'.
1020 class OMPReductionClause : public OMPVarListClause<OMPReductionClause> {
1021 friend class OMPClauseReader;
1022 /// \brief Location of ':'.
1023 SourceLocation ColonLoc;
1024 /// \brief Nested name specifier for C++.
1025 NestedNameSpecifierLoc QualifierLoc;
1026 /// \brief Name of custom operator.
1027 DeclarationNameInfo NameInfo;
1029 /// \brief Build clause with number of variables \a N.
1031 /// \param StartLoc Starting location of the clause.
1032 /// \param LParenLoc Location of '('.
1033 /// \param EndLoc Ending location of the clause.
1034 /// \param ColonLoc Location of ':'.
1035 /// \param N Number of the variables in the clause.
1036 /// \param QualifierLoc The nested-name qualifier with location information
1037 /// \param NameInfo The full name info for reduction identifier.
1039 OMPReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
1040 SourceLocation ColonLoc, SourceLocation EndLoc, unsigned N,
1041 NestedNameSpecifierLoc QualifierLoc,
1042 const DeclarationNameInfo &NameInfo)
1043 : OMPVarListClause<OMPReductionClause>(OMPC_reduction, StartLoc,
1044 LParenLoc, EndLoc, N),
1045 ColonLoc(ColonLoc), QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
1047 /// \brief Build an empty clause.
1049 /// \param N Number of variables.
1051 explicit OMPReductionClause(unsigned N)
1052 : OMPVarListClause<OMPReductionClause>(OMPC_reduction, SourceLocation(),
1053 SourceLocation(), SourceLocation(),
1055 ColonLoc(), QualifierLoc(), NameInfo() {}
1057 /// \brief Sets location of ':' symbol in clause.
1058 void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
1059 /// \brief Sets the name info for specified reduction identifier.
1060 void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
1061 /// \brief Sets the nested name specifier.
1062 void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
1065 /// \brief Creates clause with a list of variables \a VL.
1067 /// \param StartLoc Starting location of the clause.
1068 /// \param LParenLoc Location of '('.
1069 /// \param ColonLoc Location of ':'.
1070 /// \param EndLoc Ending location of the clause.
1071 /// \param VL The variables in the clause.
1072 /// \param QualifierLoc The nested-name qualifier with location information
1073 /// \param NameInfo The full name info for reduction identifier.
1075 static OMPReductionClause *
1076 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
1077 SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
1078 NestedNameSpecifierLoc QualifierLoc,
1079 const DeclarationNameInfo &NameInfo);
1080 /// \brief Creates an empty clause with the place for \a N variables.
1082 /// \param C AST context.
1083 /// \param N The number of variables.
1085 static OMPReductionClause *CreateEmpty(const ASTContext &C, unsigned N);
1087 /// \brief Gets location of ':' symbol in clause.
1088 SourceLocation getColonLoc() const { return ColonLoc; }
1089 /// \brief Gets the name info for specified reduction identifier.
1090 const DeclarationNameInfo &getNameInfo() const { return NameInfo; }
1091 /// \brief Gets the nested name specifier.
1092 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
1094 StmtRange children() {
1095 return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
1096 reinterpret_cast<Stmt **>(varlist_end()));
1099 static bool classof(const OMPClause *T) {
1100 return T->getClauseKind() == OMPC_reduction;
1104 /// \brief This represents clause 'linear' in the '#pragma omp ...'
1108 /// #pragma omp simd linear(a,b : 2)
1110 /// In this example directive '#pragma omp simd' has clause 'linear'
1111 /// with variables 'a', 'b' and linear step '2'.
1113 class OMPLinearClause : public OMPVarListClause<OMPLinearClause> {
1114 friend class OMPClauseReader;
1115 /// \brief Location of ':'.
1116 SourceLocation ColonLoc;
1118 /// \brief Sets the linear step for clause.
1119 void setStep(Expr *Step) { *varlist_end() = Step; }
1121 /// \brief Build 'linear' clause with given number of variables \a NumVars.
1123 /// \param StartLoc Starting location of the clause.
1124 /// \param LParenLoc Location of '('.
1125 /// \param ColonLoc Location of ':'.
1126 /// \param EndLoc Ending location of the clause.
1127 /// \param NumVars Number of variables.
1129 OMPLinearClause(SourceLocation StartLoc, SourceLocation LParenLoc,
1130 SourceLocation ColonLoc, SourceLocation EndLoc,
1132 : OMPVarListClause<OMPLinearClause>(OMPC_linear, StartLoc, LParenLoc,
1134 ColonLoc(ColonLoc) {}
1136 /// \brief Build an empty clause.
1138 /// \param NumVars Number of variables.
1140 explicit OMPLinearClause(unsigned NumVars)
1141 : OMPVarListClause<OMPLinearClause>(OMPC_linear, SourceLocation(),
1142 SourceLocation(), SourceLocation(),
1144 ColonLoc(SourceLocation()) {}
1147 /// \brief Creates clause with a list of variables \a VL and a linear step
1150 /// \param C AST Context.
1151 /// \param StartLoc Starting location of the clause.
1152 /// \param LParenLoc Location of '('.
1153 /// \param ColonLoc Location of ':'.
1154 /// \param EndLoc Ending location of the clause.
1155 /// \param VL List of references to the variables.
1156 /// \param Step Linear step.
1157 static OMPLinearClause *Create(const ASTContext &C, SourceLocation StartLoc,
1158 SourceLocation LParenLoc,
1159 SourceLocation ColonLoc, SourceLocation EndLoc,
1160 ArrayRef<Expr *> VL, Expr *Step);
1162 /// \brief Creates an empty clause with the place for \a NumVars variables.
1164 /// \param C AST context.
1165 /// \param NumVars Number of variables.
1167 static OMPLinearClause *CreateEmpty(const ASTContext &C, unsigned NumVars);
1169 /// \brief Sets the location of ':'.
1170 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
1171 /// \brief Returns the location of '('.
1172 SourceLocation getColonLoc() const { return ColonLoc; }
1174 /// \brief Returns linear step.
1175 Expr *getStep() { return *varlist_end(); }
1176 /// \brief Returns linear step.
1177 const Expr *getStep() const { return *varlist_end(); }
1179 StmtRange children() {
1180 return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
1181 reinterpret_cast<Stmt **>(varlist_end() + 1));
1184 static bool classof(const OMPClause *T) {
1185 return T->getClauseKind() == OMPC_linear;
1189 /// \brief This represents clause 'aligned' in the '#pragma omp ...'
1193 /// #pragma omp simd aligned(a,b : 8)
1195 /// In this example directive '#pragma omp simd' has clause 'aligned'
1196 /// with variables 'a', 'b' and alignment '8'.
1198 class OMPAlignedClause : public OMPVarListClause<OMPAlignedClause> {
1199 friend class OMPClauseReader;
1200 /// \brief Location of ':'.
1201 SourceLocation ColonLoc;
1203 /// \brief Sets the alignment for clause.
1204 void setAlignment(Expr *A) { *varlist_end() = A; }
1206 /// \brief Build 'aligned' clause with given number of variables \a NumVars.
1208 /// \param StartLoc Starting location of the clause.
1209 /// \param LParenLoc Location of '('.
1210 /// \param ColonLoc Location of ':'.
1211 /// \param EndLoc Ending location of the clause.
1212 /// \param NumVars Number of variables.
1214 OMPAlignedClause(SourceLocation StartLoc, SourceLocation LParenLoc,
1215 SourceLocation ColonLoc, SourceLocation EndLoc,
1217 : OMPVarListClause<OMPAlignedClause>(OMPC_aligned, StartLoc, LParenLoc,
1219 ColonLoc(ColonLoc) {}
1221 /// \brief Build an empty clause.
1223 /// \param NumVars Number of variables.
1225 explicit OMPAlignedClause(unsigned NumVars)
1226 : OMPVarListClause<OMPAlignedClause>(OMPC_aligned, SourceLocation(),
1227 SourceLocation(), SourceLocation(),
1229 ColonLoc(SourceLocation()) {}
1232 /// \brief Creates clause with a list of variables \a VL and alignment \a A.
1234 /// \param C AST Context.
1235 /// \param StartLoc Starting location of the clause.
1236 /// \param LParenLoc Location of '('.
1237 /// \param ColonLoc Location of ':'.
1238 /// \param EndLoc Ending location of the clause.
1239 /// \param VL List of references to the variables.
1240 /// \param A Alignment.
1241 static OMPAlignedClause *Create(const ASTContext &C, SourceLocation StartLoc,
1242 SourceLocation LParenLoc,
1243 SourceLocation ColonLoc,
1244 SourceLocation EndLoc, ArrayRef<Expr *> VL,
1247 /// \brief Creates an empty clause with the place for \a NumVars variables.
1249 /// \param C AST context.
1250 /// \param NumVars Number of variables.
1252 static OMPAlignedClause *CreateEmpty(const ASTContext &C, unsigned NumVars);
1254 /// \brief Sets the location of ':'.
1255 void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
1256 /// \brief Returns the location of ':'.
1257 SourceLocation getColonLoc() const { return ColonLoc; }
1259 /// \brief Returns alignment.
1260 Expr *getAlignment() { return *varlist_end(); }
1261 /// \brief Returns alignment.
1262 const Expr *getAlignment() const { return *varlist_end(); }
1264 StmtRange children() {
1265 return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
1266 reinterpret_cast<Stmt **>(varlist_end() + 1));
1269 static bool classof(const OMPClause *T) {
1270 return T->getClauseKind() == OMPC_aligned;
1274 /// \brief This represents clause 'copyin' in the '#pragma omp ...' directives.
1277 /// #pragma omp parallel copyin(a,b)
1279 /// In this example directive '#pragma omp parallel' has clause 'copyin'
1280 /// with the variables 'a' and 'b'.
1282 class OMPCopyinClause : public OMPVarListClause<OMPCopyinClause> {
1283 /// \brief Build clause with number of variables \a N.
1285 /// \param StartLoc Starting location of the clause.
1286 /// \param LParenLoc Location of '('.
1287 /// \param EndLoc Ending location of the clause.
1288 /// \param N Number of the variables in the clause.
1290 OMPCopyinClause(SourceLocation StartLoc, SourceLocation LParenLoc,
1291 SourceLocation EndLoc, unsigned N)
1292 : OMPVarListClause<OMPCopyinClause>(OMPC_copyin, StartLoc, LParenLoc,
1295 /// \brief Build an empty clause.
1297 /// \param N Number of variables.
1299 explicit OMPCopyinClause(unsigned N)
1300 : OMPVarListClause<OMPCopyinClause>(OMPC_copyin, SourceLocation(),
1301 SourceLocation(), SourceLocation(),
1305 /// \brief Creates clause with a list of variables \a VL.
1307 /// \param C AST context.
1308 /// \param StartLoc Starting location of the clause.
1309 /// \param LParenLoc Location of '('.
1310 /// \param EndLoc Ending location of the clause.
1311 /// \param VL List of references to the variables.
1313 static OMPCopyinClause *Create(const ASTContext &C, SourceLocation StartLoc,
1314 SourceLocation LParenLoc,
1315 SourceLocation EndLoc, ArrayRef<Expr *> VL);
1316 /// \brief Creates an empty clause with \a N variables.
1318 /// \param C AST context.
1319 /// \param N The number of variables.
1321 static OMPCopyinClause *CreateEmpty(const ASTContext &C, unsigned N);
1323 StmtRange children() {
1324 return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
1325 reinterpret_cast<Stmt **>(varlist_end()));
1328 static bool classof(const OMPClause *T) {
1329 return T->getClauseKind() == OMPC_copyin;
1333 /// \brief This represents clause 'copyprivate' in the '#pragma omp ...'
1337 /// #pragma omp single copyprivate(a,b)
1339 /// In this example directive '#pragma omp single' has clause 'copyprivate'
1340 /// with the variables 'a' and 'b'.
1342 class OMPCopyprivateClause : public OMPVarListClause<OMPCopyprivateClause> {
1343 /// \brief Build clause with number of variables \a N.
1345 /// \param StartLoc Starting location of the clause.
1346 /// \param LParenLoc Location of '('.
1347 /// \param EndLoc Ending location of the clause.
1348 /// \param N Number of the variables in the clause.
1350 OMPCopyprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
1351 SourceLocation EndLoc, unsigned N)
1352 : OMPVarListClause<OMPCopyprivateClause>(OMPC_copyprivate, StartLoc,
1353 LParenLoc, EndLoc, N) {}
1355 /// \brief Build an empty clause.
1357 /// \param N Number of variables.
1359 explicit OMPCopyprivateClause(unsigned N)
1360 : OMPVarListClause<OMPCopyprivateClause>(
1361 OMPC_copyprivate, SourceLocation(), SourceLocation(),
1362 SourceLocation(), N) {}
1365 /// \brief Creates clause with a list of variables \a VL.
1367 /// \param C AST context.
1368 /// \param StartLoc Starting location of the clause.
1369 /// \param LParenLoc Location of '('.
1370 /// \param EndLoc Ending location of the clause.
1371 /// \param VL List of references to the variables.
1373 static OMPCopyprivateClause *
1374 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
1375 SourceLocation EndLoc, ArrayRef<Expr *> VL);
1376 /// \brief Creates an empty clause with \a N variables.
1378 /// \param C AST context.
1379 /// \param N The number of variables.
1381 static OMPCopyprivateClause *CreateEmpty(const ASTContext &C, unsigned N);
1383 StmtRange children() {
1384 return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
1385 reinterpret_cast<Stmt **>(varlist_end()));
1388 static bool classof(const OMPClause *T) {
1389 return T->getClauseKind() == OMPC_copyprivate;
1393 /// \brief This represents pseudo clause 'flush' for the '#pragma omp flush'
1397 /// #pragma omp flush(a,b)
1399 /// In this example directive '#pragma omp flush' has pseudo clause 'flush'
1400 /// with the variables 'a' and 'b'.
1402 class OMPFlushClause : public OMPVarListClause<OMPFlushClause> {
1403 /// \brief Build clause with number of variables \a N.
1405 /// \param StartLoc Starting location of the clause.
1406 /// \param LParenLoc Location of '('.
1407 /// \param EndLoc Ending location of the clause.
1408 /// \param N Number of the variables in the clause.
1410 OMPFlushClause(SourceLocation StartLoc, SourceLocation LParenLoc,
1411 SourceLocation EndLoc, unsigned N)
1412 : OMPVarListClause<OMPFlushClause>(OMPC_flush, StartLoc, LParenLoc,
1415 /// \brief Build an empty clause.
1417 /// \param N Number of variables.
1419 explicit OMPFlushClause(unsigned N)
1420 : OMPVarListClause<OMPFlushClause>(OMPC_flush, SourceLocation(),
1421 SourceLocation(), SourceLocation(),
1425 /// \brief Creates clause with a list of variables \a VL.
1427 /// \param C AST context.
1428 /// \param StartLoc Starting location of the clause.
1429 /// \param LParenLoc Location of '('.
1430 /// \param EndLoc Ending location of the clause.
1431 /// \param VL List of references to the variables.
1433 static OMPFlushClause *Create(const ASTContext &C, SourceLocation StartLoc,
1434 SourceLocation LParenLoc, SourceLocation EndLoc,
1435 ArrayRef<Expr *> VL);
1436 /// \brief Creates an empty clause with \a N variables.
1438 /// \param C AST context.
1439 /// \param N The number of variables.
1441 static OMPFlushClause *CreateEmpty(const ASTContext &C, unsigned N);
1443 StmtRange children() {
1444 return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
1445 reinterpret_cast<Stmt **>(varlist_end()));
1448 static bool classof(const OMPClause *T) {
1449 return T->getClauseKind() == OMPC_flush;
1453 } // end namespace clang