diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2014-06-27 10:37:06 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-06-27 10:37:06 +0000 |
| commit | 3b54d86f4f0bedfffb6305b6f12283f9c62682db (patch) | |
| tree | 04730260ddc52d65d4452d6e651786058fd92015 /include | |
| parent | 11a33cee19725d88b474912665c72835db03a87f (diff) | |
| download | clang-3b54d86f4f0bedfffb6305b6f12283f9c62682db.tar.gz clang-3b54d86f4f0bedfffb6305b6f12283f9c62682db.tar.bz2 clang-3b54d86f4f0bedfffb6305b6f12283f9c62682db.tar.xz | |
[OPENMP] Parsing and sema analysis for 'copyprivate' clause.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211886 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
| -rw-r--r-- | include/clang/AST/DataRecursiveASTVisitor.h | 7 | ||||
| -rw-r--r-- | include/clang/AST/OpenMPClause.h | 60 | ||||
| -rw-r--r-- | include/clang/AST/RecursiveASTVisitor.h | 7 | ||||
| -rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 2 | ||||
| -rw-r--r-- | include/clang/Basic/OpenMPKinds.def | 2 | ||||
| -rw-r--r-- | include/clang/Sema/Sema.h | 12 |
6 files changed, 86 insertions, 4 deletions
diff --git a/include/clang/AST/DataRecursiveASTVisitor.h b/include/clang/AST/DataRecursiveASTVisitor.h index 86d6ca8667..f35d4f2f85 100644 --- a/include/clang/AST/DataRecursiveASTVisitor.h +++ b/include/clang/AST/DataRecursiveASTVisitor.h @@ -2434,6 +2434,13 @@ bool RecursiveASTVisitor<Derived>::VisitOMPCopyinClause(OMPCopyinClause *C) { } template <typename Derived> +bool RecursiveASTVisitor<Derived>::VisitOMPCopyprivateClause( + OMPCopyprivateClause *C) { + VisitOMPClauseList(C); + return true; +} + +template <typename Derived> bool RecursiveASTVisitor<Derived>::VisitOMPReductionClause(OMPReductionClause *C) { TRY_TO(TraverseNestedNameSpecifierLoc(C->getQualifierLoc())); diff --git a/include/clang/AST/OpenMPClause.h b/include/clang/AST/OpenMPClause.h index 46fc4207c9..0b1aaffcf3 100644 --- a/include/clang/AST/OpenMPClause.h +++ b/include/clang/AST/OpenMPClause.h @@ -1218,6 +1218,66 @@ public: } }; +/// \brief This represents clause 'copyprivate' in the '#pragma omp ...' +/// directives. +/// +/// \code +/// #pragma omp single copyprivate(a,b) +/// \endcode +/// In this example directive '#pragma omp single' has clause 'copyprivate' +/// with the variables 'a' and 'b'. +/// +class OMPCopyprivateClause : public OMPVarListClause<OMPCopyprivateClause> { + /// \brief Build clause with number of variables \a N. + /// + /// \param StartLoc Starting location of the clause. + /// \param LParenLoc Location of '('. + /// \param EndLoc Ending location of the clause. + /// \param N Number of the variables in the clause. + /// + OMPCopyprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc, + SourceLocation EndLoc, unsigned N) + : OMPVarListClause<OMPCopyprivateClause>(OMPC_copyprivate, StartLoc, + LParenLoc, EndLoc, N) {} + + /// \brief Build an empty clause. + /// + /// \param N Number of variables. + /// + explicit OMPCopyprivateClause(unsigned N) + : OMPVarListClause<OMPCopyprivateClause>( + OMPC_copyprivate, SourceLocation(), SourceLocation(), + SourceLocation(), N) {} + +public: + /// \brief Creates clause with a list of variables \a VL. + /// + /// \param C AST context. + /// \param StartLoc Starting location of the clause. + /// \param LParenLoc Location of '('. + /// \param EndLoc Ending location of the clause. + /// \param VL List of references to the variables. + /// + static OMPCopyprivateClause * + Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, + SourceLocation EndLoc, ArrayRef<Expr *> VL); + /// \brief Creates an empty clause with \a N variables. + /// + /// \param C AST context. + /// \param N The number of variables. + /// + static OMPCopyprivateClause *CreateEmpty(const ASTContext &C, unsigned N); + + StmtRange children() { + return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()), + reinterpret_cast<Stmt **>(varlist_end())); + } + + static bool classof(const OMPClause *T) { + return T->getClauseKind() == OMPC_copyprivate; + } +}; + } // end namespace clang #endif diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h index 14a957e1cf..cde5adedbd 100644 --- a/include/clang/AST/RecursiveASTVisitor.h +++ b/include/clang/AST/RecursiveASTVisitor.h @@ -2456,6 +2456,13 @@ bool RecursiveASTVisitor<Derived>::VisitOMPCopyinClause(OMPCopyinClause *C) { } template <typename Derived> +bool RecursiveASTVisitor<Derived>::VisitOMPCopyprivateClause( + OMPCopyprivateClause *C) { + VisitOMPClauseList(C); + return true; +} + +template <typename Derived> bool RecursiveASTVisitor<Derived>::VisitOMPReductionClause(OMPReductionClause *C) { TRY_TO(TraverseNestedNameSpecifierLoc(C->getQualifierLoc())); diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 04923dae02..6f671f4d39 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -7026,6 +7026,8 @@ def note_omp_predetermined_dsa : Note< "global variable is predetermined as shared|" "variable with automatic storage duration is predetermined as private}0" "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">; +def note_omp_implicit_dsa : Note< + "implicitly determined as %0">; def err_omp_loop_var_dsa : Error< "loop iteration variable may not be %0">; def err_omp_not_for : Error< diff --git a/include/clang/Basic/OpenMPKinds.def b/include/clang/Basic/OpenMPKinds.def index 67ce712ed5..5eaf15e311 100644 --- a/include/clang/Basic/OpenMPKinds.def +++ b/include/clang/Basic/OpenMPKinds.def @@ -67,6 +67,7 @@ OPENMP_CLAUSE(reduction, OMPReductionClause) OPENMP_CLAUSE(linear, OMPLinearClause) OPENMP_CLAUSE(aligned, OMPAlignedClause) OPENMP_CLAUSE(copyin, OMPCopyinClause) +OPENMP_CLAUSE(copyprivate, OMPCopyprivateClause) OPENMP_CLAUSE(proc_bind, OMPProcBindClause) OPENMP_CLAUSE(schedule, OMPScheduleClause) OPENMP_CLAUSE(ordered, OMPOrderedClause) @@ -111,6 +112,7 @@ OPENMP_SECTIONS_CLAUSE(nowait) // TODO more clauses allowed for directive 'omp single'. OPENMP_SINGLE_CLAUSE(private) OPENMP_SINGLE_CLAUSE(firstprivate) +OPENMP_SINGLE_CLAUSE(copyprivate) OPENMP_SINGLE_CLAUSE(nowait) // Static attributes for 'default' clause. diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index e87a3e6a45..ce3024ec04 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -7279,8 +7279,8 @@ public: Expr *Op); /// \brief Called on start of new data sharing attribute block. void StartOpenMPDSABlock(OpenMPDirectiveKind K, - const DeclarationNameInfo &DirName, - Scope *CurScope); + const DeclarationNameInfo &DirName, Scope *CurScope, + SourceLocation Loc); /// \brief Called on end of data sharing attribute block. void EndOpenMPDSABlock(Stmt *CurDirective); @@ -7300,8 +7300,7 @@ public: ArrayRef<Expr *> VarList); // brief Initialization of captured region for OpenMP region. - void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, SourceLocation Loc, - Scope *CurScope); + void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope); StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, ArrayRef<OMPClause *> Clauses, Stmt *AStmt, @@ -7460,6 +7459,11 @@ public: SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc); + /// \brief Called on well-formed 'copyprivate' clause. + OMPClause *ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList, + SourceLocation StartLoc, + SourceLocation LParenLoc, + SourceLocation EndLoc); /// \brief The kind of conversion being performed. enum CheckedConversionKind { |
