diff options
Diffstat (limited to 'clang/include')
| -rw-r--r-- | clang/include/clang-c/Index.h | 6 | ||||
| -rw-r--r-- | clang/include/clang/AST/RecursiveASTVisitor.h | 3 | ||||
| -rw-r--r-- | clang/include/clang/AST/StmtOpenMP.h | 49 | ||||
| -rw-r--r-- | clang/include/clang/Basic/OpenMPKinds.def | 17 | ||||
| -rw-r--r-- | clang/include/clang/Basic/StmtNodes.td | 1 | ||||
| -rw-r--r-- | clang/include/clang/Sema/Sema.h | 6 | ||||
| -rw-r--r-- | clang/include/clang/Serialization/ASTBitCodes.h | 1 |
7 files changed, 82 insertions, 1 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index 5ff887ea5bc..b653995ebbd 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -2570,7 +2570,11 @@ enum CXCursorKind { */ CXCursor_OMPParallelMasterTaskLoopSimdDirective = 284, - CXCursor_LastStmt = CXCursor_OMPParallelMasterTaskLoopSimdDirective, + /** OpenMP parallel master directive. + */ + CXCursor_OMPParallelMasterDirective = 285, + + CXCursor_LastStmt = CXCursor_OMPParallelMasterDirective, /** * Cursor that represents the translation unit itself. diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h index b30a3937abe..d2144efb58e 100644 --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/include/clang/AST/RecursiveASTVisitor.h @@ -2753,6 +2753,9 @@ DEF_TRAVERSE_STMT(OMPParallelForDirective, DEF_TRAVERSE_STMT(OMPParallelForSimdDirective, { TRY_TO(TraverseOMPExecutableDirective(S)); }) +DEF_TRAVERSE_STMT(OMPParallelMasterDirective, + { TRY_TO(TraverseOMPExecutableDirective(S)); }) + DEF_TRAVERSE_STMT(OMPParallelSectionsDirective, { TRY_TO(TraverseOMPExecutableDirective(S)); }) diff --git a/clang/include/clang/AST/StmtOpenMP.h b/clang/include/clang/AST/StmtOpenMP.h index 9807b3c8f68..cc10f9e4c48 100644 --- a/clang/include/clang/AST/StmtOpenMP.h +++ b/clang/include/clang/AST/StmtOpenMP.h @@ -1842,6 +1842,55 @@ public: } }; +/// This represents '#pragma omp parallel master' directive. +/// +/// \code +/// #pragma omp parallel master private(a,b) +/// \endcode +/// In this example directive '#pragma omp parallel master' has clauses +/// 'private' with the variables 'a' and 'b' +/// +class OMPParallelMasterDirective : public OMPExecutableDirective { + friend class ASTStmtReader; + + OMPParallelMasterDirective(SourceLocation StartLoc, SourceLocation EndLoc, + unsigned NumClauses) + : OMPExecutableDirective(this, OMPParallelMasterDirectiveClass, + OMPD_parallel_master, StartLoc, EndLoc, + NumClauses, 1) {} + + explicit OMPParallelMasterDirective(unsigned NumClauses) + : OMPExecutableDirective(this, OMPParallelMasterDirectiveClass, + OMPD_parallel_master, SourceLocation(), + SourceLocation(), NumClauses, 1) {} + +public: + /// Creates directive with a list of \a Clauses. + /// + /// \param C AST context. + /// \param StartLoc Starting location of the directive kind. + /// \param EndLoc Ending Location of the directive. + /// \param Clauses List of clauses. + /// \param AssociatedStmt Statement, associated with the directive. + /// + static OMPParallelMasterDirective * + Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, + ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt); + + /// Creates an empty directive with the place for \a NumClauses + /// clauses. + /// + /// \param C AST context. + /// \param NumClauses Number of clauses. + /// + static OMPParallelMasterDirective * + CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell); + + static bool classof(const Stmt *T) { + return T->getStmtClass() == OMPParallelMasterDirectiveClass; + } +}; + /// This represents '#pragma omp parallel sections' directive. /// /// \code diff --git a/clang/include/clang/Basic/OpenMPKinds.def b/clang/include/clang/Basic/OpenMPKinds.def index e79a6bf954d..d2bfae4e60c 100644 --- a/clang/include/clang/Basic/OpenMPKinds.def +++ b/clang/include/clang/Basic/OpenMPKinds.def @@ -44,6 +44,9 @@ #ifndef OPENMP_PARALLEL_FOR_SIMD_CLAUSE # define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name) #endif +#ifndef OPENMP_PARALLEL_MASTER_CLAUSE +# define OPENMP_PARALLEL_MASTER_CLAUSE(Name) +#endif #ifndef OPENMP_PARALLEL_SECTIONS_CLAUSE # define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name) #endif @@ -257,6 +260,7 @@ OPENMP_DIRECTIVE_EXT(target_parallel_for, "target parallel for") OPENMP_DIRECTIVE_EXT(target_update, "target update") OPENMP_DIRECTIVE_EXT(parallel_for, "parallel for") OPENMP_DIRECTIVE_EXT(parallel_for_simd, "parallel for simd") +OPENMP_DIRECTIVE_EXT(parallel_master, "parallel master") OPENMP_DIRECTIVE_EXT(parallel_sections, "parallel sections") OPENMP_DIRECTIVE_EXT(for_simd, "for simd") OPENMP_DIRECTIVE_EXT(cancellation_point, "cancellation point") @@ -501,6 +505,18 @@ OPENMP_PARALLEL_FOR_SIMD_CLAUSE(aligned) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(ordered) OPENMP_PARALLEL_FOR_SIMD_CLAUSE(allocate) +// Clauses allowed for OpenMP directive 'parallel master'. +OPENMP_PARALLEL_MASTER_CLAUSE(if) +OPENMP_PARALLEL_MASTER_CLAUSE(num_threads) +OPENMP_PARALLEL_MASTER_CLAUSE(default) +OPENMP_PARALLEL_MASTER_CLAUSE(private) +OPENMP_PARALLEL_MASTER_CLAUSE(firstprivate) +OPENMP_PARALLEL_MASTER_CLAUSE(shared) +OPENMP_PARALLEL_MASTER_CLAUSE(copyin) +OPENMP_PARALLEL_MASTER_CLAUSE(reduction) +OPENMP_PARALLEL_MASTER_CLAUSE(proc_bind) +OPENMP_PARALLEL_MASTER_CLAUSE(allocate) + // Clauses allowed for OpenMP directive 'parallel sections'. OPENMP_PARALLEL_SECTIONS_CLAUSE(if) OPENMP_PARALLEL_SECTIONS_CLAUSE(num_threads) @@ -1131,6 +1147,7 @@ OPENMP_MATCH_KIND(implementation) #undef OPENMP_PARALLEL_CLAUSE #undef OPENMP_PARALLEL_FOR_CLAUSE #undef OPENMP_PARALLEL_FOR_SIMD_CLAUSE +#undef OPENMP_PARALLEL_MASTER_CLAUSE #undef OPENMP_PARALLEL_SECTIONS_CLAUSE #undef OPENMP_TASK_CLAUSE #undef OPENMP_ATOMIC_CLAUSE diff --git a/clang/include/clang/Basic/StmtNodes.td b/clang/include/clang/Basic/StmtNodes.td index 81ab16a83ae..755cd0bf6ed 100644 --- a/clang/include/clang/Basic/StmtNodes.td +++ b/clang/include/clang/Basic/StmtNodes.td @@ -223,6 +223,7 @@ def OMPMasterDirective : StmtNode<OMPExecutableDirective>; def OMPCriticalDirective : StmtNode<OMPExecutableDirective>; def OMPParallelForDirective : StmtNode<OMPLoopDirective>; def OMPParallelForSimdDirective : StmtNode<OMPLoopDirective>; +def OMPParallelMasterDirective : StmtNode<OMPExecutableDirective>; def OMPParallelSectionsDirective : StmtNode<OMPExecutableDirective>; def OMPTaskDirective : StmtNode<OMPExecutableDirective>; def OMPTaskyieldDirective : StmtNode<OMPExecutableDirective>; diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index d666321da66..e678ac5f82e 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -9565,6 +9565,12 @@ public: StmtResult ActOnOpenMPParallelForSimdDirective( ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA); + /// Called on well-formed '\#pragma omp parallel master' after + /// parsing of the associated statement. + StmtResult ActOnOpenMPParallelMasterDirective(ArrayRef<OMPClause *> Clauses, + Stmt *AStmt, + SourceLocation StartLoc, + SourceLocation EndLoc); /// Called on well-formed '\#pragma omp parallel sections' after /// parsing of the associated statement. StmtResult ActOnOpenMPParallelSectionsDirective(ArrayRef<OMPClause *> Clauses, diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h index b1986b2c934..d47ddad2d36 100644 --- a/clang/include/clang/Serialization/ASTBitCodes.h +++ b/clang/include/clang/Serialization/ASTBitCodes.h @@ -1951,6 +1951,7 @@ namespace serialization { STMT_OMP_CRITICAL_DIRECTIVE, STMT_OMP_PARALLEL_FOR_DIRECTIVE, STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE, + STMT_OMP_PARALLEL_MASTER_DIRECTIVE, STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE, STMT_OMP_TASK_DIRECTIVE, STMT_OMP_TASKYIELD_DIRECTIVE, |

