1 //===- StmtOpenMP.h - Classes for OpenMP directives ------------*- 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 executable directives and
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_AST_STMTOPENMP_H
16 #define LLVM_CLANG_AST_STMTOPENMP_H
18 #include "clang/AST/Expr.h"
19 #include "clang/AST/OpenMPClause.h"
20 #include "clang/AST/Stmt.h"
21 #include "clang/Basic/OpenMPKinds.h"
22 #include "clang/Basic/SourceLocation.h"
26 //===----------------------------------------------------------------------===//
27 // AST classes for directives.
28 //===----------------------------------------------------------------------===//
30 /// \brief This is a basic class for representing single OpenMP executable
33 class OMPExecutableDirective : public Stmt {
34 friend class ASTStmtReader;
35 /// \brief Kind of the directive.
36 OpenMPDirectiveKind Kind;
37 /// \brief Starting location of the directive (directive keyword).
38 SourceLocation StartLoc;
39 /// \brief Ending location of the directive.
40 SourceLocation EndLoc;
41 /// \brief Numbers of clauses.
42 const unsigned NumClauses;
43 /// \brief Number of child expressions/stmts.
44 const unsigned NumChildren;
45 /// \brief Offset from this to the start of clauses.
46 /// There are NumClauses pointers to clauses, they are followed by
47 /// NumChildren pointers to child stmts/exprs (if the directive type
48 /// requires an associated stmt, then it has to be the first of them).
49 const unsigned ClausesOffset;
51 /// \brief Get the clauses storage.
52 MutableArrayRef<OMPClause *> getClauses() {
53 OMPClause **ClauseStorage = reinterpret_cast<OMPClause **>(
54 reinterpret_cast<char *>(this) + ClausesOffset);
55 return MutableArrayRef<OMPClause *>(ClauseStorage, NumClauses);
59 /// \brief Build instance of directive of class \a K.
61 /// \param SC Statement class.
62 /// \param K Kind of OpenMP directive.
63 /// \param StartLoc Starting location of the directive (directive keyword).
64 /// \param EndLoc Ending location of the directive.
67 OMPExecutableDirective(const T *, StmtClass SC, OpenMPDirectiveKind K,
68 SourceLocation StartLoc, SourceLocation EndLoc,
69 unsigned NumClauses, unsigned NumChildren)
70 : Stmt(SC), Kind(K), StartLoc(std::move(StartLoc)),
71 EndLoc(std::move(EndLoc)), NumClauses(NumClauses),
72 NumChildren(NumChildren),
73 ClausesOffset(llvm::RoundUpToAlignment(sizeof(T),
74 llvm::alignOf<OMPClause *>())) {}
76 /// \brief Sets the list of variables for this clause.
78 /// \param Clauses The list of clauses for the directive.
80 void setClauses(ArrayRef<OMPClause *> Clauses);
82 /// \brief Set the associated statement for the directive.
84 /// /param S Associated statement.
86 void setAssociatedStmt(Stmt *S) {
87 assert(hasAssociatedStmt() && "no associated statement.");
92 /// \brief Iterates over a filtered subrange of clauses applied to a
95 /// This iterator visits only those declarations that meet some run-time
97 template <class FilterPredicate> class filtered_clause_iterator {
99 ArrayRef<OMPClause *>::const_iterator Current;
100 ArrayRef<OMPClause *>::const_iterator End;
101 FilterPredicate Pred;
102 void SkipToNextClause() {
103 while (Current != End && !Pred(*Current))
108 typedef const OMPClause *value_type;
109 filtered_clause_iterator() : Current(), End() {}
110 filtered_clause_iterator(ArrayRef<OMPClause *> Arr, FilterPredicate Pred)
111 : Current(Arr.begin()), End(Arr.end()), Pred(std::move(Pred)) {
114 value_type operator*() const { return *Current; }
115 value_type operator->() const { return *Current; }
116 filtered_clause_iterator &operator++() {
122 filtered_clause_iterator operator++(int) {
123 filtered_clause_iterator tmp(*this);
128 bool operator!() { return Current == End; }
129 explicit operator bool() { return Current != End; }
130 bool empty() const { return Current == End; }
133 template <typename Fn>
134 filtered_clause_iterator<Fn> getFilteredClauses(Fn &&fn) const {
135 return filtered_clause_iterator<Fn>(clauses(), std::move(fn));
137 struct ClauseKindFilter {
138 OpenMPClauseKind Kind;
139 bool operator()(const OMPClause *clause) const {
140 return clause->getClauseKind() == Kind;
143 filtered_clause_iterator<ClauseKindFilter>
144 getClausesOfKind(OpenMPClauseKind Kind) const {
145 return getFilteredClauses(ClauseKindFilter{Kind});
148 /// \brief Gets a single clause of the specified kind \a K associated with the
149 /// current directive iff there is only one clause of this kind (and assertion
150 /// is fired if there is more than one clause is associated with the
151 /// directive). Returns nullptr if no clause of kind \a K is associated with
153 const OMPClause *getSingleClause(OpenMPClauseKind K) const;
155 /// \brief Returns starting location of directive kind.
156 SourceLocation getLocStart() const { return StartLoc; }
157 /// \brief Returns ending location of directive.
158 SourceLocation getLocEnd() const { return EndLoc; }
160 /// \brief Set starting location of directive kind.
162 /// \param Loc New starting location of directive.
164 void setLocStart(SourceLocation Loc) { StartLoc = Loc; }
165 /// \brief Set ending location of directive.
167 /// \param Loc New ending location of directive.
169 void setLocEnd(SourceLocation Loc) { EndLoc = Loc; }
171 /// \brief Get number of clauses.
172 unsigned getNumClauses() const { return NumClauses; }
174 /// \brief Returns specified clause.
176 /// \param i Number of clause.
178 OMPClause *getClause(unsigned i) const { return clauses()[i]; }
180 /// \brief Returns true if directive has associated statement.
181 bool hasAssociatedStmt() const { return NumChildren > 0; }
183 /// \brief Returns statement associated with the directive.
184 Stmt *getAssociatedStmt() const {
185 assert(hasAssociatedStmt() && "no associated statement.");
186 return const_cast<Stmt *>(*child_begin());
189 OpenMPDirectiveKind getDirectiveKind() const { return Kind; }
191 static bool classof(const Stmt *S) {
192 return S->getStmtClass() >= firstOMPExecutableDirectiveConstant &&
193 S->getStmtClass() <= lastOMPExecutableDirectiveConstant;
196 child_range children() {
197 if (!hasAssociatedStmt())
198 return child_range();
199 Stmt **ChildStorage = reinterpret_cast<Stmt **>(getClauses().end());
200 return child_range(ChildStorage, ChildStorage + NumChildren);
203 ArrayRef<OMPClause *> clauses() { return getClauses(); }
205 ArrayRef<OMPClause *> clauses() const {
206 return const_cast<OMPExecutableDirective *>(this)->getClauses();
210 /// \brief This represents '#pragma omp parallel' directive.
213 /// #pragma omp parallel private(a,b) reduction(+: c,d)
215 /// In this example directive '#pragma omp parallel' has clauses 'private'
216 /// with the variables 'a' and 'b' and 'reduction' with operator '+' and
217 /// variables 'c' and 'd'.
219 class OMPParallelDirective : public OMPExecutableDirective {
220 /// \brief Build directive with the given start and end location.
222 /// \param StartLoc Starting location of the directive (directive keyword).
223 /// \param EndLoc Ending Location of the directive.
225 OMPParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc,
227 : OMPExecutableDirective(this, OMPParallelDirectiveClass, OMPD_parallel,
228 StartLoc, EndLoc, NumClauses, 1) {}
230 /// \brief Build an empty directive.
232 /// \param NumClauses Number of clauses.
234 explicit OMPParallelDirective(unsigned NumClauses)
235 : OMPExecutableDirective(this, OMPParallelDirectiveClass, OMPD_parallel,
236 SourceLocation(), SourceLocation(), NumClauses,
240 /// \brief Creates directive with a list of \a Clauses.
242 /// \param C AST context.
243 /// \param StartLoc Starting location of the directive kind.
244 /// \param EndLoc Ending Location of the directive.
245 /// \param Clauses List of clauses.
246 /// \param AssociatedStmt Statement associated with the directive.
248 static OMPParallelDirective *
249 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
250 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
252 /// \brief Creates an empty directive with the place for \a N clauses.
254 /// \param C AST context.
255 /// \param NumClauses Number of clauses.
257 static OMPParallelDirective *CreateEmpty(const ASTContext &C,
258 unsigned NumClauses, EmptyShell);
260 static bool classof(const Stmt *T) {
261 return T->getStmtClass() == OMPParallelDirectiveClass;
265 /// \brief This is a common base class for loop directives ('omp simd', 'omp
266 /// for', 'omp for simd' etc.). It is responsible for the loop code generation.
268 class OMPLoopDirective : public OMPExecutableDirective {
269 friend class ASTStmtReader;
270 /// \brief Number of collapsed loops as specified by 'collapse' clause.
271 unsigned CollapsedNum;
273 /// \brief Offsets to the stored exprs.
274 /// This enumeration contains offsets to all the pointers to children
275 /// expressions stored in OMPLoopDirective.
276 /// The first 9 children are nesessary for all the loop directives, and
277 /// the next 7 are specific to the worksharing ones.
278 /// After the fixed children, three arrays of length CollapsedNum are
279 /// allocated: loop counters, their updates and final values.
282 AssociatedStmtOffset = 0,
283 IterationVariableOffset = 1,
284 LastIterationOffset = 2,
285 CalcLastIterationOffset = 3,
286 PreConditionOffset = 4,
290 // The '...End' enumerators do not correspond to child expressions - they
291 // specify the offset to the end (and start of the following counters/
292 // updates/finals arrays).
294 // The following 7 exprs are used by worksharing loops only.
295 IsLastIterVariableOffset = 8,
296 LowerBoundVariableOffset = 9,
297 UpperBoundVariableOffset = 10,
298 StrideVariableOffset = 11,
299 EnsureUpperBoundOffset = 12,
300 NextLowerBoundOffset = 13,
301 NextUpperBoundOffset = 14,
302 // Offset to the end (and start of the following counters/updates/finals
303 // arrays) for worksharing loop directives.
307 /// \brief Get the counters storage.
308 MutableArrayRef<Expr *> getCounters() {
309 Expr **Storage = reinterpret_cast<Expr **>(
310 &(*(std::next(child_begin(), getArraysOffset(getDirectiveKind())))));
311 return MutableArrayRef<Expr *>(Storage, CollapsedNum);
314 /// \brief Get the updates storage.
315 MutableArrayRef<Expr *> getInits() {
316 Expr **Storage = reinterpret_cast<Expr **>(
317 &*std::next(child_begin(),
318 getArraysOffset(getDirectiveKind()) + CollapsedNum));
319 return MutableArrayRef<Expr *>(Storage, CollapsedNum);
322 /// \brief Get the updates storage.
323 MutableArrayRef<Expr *> getUpdates() {
324 Expr **Storage = reinterpret_cast<Expr **>(
325 &*std::next(child_begin(),
326 getArraysOffset(getDirectiveKind()) + 2 * CollapsedNum));
327 return MutableArrayRef<Expr *>(Storage, CollapsedNum);
330 /// \brief Get the final counter updates storage.
331 MutableArrayRef<Expr *> getFinals() {
332 Expr **Storage = reinterpret_cast<Expr **>(
333 &*std::next(child_begin(),
334 getArraysOffset(getDirectiveKind()) + 3 * CollapsedNum));
335 return MutableArrayRef<Expr *>(Storage, CollapsedNum);
339 /// \brief Build instance of loop directive of class \a Kind.
341 /// \param SC Statement class.
342 /// \param Kind Kind of OpenMP directive.
343 /// \param StartLoc Starting location of the directive (directive keyword).
344 /// \param EndLoc Ending location of the directive.
345 /// \param CollapsedNum Number of collapsed loops from 'collapse' clause.
346 /// \param NumClauses Number of clauses.
347 /// \param NumSpecialChildren Number of additional directive-specific stmts.
349 template <typename T>
350 OMPLoopDirective(const T *That, StmtClass SC, OpenMPDirectiveKind Kind,
351 SourceLocation StartLoc, SourceLocation EndLoc,
352 unsigned CollapsedNum, unsigned NumClauses,
353 unsigned NumSpecialChildren = 0)
354 : OMPExecutableDirective(That, SC, Kind, StartLoc, EndLoc, NumClauses,
355 numLoopChildren(CollapsedNum, Kind) +
357 CollapsedNum(CollapsedNum) {}
359 /// \brief Offset to the start of children expression arrays.
360 static unsigned getArraysOffset(OpenMPDirectiveKind Kind) {
361 return isOpenMPWorksharingDirective(Kind) ? WorksharingEnd
365 /// \brief Children number.
366 static unsigned numLoopChildren(unsigned CollapsedNum,
367 OpenMPDirectiveKind Kind) {
368 return getArraysOffset(Kind) +
369 4 * CollapsedNum; // Counters, Inits, Updates and Finals
372 void setIterationVariable(Expr *IV) {
373 *std::next(child_begin(), IterationVariableOffset) = IV;
375 void setLastIteration(Expr *LI) {
376 *std::next(child_begin(), LastIterationOffset) = LI;
378 void setCalcLastIteration(Expr *CLI) {
379 *std::next(child_begin(), CalcLastIterationOffset) = CLI;
381 void setPreCond(Expr *PC) {
382 *std::next(child_begin(), PreConditionOffset) = PC;
384 void setCond(Expr *Cond) {
385 *std::next(child_begin(), CondOffset) = Cond;
387 void setInit(Expr *Init) { *std::next(child_begin(), InitOffset) = Init; }
388 void setInc(Expr *Inc) { *std::next(child_begin(), IncOffset) = Inc; }
389 void setIsLastIterVariable(Expr *IL) {
390 assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
391 "expected worksharing loop directive");
392 *std::next(child_begin(), IsLastIterVariableOffset) = IL;
394 void setLowerBoundVariable(Expr *LB) {
395 assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
396 "expected worksharing loop directive");
397 *std::next(child_begin(), LowerBoundVariableOffset) = LB;
399 void setUpperBoundVariable(Expr *UB) {
400 assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
401 "expected worksharing loop directive");
402 *std::next(child_begin(), UpperBoundVariableOffset) = UB;
404 void setStrideVariable(Expr *ST) {
405 assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
406 "expected worksharing loop directive");
407 *std::next(child_begin(), StrideVariableOffset) = ST;
409 void setEnsureUpperBound(Expr *EUB) {
410 assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
411 "expected worksharing loop directive");
412 *std::next(child_begin(), EnsureUpperBoundOffset) = EUB;
414 void setNextLowerBound(Expr *NLB) {
415 assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
416 "expected worksharing loop directive");
417 *std::next(child_begin(), NextLowerBoundOffset) = NLB;
419 void setNextUpperBound(Expr *NUB) {
420 assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
421 "expected worksharing loop directive");
422 *std::next(child_begin(), NextUpperBoundOffset) = NUB;
424 void setCounters(ArrayRef<Expr *> A);
425 void setInits(ArrayRef<Expr *> A);
426 void setUpdates(ArrayRef<Expr *> A);
427 void setFinals(ArrayRef<Expr *> A);
430 /// \brief The expressions built for the OpenMP loop CodeGen for the
431 /// whole collapsed loop nest.
433 /// \brief Loop iteration variable.
434 Expr *IterationVarRef;
435 /// \brief Loop last iteration number.
437 /// \brief Loop number of iterations.
439 /// \brief Calculation of last iteration.
440 Expr *CalcLastIteration;
441 /// \brief Loop pre-condition.
443 /// \brief Loop condition.
445 /// \brief Loop iteration variable init.
447 /// \brief Loop increment.
449 /// \brief IsLastIteration - local flag variable passed to runtime.
451 /// \brief LowerBound - local variable passed to runtime.
453 /// \brief UpperBound - local variable passed to runtime.
455 /// \brief Stride - local variable passed to runtime.
457 /// \brief EnsureUpperBound -- expression LB = min(LB, NumIterations).
459 /// \brief Update of LowerBound for statically sheduled 'omp for' loops.
461 /// \brief Update of UpperBound for statically sheduled 'omp for' loops.
463 /// \brief Counters Loop counters.
464 SmallVector<Expr *, 4> Counters;
465 /// \brief Expressions for loop counters inits for CodeGen.
466 SmallVector<Expr *, 4> Inits;
467 /// \brief Expressions for loop counters update for CodeGen.
468 SmallVector<Expr *, 4> Updates;
469 /// \brief Final loop counter values for GodeGen.
470 SmallVector<Expr *, 4> Finals;
472 /// \brief Check if all the expressions are built (does not check the
473 /// worksharing ones).
475 return IterationVarRef != nullptr && LastIteration != nullptr &&
476 NumIterations != nullptr && PreCond != nullptr &&
477 Cond != nullptr && Init != nullptr && Inc != nullptr;
480 /// \brief Initialize all the fields to null.
481 /// \param Size Number of elements in the counters/finals/updates arrays.
482 void clear(unsigned Size) {
483 IterationVarRef = nullptr;
484 LastIteration = nullptr;
485 CalcLastIteration = nullptr;
497 Counters.resize(Size);
499 Updates.resize(Size);
501 for (unsigned i = 0; i < Size; ++i) {
502 Counters[i] = nullptr;
504 Updates[i] = nullptr;
510 /// \brief Get number of collapsed loops.
511 unsigned getCollapsedNumber() const { return CollapsedNum; }
513 Expr *getIterationVariable() const {
514 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
515 *std::next(child_begin(), IterationVariableOffset)));
517 Expr *getLastIteration() const {
518 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
519 *std::next(child_begin(), LastIterationOffset)));
521 Expr *getCalcLastIteration() const {
522 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
523 *std::next(child_begin(), CalcLastIterationOffset)));
525 Expr *getPreCond() const {
526 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
527 *std::next(child_begin(), PreConditionOffset)));
529 Expr *getCond() const {
530 return const_cast<Expr *>(
531 reinterpret_cast<const Expr *>(*std::next(child_begin(), CondOffset)));
533 Expr *getInit() const {
534 return const_cast<Expr *>(
535 reinterpret_cast<const Expr *>(*std::next(child_begin(), InitOffset)));
537 Expr *getInc() const {
538 return const_cast<Expr *>(
539 reinterpret_cast<const Expr *>(*std::next(child_begin(), IncOffset)));
541 Expr *getIsLastIterVariable() const {
542 assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
543 "expected worksharing loop directive");
544 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
545 *std::next(child_begin(), IsLastIterVariableOffset)));
547 Expr *getLowerBoundVariable() const {
548 assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
549 "expected worksharing loop directive");
550 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
551 *std::next(child_begin(), LowerBoundVariableOffset)));
553 Expr *getUpperBoundVariable() const {
554 assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
555 "expected worksharing loop directive");
556 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
557 *std::next(child_begin(), UpperBoundVariableOffset)));
559 Expr *getStrideVariable() const {
560 assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
561 "expected worksharing loop directive");
562 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
563 *std::next(child_begin(), StrideVariableOffset)));
565 Expr *getEnsureUpperBound() const {
566 assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
567 "expected worksharing loop directive");
568 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
569 *std::next(child_begin(), EnsureUpperBoundOffset)));
571 Expr *getNextLowerBound() const {
572 assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
573 "expected worksharing loop directive");
574 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
575 *std::next(child_begin(), NextLowerBoundOffset)));
577 Expr *getNextUpperBound() const {
578 assert(isOpenMPWorksharingDirective(getDirectiveKind()) &&
579 "expected worksharing loop directive");
580 return const_cast<Expr *>(reinterpret_cast<const Expr *>(
581 *std::next(child_begin(), NextUpperBoundOffset)));
583 const Stmt *getBody() const {
584 // This relies on the loop form is already checked by Sema.
585 Stmt *Body = getAssociatedStmt()->IgnoreContainers(true);
586 Body = cast<ForStmt>(Body)->getBody();
587 for (unsigned Cnt = 1; Cnt < CollapsedNum; ++Cnt) {
588 Body = Body->IgnoreContainers();
589 Body = cast<ForStmt>(Body)->getBody();
594 ArrayRef<Expr *> counters() { return getCounters(); }
596 ArrayRef<Expr *> counters() const {
597 return const_cast<OMPLoopDirective *>(this)->getCounters();
600 ArrayRef<Expr *> inits() { return getInits(); }
602 ArrayRef<Expr *> inits() const {
603 return const_cast<OMPLoopDirective *>(this)->getInits();
606 ArrayRef<Expr *> updates() { return getUpdates(); }
608 ArrayRef<Expr *> updates() const {
609 return const_cast<OMPLoopDirective *>(this)->getUpdates();
612 ArrayRef<Expr *> finals() { return getFinals(); }
614 ArrayRef<Expr *> finals() const {
615 return const_cast<OMPLoopDirective *>(this)->getFinals();
618 static bool classof(const Stmt *T) {
619 return T->getStmtClass() == OMPSimdDirectiveClass ||
620 T->getStmtClass() == OMPForDirectiveClass ||
621 T->getStmtClass() == OMPForSimdDirectiveClass ||
622 T->getStmtClass() == OMPParallelForDirectiveClass ||
623 T->getStmtClass() == OMPParallelForSimdDirectiveClass;
627 /// \brief This represents '#pragma omp simd' directive.
630 /// #pragma omp simd private(a,b) linear(i,j:s) reduction(+:c,d)
632 /// In this example directive '#pragma omp simd' has clauses 'private'
633 /// with the variables 'a' and 'b', 'linear' with variables 'i', 'j' and
634 /// linear step 's', 'reduction' with operator '+' and variables 'c' and 'd'.
636 class OMPSimdDirective : public OMPLoopDirective {
637 friend class ASTStmtReader;
638 /// \brief Build directive with the given start and end location.
640 /// \param StartLoc Starting location of the directive kind.
641 /// \param EndLoc Ending location of the directive.
642 /// \param CollapsedNum Number of collapsed nested loops.
643 /// \param NumClauses Number of clauses.
645 OMPSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
646 unsigned CollapsedNum, unsigned NumClauses)
647 : OMPLoopDirective(this, OMPSimdDirectiveClass, OMPD_simd, StartLoc,
648 EndLoc, CollapsedNum, NumClauses) {}
650 /// \brief Build an empty directive.
652 /// \param CollapsedNum Number of collapsed nested loops.
653 /// \param NumClauses Number of clauses.
655 explicit OMPSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
656 : OMPLoopDirective(this, OMPSimdDirectiveClass, OMPD_simd,
657 SourceLocation(), SourceLocation(), CollapsedNum,
661 /// \brief Creates directive with a list of \a Clauses.
663 /// \param C AST context.
664 /// \param StartLoc Starting location of the directive kind.
665 /// \param EndLoc Ending Location of the directive.
666 /// \param CollapsedNum Number of collapsed loops.
667 /// \param Clauses List of clauses.
668 /// \param AssociatedStmt Statement, associated with the directive.
669 /// \param Exprs Helper expressions for CodeGen.
671 static OMPSimdDirective *Create(const ASTContext &C, SourceLocation StartLoc,
672 SourceLocation EndLoc, unsigned CollapsedNum,
673 ArrayRef<OMPClause *> Clauses,
674 Stmt *AssociatedStmt,
675 const HelperExprs &Exprs);
677 /// \brief Creates an empty directive with the place
678 /// for \a NumClauses clauses.
680 /// \param C AST context.
681 /// \param CollapsedNum Number of collapsed nested loops.
682 /// \param NumClauses Number of clauses.
684 static OMPSimdDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses,
685 unsigned CollapsedNum, EmptyShell);
687 static bool classof(const Stmt *T) {
688 return T->getStmtClass() == OMPSimdDirectiveClass;
692 /// \brief This represents '#pragma omp for' directive.
695 /// #pragma omp for private(a,b) reduction(+:c,d)
697 /// In this example directive '#pragma omp for' has clauses 'private' with the
698 /// variables 'a' and 'b' and 'reduction' with operator '+' and variables 'c'
701 class OMPForDirective : public OMPLoopDirective {
702 friend class ASTStmtReader;
703 /// \brief Build directive with the given start and end location.
705 /// \param StartLoc Starting location of the directive kind.
706 /// \param EndLoc Ending location of the directive.
707 /// \param CollapsedNum Number of collapsed nested loops.
708 /// \param NumClauses Number of clauses.
710 OMPForDirective(SourceLocation StartLoc, SourceLocation EndLoc,
711 unsigned CollapsedNum, unsigned NumClauses)
712 : OMPLoopDirective(this, OMPForDirectiveClass, OMPD_for, StartLoc, EndLoc,
713 CollapsedNum, NumClauses) {}
715 /// \brief Build an empty directive.
717 /// \param CollapsedNum Number of collapsed nested loops.
718 /// \param NumClauses Number of clauses.
720 explicit OMPForDirective(unsigned CollapsedNum, unsigned NumClauses)
721 : OMPLoopDirective(this, OMPForDirectiveClass, OMPD_for, SourceLocation(),
722 SourceLocation(), CollapsedNum, NumClauses) {}
725 /// \brief Creates directive with a list of \a Clauses.
727 /// \param C AST context.
728 /// \param StartLoc Starting location of the directive kind.
729 /// \param EndLoc Ending Location of the directive.
730 /// \param CollapsedNum Number of collapsed loops.
731 /// \param Clauses List of clauses.
732 /// \param AssociatedStmt Statement, associated with the directive.
733 /// \param Exprs Helper expressions for CodeGen.
735 static OMPForDirective *Create(const ASTContext &C, SourceLocation StartLoc,
736 SourceLocation EndLoc, unsigned CollapsedNum,
737 ArrayRef<OMPClause *> Clauses,
738 Stmt *AssociatedStmt,
739 const HelperExprs &Exprs);
741 /// \brief Creates an empty directive with the place
742 /// for \a NumClauses clauses.
744 /// \param C AST context.
745 /// \param CollapsedNum Number of collapsed nested loops.
746 /// \param NumClauses Number of clauses.
748 static OMPForDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses,
749 unsigned CollapsedNum, EmptyShell);
751 static bool classof(const Stmt *T) {
752 return T->getStmtClass() == OMPForDirectiveClass;
756 /// \brief This represents '#pragma omp for simd' directive.
759 /// #pragma omp for simd private(a,b) linear(i,j:s) reduction(+:c,d)
761 /// In this example directive '#pragma omp for simd' has clauses 'private'
762 /// with the variables 'a' and 'b', 'linear' with variables 'i', 'j' and
763 /// linear step 's', 'reduction' with operator '+' and variables 'c' and 'd'.
765 class OMPForSimdDirective : public OMPLoopDirective {
766 friend class ASTStmtReader;
767 /// \brief Build directive with the given start and end location.
769 /// \param StartLoc Starting location of the directive kind.
770 /// \param EndLoc Ending location of the directive.
771 /// \param CollapsedNum Number of collapsed nested loops.
772 /// \param NumClauses Number of clauses.
774 OMPForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
775 unsigned CollapsedNum, unsigned NumClauses)
776 : OMPLoopDirective(this, OMPForSimdDirectiveClass, OMPD_for_simd,
777 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
779 /// \brief Build an empty directive.
781 /// \param CollapsedNum Number of collapsed nested loops.
782 /// \param NumClauses Number of clauses.
784 explicit OMPForSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
785 : OMPLoopDirective(this, OMPForSimdDirectiveClass, OMPD_for_simd,
786 SourceLocation(), SourceLocation(), CollapsedNum,
790 /// \brief Creates directive with a list of \a Clauses.
792 /// \param C AST context.
793 /// \param StartLoc Starting location of the directive kind.
794 /// \param EndLoc Ending Location of the directive.
795 /// \param CollapsedNum Number of collapsed loops.
796 /// \param Clauses List of clauses.
797 /// \param AssociatedStmt Statement, associated with the directive.
798 /// \param Exprs Helper expressions for CodeGen.
800 static OMPForSimdDirective *
801 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
802 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
803 Stmt *AssociatedStmt, const HelperExprs &Exprs);
805 /// \brief Creates an empty directive with the place
806 /// for \a NumClauses clauses.
808 /// \param C AST context.
809 /// \param CollapsedNum Number of collapsed nested loops.
810 /// \param NumClauses Number of clauses.
812 static OMPForSimdDirective *CreateEmpty(const ASTContext &C,
814 unsigned CollapsedNum, EmptyShell);
816 static bool classof(const Stmt *T) {
817 return T->getStmtClass() == OMPForSimdDirectiveClass;
821 /// \brief This represents '#pragma omp sections' directive.
824 /// #pragma omp sections private(a,b) reduction(+:c,d)
826 /// In this example directive '#pragma omp sections' has clauses 'private' with
827 /// the variables 'a' and 'b' and 'reduction' with operator '+' and variables
830 class OMPSectionsDirective : public OMPExecutableDirective {
831 friend class ASTStmtReader;
832 /// \brief Build directive with the given start and end location.
834 /// \param StartLoc Starting location of the directive kind.
835 /// \param EndLoc Ending location of the directive.
836 /// \param NumClauses Number of clauses.
838 OMPSectionsDirective(SourceLocation StartLoc, SourceLocation EndLoc,
840 : OMPExecutableDirective(this, OMPSectionsDirectiveClass, OMPD_sections,
841 StartLoc, EndLoc, NumClauses, 1) {}
843 /// \brief Build an empty directive.
845 /// \param NumClauses Number of clauses.
847 explicit OMPSectionsDirective(unsigned NumClauses)
848 : OMPExecutableDirective(this, OMPSectionsDirectiveClass, OMPD_sections,
849 SourceLocation(), SourceLocation(), NumClauses,
853 /// \brief Creates directive with a list of \a Clauses.
855 /// \param C AST context.
856 /// \param StartLoc Starting location of the directive kind.
857 /// \param EndLoc Ending Location of the directive.
858 /// \param Clauses List of clauses.
859 /// \param AssociatedStmt Statement, associated with the directive.
861 static OMPSectionsDirective *
862 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
863 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
865 /// \brief Creates an empty directive with the place for \a NumClauses
868 /// \param C AST context.
869 /// \param NumClauses Number of clauses.
871 static OMPSectionsDirective *CreateEmpty(const ASTContext &C,
872 unsigned NumClauses, EmptyShell);
874 static bool classof(const Stmt *T) {
875 return T->getStmtClass() == OMPSectionsDirectiveClass;
879 /// \brief This represents '#pragma omp section' directive.
882 /// #pragma omp section
885 class OMPSectionDirective : public OMPExecutableDirective {
886 friend class ASTStmtReader;
887 /// \brief Build directive with the given start and end location.
889 /// \param StartLoc Starting location of the directive kind.
890 /// \param EndLoc Ending location of the directive.
892 OMPSectionDirective(SourceLocation StartLoc, SourceLocation EndLoc)
893 : OMPExecutableDirective(this, OMPSectionDirectiveClass, OMPD_section,
894 StartLoc, EndLoc, 0, 1) {}
896 /// \brief Build an empty directive.
898 explicit OMPSectionDirective()
899 : OMPExecutableDirective(this, OMPSectionDirectiveClass, OMPD_section,
900 SourceLocation(), SourceLocation(), 0, 1) {}
903 /// \brief Creates directive.
905 /// \param C AST context.
906 /// \param StartLoc Starting location of the directive kind.
907 /// \param EndLoc Ending Location of the directive.
908 /// \param AssociatedStmt Statement, associated with the directive.
910 static OMPSectionDirective *Create(const ASTContext &C,
911 SourceLocation StartLoc,
912 SourceLocation EndLoc,
913 Stmt *AssociatedStmt);
915 /// \brief Creates an empty directive.
917 /// \param C AST context.
919 static OMPSectionDirective *CreateEmpty(const ASTContext &C, EmptyShell);
921 static bool classof(const Stmt *T) {
922 return T->getStmtClass() == OMPSectionDirectiveClass;
926 /// \brief This represents '#pragma omp single' directive.
929 /// #pragma omp single private(a,b) copyprivate(c,d)
931 /// In this example directive '#pragma omp single' has clauses 'private' with
932 /// the variables 'a' and 'b' and 'copyprivate' with variables 'c' and 'd'.
934 class OMPSingleDirective : public OMPExecutableDirective {
935 friend class ASTStmtReader;
936 /// \brief Build directive with the given start and end location.
938 /// \param StartLoc Starting location of the directive kind.
939 /// \param EndLoc Ending location of the directive.
940 /// \param NumClauses Number of clauses.
942 OMPSingleDirective(SourceLocation StartLoc, SourceLocation EndLoc,
944 : OMPExecutableDirective(this, OMPSingleDirectiveClass, OMPD_single,
945 StartLoc, EndLoc, NumClauses, 1) {}
947 /// \brief Build an empty directive.
949 /// \param NumClauses Number of clauses.
951 explicit OMPSingleDirective(unsigned NumClauses)
952 : OMPExecutableDirective(this, OMPSingleDirectiveClass, OMPD_single,
953 SourceLocation(), SourceLocation(), NumClauses,
957 /// \brief Creates directive with a list of \a Clauses.
959 /// \param C AST context.
960 /// \param StartLoc Starting location of the directive kind.
961 /// \param EndLoc Ending Location of the directive.
962 /// \param Clauses List of clauses.
963 /// \param AssociatedStmt Statement, associated with the directive.
965 static OMPSingleDirective *
966 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
967 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
969 /// \brief Creates an empty directive with the place for \a NumClauses
972 /// \param C AST context.
973 /// \param NumClauses Number of clauses.
975 static OMPSingleDirective *CreateEmpty(const ASTContext &C,
976 unsigned NumClauses, EmptyShell);
978 static bool classof(const Stmt *T) {
979 return T->getStmtClass() == OMPSingleDirectiveClass;
983 /// \brief This represents '#pragma omp master' directive.
986 /// #pragma omp master
989 class OMPMasterDirective : public OMPExecutableDirective {
990 friend class ASTStmtReader;
991 /// \brief Build directive with the given start and end location.
993 /// \param StartLoc Starting location of the directive kind.
994 /// \param EndLoc Ending location of the directive.
996 OMPMasterDirective(SourceLocation StartLoc, SourceLocation EndLoc)
997 : OMPExecutableDirective(this, OMPMasterDirectiveClass, OMPD_master,
998 StartLoc, EndLoc, 0, 1) {}
1000 /// \brief Build an empty directive.
1002 explicit OMPMasterDirective()
1003 : OMPExecutableDirective(this, OMPMasterDirectiveClass, OMPD_master,
1004 SourceLocation(), SourceLocation(), 0, 1) {}
1007 /// \brief Creates directive.
1009 /// \param C AST context.
1010 /// \param StartLoc Starting location of the directive kind.
1011 /// \param EndLoc Ending Location of the directive.
1012 /// \param AssociatedStmt Statement, associated with the directive.
1014 static OMPMasterDirective *Create(const ASTContext &C,
1015 SourceLocation StartLoc,
1016 SourceLocation EndLoc,
1017 Stmt *AssociatedStmt);
1019 /// \brief Creates an empty directive.
1021 /// \param C AST context.
1023 static OMPMasterDirective *CreateEmpty(const ASTContext &C, EmptyShell);
1025 static bool classof(const Stmt *T) {
1026 return T->getStmtClass() == OMPMasterDirectiveClass;
1030 /// \brief This represents '#pragma omp critical' directive.
1033 /// #pragma omp critical
1036 class OMPCriticalDirective : public OMPExecutableDirective {
1037 friend class ASTStmtReader;
1038 /// \brief Name of the directive.
1039 DeclarationNameInfo DirName;
1040 /// \brief Build directive with the given start and end location.
1042 /// \param Name Name of the directive.
1043 /// \param StartLoc Starting location of the directive kind.
1044 /// \param EndLoc Ending location of the directive.
1046 OMPCriticalDirective(const DeclarationNameInfo &Name, SourceLocation StartLoc,
1047 SourceLocation EndLoc)
1048 : OMPExecutableDirective(this, OMPCriticalDirectiveClass, OMPD_critical,
1049 StartLoc, EndLoc, 0, 1),
1052 /// \brief Build an empty directive.
1054 explicit OMPCriticalDirective()
1055 : OMPExecutableDirective(this, OMPCriticalDirectiveClass, OMPD_critical,
1056 SourceLocation(), SourceLocation(), 0, 1),
1059 /// \brief Set name of the directive.
1061 /// \param Name Name of the directive.
1063 void setDirectiveName(const DeclarationNameInfo &Name) { DirName = Name; }
1066 /// \brief Creates directive.
1068 /// \param C AST context.
1069 /// \param Name Name of the directive.
1070 /// \param StartLoc Starting location of the directive kind.
1071 /// \param EndLoc Ending Location of the directive.
1072 /// \param AssociatedStmt Statement, associated with the directive.
1074 static OMPCriticalDirective *
1075 Create(const ASTContext &C, const DeclarationNameInfo &Name,
1076 SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AssociatedStmt);
1078 /// \brief Creates an empty directive.
1080 /// \param C AST context.
1082 static OMPCriticalDirective *CreateEmpty(const ASTContext &C, EmptyShell);
1084 /// \brief Return name of the directive.
1086 DeclarationNameInfo getDirectiveName() const { return DirName; }
1088 static bool classof(const Stmt *T) {
1089 return T->getStmtClass() == OMPCriticalDirectiveClass;
1093 /// \brief This represents '#pragma omp parallel for' directive.
1096 /// #pragma omp parallel for private(a,b) reduction(+:c,d)
1098 /// In this example directive '#pragma omp parallel for' has clauses 'private'
1099 /// with the variables 'a' and 'b' and 'reduction' with operator '+' and
1100 /// variables 'c' and 'd'.
1102 class OMPParallelForDirective : public OMPLoopDirective {
1103 friend class ASTStmtReader;
1104 /// \brief Build directive with the given start and end location.
1106 /// \param StartLoc Starting location of the directive kind.
1107 /// \param EndLoc Ending location of the directive.
1108 /// \param CollapsedNum Number of collapsed nested loops.
1109 /// \param NumClauses Number of clauses.
1111 OMPParallelForDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1112 unsigned CollapsedNum, unsigned NumClauses)
1113 : OMPLoopDirective(this, OMPParallelForDirectiveClass, OMPD_parallel_for,
1114 StartLoc, EndLoc, CollapsedNum, NumClauses) {}
1116 /// \brief Build an empty directive.
1118 /// \param CollapsedNum Number of collapsed nested loops.
1119 /// \param NumClauses Number of clauses.
1121 explicit OMPParallelForDirective(unsigned CollapsedNum, unsigned NumClauses)
1122 : OMPLoopDirective(this, OMPParallelForDirectiveClass, OMPD_parallel_for,
1123 SourceLocation(), SourceLocation(), CollapsedNum,
1127 /// \brief Creates directive with a list of \a Clauses.
1129 /// \param C AST context.
1130 /// \param StartLoc Starting location of the directive kind.
1131 /// \param EndLoc Ending Location of the directive.
1132 /// \param CollapsedNum Number of collapsed loops.
1133 /// \param Clauses List of clauses.
1134 /// \param AssociatedStmt Statement, associated with the directive.
1135 /// \param Exprs Helper expressions for CodeGen.
1137 static OMPParallelForDirective *
1138 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1139 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
1140 Stmt *AssociatedStmt, const HelperExprs &Exprs);
1142 /// \brief Creates an empty directive with the place
1143 /// for \a NumClauses clauses.
1145 /// \param C AST context.
1146 /// \param CollapsedNum Number of collapsed nested loops.
1147 /// \param NumClauses Number of clauses.
1149 static OMPParallelForDirective *CreateEmpty(const ASTContext &C,
1150 unsigned NumClauses,
1151 unsigned CollapsedNum,
1154 static bool classof(const Stmt *T) {
1155 return T->getStmtClass() == OMPParallelForDirectiveClass;
1159 /// \brief This represents '#pragma omp parallel for simd' directive.
1162 /// #pragma omp parallel for simd private(a,b) linear(i,j:s) reduction(+:c,d)
1164 /// In this example directive '#pragma omp parallel for simd' has clauses
1165 /// 'private' with the variables 'a' and 'b', 'linear' with variables 'i', 'j'
1166 /// and linear step 's', 'reduction' with operator '+' and variables 'c' and
1169 class OMPParallelForSimdDirective : public OMPLoopDirective {
1170 friend class ASTStmtReader;
1171 /// \brief Build directive with the given start and end location.
1173 /// \param StartLoc Starting location of the directive kind.
1174 /// \param EndLoc Ending location of the directive.
1175 /// \param CollapsedNum Number of collapsed nested loops.
1176 /// \param NumClauses Number of clauses.
1178 OMPParallelForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1179 unsigned CollapsedNum, unsigned NumClauses)
1180 : OMPLoopDirective(this, OMPParallelForSimdDirectiveClass,
1181 OMPD_parallel_for_simd, StartLoc, EndLoc, CollapsedNum,
1184 /// \brief Build an empty directive.
1186 /// \param CollapsedNum Number of collapsed nested loops.
1187 /// \param NumClauses Number of clauses.
1189 explicit OMPParallelForSimdDirective(unsigned CollapsedNum,
1190 unsigned NumClauses)
1191 : OMPLoopDirective(this, OMPParallelForSimdDirectiveClass,
1192 OMPD_parallel_for_simd, SourceLocation(),
1193 SourceLocation(), CollapsedNum, NumClauses) {}
1196 /// \brief Creates directive with a list of \a Clauses.
1198 /// \param C AST context.
1199 /// \param StartLoc Starting location of the directive kind.
1200 /// \param EndLoc Ending Location of the directive.
1201 /// \param CollapsedNum Number of collapsed loops.
1202 /// \param Clauses List of clauses.
1203 /// \param AssociatedStmt Statement, associated with the directive.
1204 /// \param Exprs Helper expressions for CodeGen.
1206 static OMPParallelForSimdDirective *
1207 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1208 unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
1209 Stmt *AssociatedStmt, const HelperExprs &Exprs);
1211 /// \brief Creates an empty directive with the place
1212 /// for \a NumClauses clauses.
1214 /// \param C AST context.
1215 /// \param CollapsedNum Number of collapsed nested loops.
1216 /// \param NumClauses Number of clauses.
1218 static OMPParallelForSimdDirective *CreateEmpty(const ASTContext &C,
1219 unsigned NumClauses,
1220 unsigned CollapsedNum,
1223 static bool classof(const Stmt *T) {
1224 return T->getStmtClass() == OMPParallelForSimdDirectiveClass;
1228 /// \brief This represents '#pragma omp parallel sections' directive.
1231 /// #pragma omp parallel sections private(a,b) reduction(+:c,d)
1233 /// In this example directive '#pragma omp parallel sections' has clauses
1234 /// 'private' with the variables 'a' and 'b' and 'reduction' with operator '+'
1235 /// and variables 'c' and 'd'.
1237 class OMPParallelSectionsDirective : public OMPExecutableDirective {
1238 friend class ASTStmtReader;
1239 /// \brief Build directive with the given start and end location.
1241 /// \param StartLoc Starting location of the directive kind.
1242 /// \param EndLoc Ending location of the directive.
1243 /// \param NumClauses Number of clauses.
1245 OMPParallelSectionsDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1246 unsigned NumClauses)
1247 : OMPExecutableDirective(this, OMPParallelSectionsDirectiveClass,
1248 OMPD_parallel_sections, StartLoc, EndLoc,
1251 /// \brief Build an empty directive.
1253 /// \param NumClauses Number of clauses.
1255 explicit OMPParallelSectionsDirective(unsigned NumClauses)
1256 : OMPExecutableDirective(this, OMPParallelSectionsDirectiveClass,
1257 OMPD_parallel_sections, SourceLocation(),
1258 SourceLocation(), NumClauses, 1) {}
1261 /// \brief Creates directive with a list of \a Clauses.
1263 /// \param C AST context.
1264 /// \param StartLoc Starting location of the directive kind.
1265 /// \param EndLoc Ending Location of the directive.
1266 /// \param Clauses List of clauses.
1267 /// \param AssociatedStmt Statement, associated with the directive.
1269 static OMPParallelSectionsDirective *
1270 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1271 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
1273 /// \brief Creates an empty directive with the place for \a NumClauses
1276 /// \param C AST context.
1277 /// \param NumClauses Number of clauses.
1279 static OMPParallelSectionsDirective *
1280 CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell);
1282 static bool classof(const Stmt *T) {
1283 return T->getStmtClass() == OMPParallelSectionsDirectiveClass;
1287 /// \brief This represents '#pragma omp task' directive.
1290 /// #pragma omp task private(a,b) final(d)
1292 /// In this example directive '#pragma omp task' has clauses 'private' with the
1293 /// variables 'a' and 'b' and 'final' with condition 'd'.
1295 class OMPTaskDirective : public OMPExecutableDirective {
1296 friend class ASTStmtReader;
1297 /// \brief Build directive with the given start and end location.
1299 /// \param StartLoc Starting location of the directive kind.
1300 /// \param EndLoc Ending location of the directive.
1301 /// \param NumClauses Number of clauses.
1303 OMPTaskDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1304 unsigned NumClauses)
1305 : OMPExecutableDirective(this, OMPTaskDirectiveClass, OMPD_task, StartLoc,
1306 EndLoc, NumClauses, 1) {}
1308 /// \brief Build an empty directive.
1310 /// \param NumClauses Number of clauses.
1312 explicit OMPTaskDirective(unsigned NumClauses)
1313 : OMPExecutableDirective(this, OMPTaskDirectiveClass, OMPD_task,
1314 SourceLocation(), SourceLocation(), NumClauses,
1318 /// \brief Creates directive with a list of \a Clauses.
1320 /// \param C AST context.
1321 /// \param StartLoc Starting location of the directive kind.
1322 /// \param EndLoc Ending Location of the directive.
1323 /// \param Clauses List of clauses.
1324 /// \param AssociatedStmt Statement, associated with the directive.
1326 static OMPTaskDirective *Create(const ASTContext &C, SourceLocation StartLoc,
1327 SourceLocation EndLoc,
1328 ArrayRef<OMPClause *> Clauses,
1329 Stmt *AssociatedStmt);
1331 /// \brief Creates an empty directive with the place for \a NumClauses
1334 /// \param C AST context.
1335 /// \param NumClauses Number of clauses.
1337 static OMPTaskDirective *CreateEmpty(const ASTContext &C, unsigned NumClauses,
1340 static bool classof(const Stmt *T) {
1341 return T->getStmtClass() == OMPTaskDirectiveClass;
1345 /// \brief This represents '#pragma omp taskyield' directive.
1348 /// #pragma omp taskyield
1351 class OMPTaskyieldDirective : public OMPExecutableDirective {
1352 friend class ASTStmtReader;
1353 /// \brief Build directive with the given start and end location.
1355 /// \param StartLoc Starting location of the directive kind.
1356 /// \param EndLoc Ending location of the directive.
1358 OMPTaskyieldDirective(SourceLocation StartLoc, SourceLocation EndLoc)
1359 : OMPExecutableDirective(this, OMPTaskyieldDirectiveClass, OMPD_taskyield,
1360 StartLoc, EndLoc, 0, 0) {}
1362 /// \brief Build an empty directive.
1364 explicit OMPTaskyieldDirective()
1365 : OMPExecutableDirective(this, OMPTaskyieldDirectiveClass, OMPD_taskyield,
1366 SourceLocation(), SourceLocation(), 0, 0) {}
1369 /// \brief Creates directive.
1371 /// \param C AST context.
1372 /// \param StartLoc Starting location of the directive kind.
1373 /// \param EndLoc Ending Location of the directive.
1375 static OMPTaskyieldDirective *
1376 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc);
1378 /// \brief Creates an empty directive.
1380 /// \param C AST context.
1382 static OMPTaskyieldDirective *CreateEmpty(const ASTContext &C, EmptyShell);
1384 static bool classof(const Stmt *T) {
1385 return T->getStmtClass() == OMPTaskyieldDirectiveClass;
1389 /// \brief This represents '#pragma omp barrier' directive.
1392 /// #pragma omp barrier
1395 class OMPBarrierDirective : public OMPExecutableDirective {
1396 friend class ASTStmtReader;
1397 /// \brief Build directive with the given start and end location.
1399 /// \param StartLoc Starting location of the directive kind.
1400 /// \param EndLoc Ending location of the directive.
1402 OMPBarrierDirective(SourceLocation StartLoc, SourceLocation EndLoc)
1403 : OMPExecutableDirective(this, OMPBarrierDirectiveClass, OMPD_barrier,
1404 StartLoc, EndLoc, 0, 0) {}
1406 /// \brief Build an empty directive.
1408 explicit OMPBarrierDirective()
1409 : OMPExecutableDirective(this, OMPBarrierDirectiveClass, OMPD_barrier,
1410 SourceLocation(), SourceLocation(), 0, 0) {}
1413 /// \brief Creates directive.
1415 /// \param C AST context.
1416 /// \param StartLoc Starting location of the directive kind.
1417 /// \param EndLoc Ending Location of the directive.
1419 static OMPBarrierDirective *
1420 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc);
1422 /// \brief Creates an empty directive.
1424 /// \param C AST context.
1426 static OMPBarrierDirective *CreateEmpty(const ASTContext &C, EmptyShell);
1428 static bool classof(const Stmt *T) {
1429 return T->getStmtClass() == OMPBarrierDirectiveClass;
1433 /// \brief This represents '#pragma omp taskwait' directive.
1436 /// #pragma omp taskwait
1439 class OMPTaskwaitDirective : public OMPExecutableDirective {
1440 friend class ASTStmtReader;
1441 /// \brief Build directive with the given start and end location.
1443 /// \param StartLoc Starting location of the directive kind.
1444 /// \param EndLoc Ending location of the directive.
1446 OMPTaskwaitDirective(SourceLocation StartLoc, SourceLocation EndLoc)
1447 : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass, OMPD_taskwait,
1448 StartLoc, EndLoc, 0, 0) {}
1450 /// \brief Build an empty directive.
1452 explicit OMPTaskwaitDirective()
1453 : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass, OMPD_taskwait,
1454 SourceLocation(), SourceLocation(), 0, 0) {}
1457 /// \brief Creates directive.
1459 /// \param C AST context.
1460 /// \param StartLoc Starting location of the directive kind.
1461 /// \param EndLoc Ending Location of the directive.
1463 static OMPTaskwaitDirective *
1464 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc);
1466 /// \brief Creates an empty directive.
1468 /// \param C AST context.
1470 static OMPTaskwaitDirective *CreateEmpty(const ASTContext &C, EmptyShell);
1472 static bool classof(const Stmt *T) {
1473 return T->getStmtClass() == OMPTaskwaitDirectiveClass;
1477 /// \brief This represents '#pragma omp taskgroup' directive.
1480 /// #pragma omp taskgroup
1483 class OMPTaskgroupDirective : public OMPExecutableDirective {
1484 friend class ASTStmtReader;
1485 /// \brief Build directive with the given start and end location.
1487 /// \param StartLoc Starting location of the directive kind.
1488 /// \param EndLoc Ending location of the directive.
1490 OMPTaskgroupDirective(SourceLocation StartLoc, SourceLocation EndLoc)
1491 : OMPExecutableDirective(this, OMPTaskgroupDirectiveClass, OMPD_taskgroup,
1492 StartLoc, EndLoc, 0, 1) {}
1494 /// \brief Build an empty directive.
1496 explicit OMPTaskgroupDirective()
1497 : OMPExecutableDirective(this, OMPTaskgroupDirectiveClass, OMPD_taskgroup,
1498 SourceLocation(), SourceLocation(), 0, 1) {}
1501 /// \brief Creates directive.
1503 /// \param C AST context.
1504 /// \param StartLoc Starting location of the directive kind.
1505 /// \param EndLoc Ending Location of the directive.
1506 /// \param AssociatedStmt Statement, associated with the directive.
1508 static OMPTaskgroupDirective *Create(const ASTContext &C,
1509 SourceLocation StartLoc,
1510 SourceLocation EndLoc,
1511 Stmt *AssociatedStmt);
1513 /// \brief Creates an empty directive.
1515 /// \param C AST context.
1517 static OMPTaskgroupDirective *CreateEmpty(const ASTContext &C, EmptyShell);
1519 static bool classof(const Stmt *T) {
1520 return T->getStmtClass() == OMPTaskgroupDirectiveClass;
1524 /// \brief This represents '#pragma omp flush' directive.
1527 /// #pragma omp flush(a,b)
1529 /// In this example directive '#pragma omp flush' has 2 arguments- variables 'a'
1531 /// 'omp flush' directive does not have clauses but have an optional list of
1532 /// variables to flush. This list of variables is stored within some fake clause
1534 class OMPFlushDirective : public OMPExecutableDirective {
1535 friend class ASTStmtReader;
1536 /// \brief Build directive with the given start and end location.
1538 /// \param StartLoc Starting location of the directive kind.
1539 /// \param EndLoc Ending location of the directive.
1540 /// \param NumClauses Number of clauses.
1542 OMPFlushDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1543 unsigned NumClauses)
1544 : OMPExecutableDirective(this, OMPFlushDirectiveClass, OMPD_flush,
1545 StartLoc, EndLoc, NumClauses, 0) {}
1547 /// \brief Build an empty directive.
1549 /// \param NumClauses Number of clauses.
1551 explicit OMPFlushDirective(unsigned NumClauses)
1552 : OMPExecutableDirective(this, OMPFlushDirectiveClass, OMPD_flush,
1553 SourceLocation(), SourceLocation(), NumClauses,
1557 /// \brief Creates directive with a list of \a Clauses.
1559 /// \param C AST context.
1560 /// \param StartLoc Starting location of the directive kind.
1561 /// \param EndLoc Ending Location of the directive.
1562 /// \param Clauses List of clauses (only single OMPFlushClause clause is
1565 static OMPFlushDirective *Create(const ASTContext &C, SourceLocation StartLoc,
1566 SourceLocation EndLoc,
1567 ArrayRef<OMPClause *> Clauses);
1569 /// \brief Creates an empty directive with the place for \a NumClauses
1572 /// \param C AST context.
1573 /// \param NumClauses Number of clauses.
1575 static OMPFlushDirective *CreateEmpty(const ASTContext &C,
1576 unsigned NumClauses, EmptyShell);
1578 static bool classof(const Stmt *T) {
1579 return T->getStmtClass() == OMPFlushDirectiveClass;
1583 /// \brief This represents '#pragma omp ordered' directive.
1586 /// #pragma omp ordered
1589 class OMPOrderedDirective : public OMPExecutableDirective {
1590 friend class ASTStmtReader;
1591 /// \brief Build directive with the given start and end location.
1593 /// \param StartLoc Starting location of the directive kind.
1594 /// \param EndLoc Ending location of the directive.
1596 OMPOrderedDirective(SourceLocation StartLoc, SourceLocation EndLoc)
1597 : OMPExecutableDirective(this, OMPOrderedDirectiveClass, OMPD_ordered,
1598 StartLoc, EndLoc, 0, 1) {}
1600 /// \brief Build an empty directive.
1602 explicit OMPOrderedDirective()
1603 : OMPExecutableDirective(this, OMPOrderedDirectiveClass, OMPD_ordered,
1604 SourceLocation(), SourceLocation(), 0, 1) {}
1607 /// \brief Creates directive.
1609 /// \param C AST context.
1610 /// \param StartLoc Starting location of the directive kind.
1611 /// \param EndLoc Ending Location of the directive.
1612 /// \param AssociatedStmt Statement, associated with the directive.
1614 static OMPOrderedDirective *Create(const ASTContext &C,
1615 SourceLocation StartLoc,
1616 SourceLocation EndLoc,
1617 Stmt *AssociatedStmt);
1619 /// \brief Creates an empty directive.
1621 /// \param C AST context.
1623 static OMPOrderedDirective *CreateEmpty(const ASTContext &C, EmptyShell);
1625 static bool classof(const Stmt *T) {
1626 return T->getStmtClass() == OMPOrderedDirectiveClass;
1630 /// \brief This represents '#pragma omp atomic' directive.
1633 /// #pragma omp atomic capture
1635 /// In this example directive '#pragma omp atomic' has clause 'capture'.
1637 class OMPAtomicDirective : public OMPExecutableDirective {
1638 friend class ASTStmtReader;
1639 /// \brief Used for 'atomic update' or 'atomic capture' constructs. They may
1640 /// have atomic expressions of forms
1642 /// x = x binop expr;
1643 /// x = expr binop x;
1645 /// This field is true for the first form of the expression and false for the
1646 /// second. Required for correct codegen of non-associative operations (like
1648 bool IsXLHSInRHSPart;
1649 /// \brief Used for 'atomic update' or 'atomic capture' constructs. They may
1650 /// have atomic expressions of forms
1652 /// v = x; <update x>;
1653 /// <update x>; v = x;
1655 /// This field is true for the first(postfix) form of the expression and false
1657 bool IsPostfixUpdate;
1659 /// \brief Build directive with the given start and end location.
1661 /// \param StartLoc Starting location of the directive kind.
1662 /// \param EndLoc Ending location of the directive.
1663 /// \param NumClauses Number of clauses.
1665 OMPAtomicDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1666 unsigned NumClauses)
1667 : OMPExecutableDirective(this, OMPAtomicDirectiveClass, OMPD_atomic,
1668 StartLoc, EndLoc, NumClauses, 5),
1669 IsXLHSInRHSPart(false), IsPostfixUpdate(false) {}
1671 /// \brief Build an empty directive.
1673 /// \param NumClauses Number of clauses.
1675 explicit OMPAtomicDirective(unsigned NumClauses)
1676 : OMPExecutableDirective(this, OMPAtomicDirectiveClass, OMPD_atomic,
1677 SourceLocation(), SourceLocation(), NumClauses,
1679 IsXLHSInRHSPart(false), IsPostfixUpdate(false) {}
1681 /// \brief Set 'x' part of the associated expression/statement.
1682 void setX(Expr *X) { *std::next(child_begin()) = X; }
1683 /// \brief Set helper expression of the form
1684 /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or
1685 /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'.
1686 void setUpdateExpr(Expr *UE) { *std::next(child_begin(), 2) = UE; }
1687 /// \brief Set 'v' part of the associated expression/statement.
1688 void setV(Expr *V) { *std::next(child_begin(), 3) = V; }
1689 /// \brief Set 'expr' part of the associated expression/statement.
1690 void setExpr(Expr *E) { *std::next(child_begin(), 4) = E; }
1693 /// \brief Creates directive with a list of \a Clauses and 'x', 'v' and 'expr'
1694 /// parts of the atomic construct (see Section 2.12.6, atomic Construct, for
1695 /// detailed description of 'x', 'v' and 'expr').
1697 /// \param C AST context.
1698 /// \param StartLoc Starting location of the directive kind.
1699 /// \param EndLoc Ending Location of the directive.
1700 /// \param Clauses List of clauses.
1701 /// \param AssociatedStmt Statement, associated with the directive.
1702 /// \param X 'x' part of the associated expression/statement.
1703 /// \param V 'v' part of the associated expression/statement.
1704 /// \param E 'expr' part of the associated expression/statement.
1705 /// \param UE Helper expression of the form
1706 /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or
1707 /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'.
1708 /// \param IsXLHSInRHSPart true if \a UE has the first form and false if the
1710 /// \param IsPostfixUpdate true if original value of 'x' must be stored in
1711 /// 'v', not an updated one.
1712 static OMPAtomicDirective *
1713 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1714 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, Expr *X, Expr *V,
1715 Expr *E, Expr *UE, bool IsXLHSInRHSPart, bool IsPostfixUpdate);
1717 /// \brief Creates an empty directive with the place for \a NumClauses
1720 /// \param C AST context.
1721 /// \param NumClauses Number of clauses.
1723 static OMPAtomicDirective *CreateEmpty(const ASTContext &C,
1724 unsigned NumClauses, EmptyShell);
1726 /// \brief Get 'x' part of the associated expression/statement.
1727 Expr *getX() { return cast_or_null<Expr>(*std::next(child_begin())); }
1728 const Expr *getX() const {
1729 return cast_or_null<Expr>(*std::next(child_begin()));
1731 /// \brief Get helper expression of the form
1732 /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' or
1733 /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'.
1734 Expr *getUpdateExpr() {
1735 return cast_or_null<Expr>(*std::next(child_begin(), 2));
1737 const Expr *getUpdateExpr() const {
1738 return cast_or_null<Expr>(*std::next(child_begin(), 2));
1740 /// \brief Return true if helper update expression has form
1741 /// 'OpaqueValueExpr(x) binop OpaqueValueExpr(expr)' and false if it has form
1742 /// 'OpaqueValueExpr(expr) binop OpaqueValueExpr(x)'.
1743 bool isXLHSInRHSPart() const { return IsXLHSInRHSPart; }
1744 /// \brief Return true if 'v' expression must be updated to original value of
1745 /// 'x', false if 'v' must be updated to the new value of 'x'.
1746 bool isPostfixUpdate() const { return IsPostfixUpdate; }
1747 /// \brief Get 'v' part of the associated expression/statement.
1748 Expr *getV() { return cast_or_null<Expr>(*std::next(child_begin(), 3)); }
1749 const Expr *getV() const {
1750 return cast_or_null<Expr>(*std::next(child_begin(), 3));
1752 /// \brief Get 'expr' part of the associated expression/statement.
1753 Expr *getExpr() { return cast_or_null<Expr>(*std::next(child_begin(), 4)); }
1754 const Expr *getExpr() const {
1755 return cast_or_null<Expr>(*std::next(child_begin(), 4));
1758 static bool classof(const Stmt *T) {
1759 return T->getStmtClass() == OMPAtomicDirectiveClass;
1763 /// \brief This represents '#pragma omp target' directive.
1766 /// #pragma omp target if(a)
1768 /// In this example directive '#pragma omp target' has clause 'if' with
1771 class OMPTargetDirective : public OMPExecutableDirective {
1772 friend class ASTStmtReader;
1773 /// \brief Build directive with the given start and end location.
1775 /// \param StartLoc Starting location of the directive kind.
1776 /// \param EndLoc Ending location of the directive.
1777 /// \param NumClauses Number of clauses.
1779 OMPTargetDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1780 unsigned NumClauses)
1781 : OMPExecutableDirective(this, OMPTargetDirectiveClass, OMPD_target,
1782 StartLoc, EndLoc, NumClauses, 1) {}
1784 /// \brief Build an empty directive.
1786 /// \param NumClauses Number of clauses.
1788 explicit OMPTargetDirective(unsigned NumClauses)
1789 : OMPExecutableDirective(this, OMPTargetDirectiveClass, OMPD_target,
1790 SourceLocation(), SourceLocation(), NumClauses,
1794 /// \brief Creates directive with a list of \a Clauses.
1796 /// \param C AST context.
1797 /// \param StartLoc Starting location of the directive kind.
1798 /// \param EndLoc Ending Location of the directive.
1799 /// \param Clauses List of clauses.
1800 /// \param AssociatedStmt Statement, associated with the directive.
1802 static OMPTargetDirective *
1803 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1804 ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
1806 /// \brief Creates an empty directive with the place for \a NumClauses
1809 /// \param C AST context.
1810 /// \param NumClauses Number of clauses.
1812 static OMPTargetDirective *CreateEmpty(const ASTContext &C,
1813 unsigned NumClauses, EmptyShell);
1815 static bool classof(const Stmt *T) {
1816 return T->getStmtClass() == OMPTargetDirectiveClass;
1820 /// \brief This represents '#pragma omp teams' directive.
1823 /// #pragma omp teams if(a)
1825 /// In this example directive '#pragma omp teams' has clause 'if' with
1828 class OMPTeamsDirective : public OMPExecutableDirective {
1829 friend class ASTStmtReader;
1830 /// \brief Build directive with the given start and end location.
1832 /// \param StartLoc Starting location of the directive kind.
1833 /// \param EndLoc Ending location of the directive.
1834 /// \param NumClauses Number of clauses.
1836 OMPTeamsDirective(SourceLocation StartLoc, SourceLocation EndLoc,
1837 unsigned NumClauses)
1838 : OMPExecutableDirective(this, OMPTeamsDirectiveClass, OMPD_teams,
1839 StartLoc, EndLoc, NumClauses, 1) {}
1841 /// \brief Build an empty directive.
1843 /// \param NumClauses Number of clauses.
1845 explicit OMPTeamsDirective(unsigned NumClauses)
1846 : OMPExecutableDirective(this, OMPTeamsDirectiveClass, OMPD_teams,
1847 SourceLocation(), SourceLocation(), NumClauses,
1851 /// \brief Creates directive with a list of \a Clauses.
1853 /// \param C AST context.
1854 /// \param StartLoc Starting location of the directive kind.
1855 /// \param EndLoc Ending Location of the directive.
1856 /// \param Clauses List of clauses.
1857 /// \param AssociatedStmt Statement, associated with the directive.
1859 static OMPTeamsDirective *Create(const ASTContext &C, SourceLocation StartLoc,
1860 SourceLocation EndLoc,
1861 ArrayRef<OMPClause *> Clauses,
1862 Stmt *AssociatedStmt);
1864 /// \brief Creates an empty directive with the place for \a NumClauses
1867 /// \param C AST context.
1868 /// \param NumClauses Number of clauses.
1870 static OMPTeamsDirective *CreateEmpty(const ASTContext &C,
1871 unsigned NumClauses, EmptyShell);
1873 static bool classof(const Stmt *T) {
1874 return T->getStmtClass() == OMPTeamsDirectiveClass;
1878 /// \brief This represents '#pragma omp cancellation point' directive.
1881 /// #pragma omp cancellation point for
1884 /// In this example a cancellation point is created for innermost 'for' region.
1885 class OMPCancellationPointDirective : public OMPExecutableDirective {
1886 friend class ASTStmtReader;
1887 OpenMPDirectiveKind CancelRegion;
1888 /// \brief Build directive with the given start and end location.
1890 /// \param StartLoc Starting location of the directive kind.
1891 /// \param EndLoc Ending location of the directive.
1893 OMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc)
1894 : OMPExecutableDirective(this, OMPCancellationPointDirectiveClass,
1895 OMPD_cancellation_point, StartLoc, EndLoc, 0, 0),
1896 CancelRegion(OMPD_unknown) {}
1898 /// \brief Build an empty directive.
1900 explicit OMPCancellationPointDirective()
1901 : OMPExecutableDirective(this, OMPCancellationPointDirectiveClass,
1902 OMPD_cancellation_point, SourceLocation(),
1903 SourceLocation(), 0, 0),
1904 CancelRegion(OMPD_unknown) {}
1906 /// \brief Set cancel region for current cancellation point.
1907 /// \param CR Cancellation region.
1908 void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; }
1911 /// \brief Creates directive.
1913 /// \param C AST context.
1914 /// \param StartLoc Starting location of the directive kind.
1915 /// \param EndLoc Ending Location of the directive.
1917 static OMPCancellationPointDirective *
1918 Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
1919 OpenMPDirectiveKind CancelRegion);
1921 /// \brief Creates an empty directive.
1923 /// \param C AST context.
1925 static OMPCancellationPointDirective *CreateEmpty(const ASTContext &C,
1928 /// \brief Get cancellation region for the current cancellation point.
1929 OpenMPDirectiveKind getCancelRegion() const { return CancelRegion; }
1931 static bool classof(const Stmt *T) {
1932 return T->getStmtClass() == OMPCancellationPointDirectiveClass;
1936 /// \brief This represents '#pragma omp cancel' directive.
1939 /// #pragma omp cancel for
1942 /// In this example a cancel is created for innermost 'for' region.
1943 class OMPCancelDirective : public OMPExecutableDirective {
1944 friend class ASTStmtReader;
1945 OpenMPDirectiveKind CancelRegion;
1946 /// \brief Build directive with the given start and end location.
1948 /// \param StartLoc Starting location of the directive kind.
1949 /// \param EndLoc Ending location of the directive.
1951 OMPCancelDirective(SourceLocation StartLoc, SourceLocation EndLoc)
1952 : OMPExecutableDirective(this, OMPCancelDirectiveClass, OMPD_cancel,
1953 StartLoc, EndLoc, 0, 0),
1954 CancelRegion(OMPD_unknown) {}
1956 /// \brief Build an empty directive.
1958 explicit OMPCancelDirective()
1959 : OMPExecutableDirective(this, OMPCancelDirectiveClass, OMPD_cancel,
1960 SourceLocation(), SourceLocation(), 0, 0),
1961 CancelRegion(OMPD_unknown) {}
1963 /// \brief Set cancel region for current cancellation point.
1964 /// \param CR Cancellation region.
1965 void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; }
1968 /// \brief Creates directive.
1970 /// \param C AST context.
1971 /// \param StartLoc Starting location of the directive kind.
1972 /// \param EndLoc Ending Location of the directive.
1974 static OMPCancelDirective *Create(const ASTContext &C,
1975 SourceLocation StartLoc,
1976 SourceLocation EndLoc,
1977 OpenMPDirectiveKind CancelRegion);
1979 /// \brief Creates an empty directive.
1981 /// \param C AST context.
1983 static OMPCancelDirective *CreateEmpty(const ASTContext &C, EmptyShell);
1985 /// \brief Get cancellation region for the current cancellation point.
1986 OpenMPDirectiveKind getCancelRegion() const { return CancelRegion; }
1988 static bool classof(const Stmt *T) {
1989 return T->getStmtClass() == OMPCancelDirectiveClass;
1993 } // end namespace clang