diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2015-08-20 10:54:39 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-08-20 10:54:39 +0000 |
| commit | 182227bd5bdc23c82ce90bfcd11b3d8a9575f299 (patch) | |
| tree | 5f1d853042845f536f2bcbfd132fa53fc7676526 /clang/lib/Sema | |
| parent | fcdb1c14ac8e70cf5d92cdc611262c410ead7385 (diff) | |
| download | bcm5719-llvm-182227bd5bdc23c82ce90bfcd11b3d8a9575f299.tar.gz bcm5719-llvm-182227bd5bdc23c82ce90bfcd11b3d8a9575f299.zip | |
[OPENMP 4.1] Initial support for modifiers in 'linear' clause.
OpenMP 4.1 adds 3 optional modifiers to 'linear' clause.
Format of 'linear' clause has changed to:
```
linear(linear-list[ : linear-step])
```
where linear-list is one of the following
```
list
modifier(list)
```
where modifier is one of the following:
```
ref (C++)
val (C/C++)
uval (C++)
```
Patch adds parsing and sema analysis for these modifiers.
llvm-svn: 245550
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 25 | ||||
| -rw-r--r-- | clang/lib/Sema/TreeTransform.h | 11 |
2 files changed, 22 insertions, 14 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index ddfb2d246e2..33bc621afab 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -5254,7 +5254,7 @@ OMPClause *Sema::ActOnOpenMPVarListClause( SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, OpenMPDependClauseKind DepKind, - SourceLocation DepLoc) { + OpenMPLinearClauseKind LinKind, SourceLocation DepLinLoc) { OMPClause *Res = nullptr; switch (Kind) { case OMPC_private: @@ -5275,7 +5275,7 @@ OMPClause *Sema::ActOnOpenMPVarListClause( break; case OMPC_linear: Res = ActOnOpenMPLinearClause(VarList, TailExpr, StartLoc, LParenLoc, - ColonLoc, EndLoc); + LinKind, DepLinLoc, ColonLoc, EndLoc); break; case OMPC_aligned: Res = ActOnOpenMPAlignedClause(VarList, TailExpr, StartLoc, LParenLoc, @@ -5291,7 +5291,7 @@ OMPClause *Sema::ActOnOpenMPVarListClause( Res = ActOnOpenMPFlushClause(VarList, StartLoc, LParenLoc, EndLoc); break; case OMPC_depend: - Res = ActOnOpenMPDependClause(DepKind, DepLoc, ColonLoc, VarList, StartLoc, + Res = ActOnOpenMPDependClause(DepKind, DepLinLoc, ColonLoc, VarList, StartLoc, LParenLoc, EndLoc); break; case OMPC_if: @@ -6313,14 +6313,18 @@ OMPClause *Sema::ActOnOpenMPReductionClause( RHSs, ReductionOps); } -OMPClause *Sema::ActOnOpenMPLinearClause(ArrayRef<Expr *> VarList, Expr *Step, - SourceLocation StartLoc, - SourceLocation LParenLoc, - SourceLocation ColonLoc, - SourceLocation EndLoc) { +OMPClause *Sema::ActOnOpenMPLinearClause( + ArrayRef<Expr *> VarList, Expr *Step, SourceLocation StartLoc, + SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, + SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation EndLoc) { SmallVector<Expr *, 8> Vars; SmallVector<Expr *, 8> Privates; SmallVector<Expr *, 8> Inits; + if ((!LangOpts.CPlusPlus && LinKind != OMPC_LINEAR_val) || + LinKind == OMPC_LINEAR_unknown) { + Diag(LinLoc, diag::err_omp_wrong_linear_modifier) << LangOpts.CPlusPlus; + LinKind = OMPC_LINEAR_val; + } for (auto &RefExpr : VarList) { assert(RefExpr && "NULL expr in OpenMP linear clause."); if (isa<DependentScopeDeclRefExpr>(RefExpr)) { @@ -6459,8 +6463,9 @@ OMPClause *Sema::ActOnOpenMPLinearClause(ArrayRef<Expr *> VarList, Expr *Step, } } - return OMPLinearClause::Create(Context, StartLoc, LParenLoc, ColonLoc, EndLoc, - Vars, Privates, Inits, StepExpr, CalcStepExpr); + return OMPLinearClause::Create(Context, StartLoc, LParenLoc, LinKind, LinLoc, + ColonLoc, EndLoc, Vars, Privates, Inits, + StepExpr, CalcStepExpr); } static bool FinishOpenMPLinearClause(OMPLinearClause &Clause, DeclRefExpr *IV, diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index d285db597c4..7cc7b779724 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -1528,10 +1528,13 @@ public: OMPClause *RebuildOMPLinearClause(ArrayRef<Expr *> VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, + OpenMPLinearClauseKind Modifier, + SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc) { return getSema().ActOnOpenMPLinearClause(VarList, Step, StartLoc, LParenLoc, - ColonLoc, EndLoc); + Modifier, ModifierLoc, ColonLoc, + EndLoc); } /// \brief Build a new OpenMP 'aligned' clause. @@ -7419,9 +7422,9 @@ TreeTransform<Derived>::TransformOMPLinearClause(OMPLinearClause *C) { ExprResult Step = getDerived().TransformExpr(C->getStep()); if (Step.isInvalid()) return nullptr; - return getDerived().RebuildOMPLinearClause(Vars, Step.get(), C->getLocStart(), - C->getLParenLoc(), - C->getColonLoc(), C->getLocEnd()); + return getDerived().RebuildOMPLinearClause( + Vars, Step.get(), C->getLocStart(), C->getLParenLoc(), C->getModifier(), + C->getModifierLoc(), C->getColonLoc(), C->getLocEnd()); } template <typename Derived> |

