diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2019-10-16 18:09:37 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-10-16 18:09:37 +0000 |
commit | bdbeb873a38db5640831d9110ae45ae50a5a65d5 (patch) | |
tree | 058971113c0cebe30d9685369d423c8a0c3ad078 /include | |
parent | 4da6acb783d62e0d65c3543e874fd8e883ed3370 (diff) | |
download | clang-bdbeb873a38db5640831d9110ae45ae50a5a65d5.tar.gz |
[OPENMP]Allow priority clause in combined task-based directives.
The expression of the priority clause must be captured in the combined
task-based directives, like 'parallel master taskloop' directive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375026 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/AST/OpenMPClause.h | 28 | ||||
-rw-r--r-- | include/clang/AST/RecursiveASTVisitor.h | 1 |
2 files changed, 18 insertions, 11 deletions
diff --git a/include/clang/AST/OpenMPClause.h b/include/clang/AST/OpenMPClause.h index 538b2c6651..b2a2035dcb 100644 --- a/include/clang/AST/OpenMPClause.h +++ b/include/clang/AST/OpenMPClause.h @@ -5206,7 +5206,7 @@ public: /// \endcode /// In this example directive '#pragma omp teams' has clause 'priority' with /// single expression 'n'. -class OMPPriorityClause : public OMPClause { +class OMPPriorityClause : public OMPClause, public OMPClauseWithPreInit { friend class OMPClauseReader; /// Location of '('. @@ -5223,18 +5223,25 @@ class OMPPriorityClause : public OMPClause { public: /// Build 'priority' clause. /// - /// \param E Expression associated with this clause. + /// \param Priority Expression associated with this clause. + /// \param HelperPriority Helper priority for the construct. + /// \param CaptureRegion Innermost OpenMP region where expressions in this + /// clause must be captured. /// \param StartLoc Starting location of the clause. /// \param LParenLoc Location of '('. /// \param EndLoc Ending location of the clause. - OMPPriorityClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, - SourceLocation EndLoc) - : OMPClause(OMPC_priority, StartLoc, EndLoc), LParenLoc(LParenLoc), - Priority(E) {} + OMPPriorityClause(Expr *Priority, Stmt *HelperPriority, + OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, + SourceLocation LParenLoc, SourceLocation EndLoc) + : OMPClause(OMPC_priority, StartLoc, EndLoc), OMPClauseWithPreInit(this), + LParenLoc(LParenLoc), Priority(Priority) { + setPreInitStmt(HelperPriority, CaptureRegion); + } /// Build an empty clause. OMPPriorityClause() - : OMPClause(OMPC_priority, SourceLocation(), SourceLocation()) {} + : OMPClause(OMPC_priority, SourceLocation(), SourceLocation()), + OMPClauseWithPreInit(this) {} /// Sets the location of '('. void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } @@ -5254,11 +5261,10 @@ public: return const_child_range(&Priority, &Priority + 1); } - child_range used_children() { - return child_range(child_iterator(), child_iterator()); - } + child_range used_children(); const_child_range used_children() const { - return const_child_range(const_child_iterator(), const_child_iterator()); + auto Children = const_cast<OMPPriorityClause *>(this)->used_children(); + return const_child_range(Children.begin(), Children.end()); } static bool classof(const OMPClause *T) { diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h index 1de458dccb..951f656270 100644 --- a/include/clang/AST/RecursiveASTVisitor.h +++ b/include/clang/AST/RecursiveASTVisitor.h @@ -3277,6 +3277,7 @@ bool RecursiveASTVisitor<Derived>::VisitOMPThreadLimitClause( template <typename Derived> bool RecursiveASTVisitor<Derived>::VisitOMPPriorityClause( OMPPriorityClause *C) { + TRY_TO(VisitOMPClauseWithPreInit(C)); TRY_TO(TraverseStmt(C->getPriority())); return true; } |