@@ -2291,18 +2291,68 @@ class OMPOrderedClause final
22912291// / This represents 'nowait' clause in the '#pragma omp ...' directive.
22922292// /
22932293// / \code
2294- // / #pragma omp for nowait
2294+ // / #pragma omp for nowait (cond)
22952295// / \endcode
2296- // / In this example directive '#pragma omp for' has 'nowait' clause.
2297- class OMPNowaitClause final : public OMPNoChildClause<llvm::omp::OMPC_nowait> {
2296+ // / In this example directive '#pragma omp for' has simple 'nowait' clause with
2297+ // / condition 'cond'.
2298+ class OMPNowaitClause final : public OMPClause {
2299+ friend class OMPClauseReader ;
2300+
2301+ // / Location of '('.
2302+ SourceLocation LParenLoc;
2303+
2304+ // / Condition of the 'nowait' clause.
2305+ Stmt *Condition = nullptr ;
2306+
2307+ // / Set condition.
2308+ void setCondition (Expr *Cond) { Condition = Cond; }
2309+
22982310public:
2299- // / Build 'nowait' clause.
2311+ // / Build 'nowait' clause with condition \a Cond .
23002312 // /
2313+ // / \param Cond Condition of the clause.
23012314 // / \param StartLoc Starting location of the clause.
2315+ // / \param LParenLoc Location of '('.
23022316 // / \param EndLoc Ending location of the clause.
2303- OMPNowaitClause (SourceLocation StartLoc = SourceLocation(),
2304- SourceLocation EndLoc = SourceLocation())
2305- : OMPNoChildClause(StartLoc, EndLoc) {}
2317+ OMPNowaitClause (Expr *Cond, SourceLocation StartLoc, SourceLocation LParenLoc,
2318+ SourceLocation EndLoc)
2319+ : OMPClause(llvm::omp::OMPC_nowait, StartLoc, EndLoc),
2320+ LParenLoc (LParenLoc), Condition(Cond) {}
2321+
2322+ // / Build an empty clause.
2323+ OMPNowaitClause ()
2324+ : OMPClause(llvm::omp::OMPC_nowait, SourceLocation(), SourceLocation()) {}
2325+
2326+ // / Sets the location of '('.
2327+ void setLParenLoc (SourceLocation Loc) { LParenLoc = Loc; }
2328+
2329+ // / Returns the location of '('.
2330+ SourceLocation getLParenLoc () const { return LParenLoc; }
2331+
2332+ // / Returns condition.
2333+ Expr *getCondition () const { return cast_or_null<Expr>(Condition); }
2334+
2335+ child_range children () {
2336+ if (Condition)
2337+ return child_range (&Condition, &Condition + 1 );
2338+ return child_range (child_iterator (), child_iterator ());
2339+ }
2340+
2341+ const_child_range children () const {
2342+ if (Condition)
2343+ return const_child_range (&Condition, &Condition + 1 );
2344+ return const_child_range (const_child_iterator (), const_child_iterator ());
2345+ }
2346+
2347+ child_range used_children ();
2348+ const_child_range used_children () const {
2349+ auto Children = const_cast <OMPNowaitClause *>(this )->used_children ();
2350+ return const_child_range (Children.begin (), Children.end ());
2351+ }
2352+
2353+ static bool classof (const OMPClause *T) {
2354+ return T->getClauseKind () == llvm::omp::OMPC_nowait;
2355+ }
23062356};
23072357
23082358// / This represents 'untied' clause in the '#pragma omp ...' directive.
0 commit comments