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/AST | |
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/AST')
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 5 | ||||
-rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index 175526a9313..e8a02eee7f8 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -1343,6 +1343,7 @@ void OMPLinearClause::setFinals(ArrayRef<Expr *> FL) { OMPLinearClause *OMPLinearClause::Create( const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, + OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> PL, ArrayRef<Expr *> IL, Expr *Step, Expr *CalcStep) { // Allocate space for 4 lists (Vars, Inits, Updates, Finals) and 2 expressions @@ -1350,8 +1351,8 @@ OMPLinearClause *OMPLinearClause::Create( void *Mem = C.Allocate(llvm::RoundUpToAlignment(sizeof(OMPLinearClause), llvm::alignOf<Expr *>()) + (5 * VL.size() + 2) * sizeof(Expr *)); - OMPLinearClause *Clause = new (Mem) - OMPLinearClause(StartLoc, LParenLoc, ColonLoc, EndLoc, VL.size()); + OMPLinearClause *Clause = new (Mem) OMPLinearClause( + StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc, EndLoc, VL.size()); Clause->setVarRefs(VL); Clause->setPrivates(PL); Clause->setInits(IL); diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 64f90ba951d..fb5fcc4902d 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -767,7 +767,13 @@ void OMPClausePrinter::VisitOMPReductionClause(OMPReductionClause *Node) { void OMPClausePrinter::VisitOMPLinearClause(OMPLinearClause *Node) { if (!Node->varlist_empty()) { OS << "linear"; + if (Node->getModifierLoc().isValid()) { + OS << '(' + << getOpenMPSimpleClauseTypeName(OMPC_linear, Node->getModifier()); + } VisitOMPClauseList(Node, '('); + if (Node->getModifierLoc().isValid()) + OS << ')'; if (Node->getStep() != nullptr) { OS << ": "; Node->getStep()->printPretty(OS, nullptr, Policy, 0); |