diff options
Diffstat (limited to 'clang/lib/AST')
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 24 | ||||
-rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 11 | ||||
-rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 3 |
3 files changed, 38 insertions, 0 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index 6f4a89fee39..8694cf3e22c 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -1579,6 +1579,30 @@ OMPFlushClause *OMPFlushClause::CreateEmpty(const ASTContext &C, unsigned N) { return new (Mem) OMPFlushClause(N); } +OMPDependClause * +OMPDependClause::Create(const ASTContext &C, SourceLocation StartLoc, + SourceLocation LParenLoc, SourceLocation EndLoc, + OpenMPDependClauseKind DepKind, SourceLocation DepLoc, + SourceLocation ColonLoc, ArrayRef<Expr *> VL) { + void *Mem = C.Allocate(llvm::RoundUpToAlignment(sizeof(OMPDependClause), + llvm::alignOf<Expr *>()) + + sizeof(Expr *) * VL.size()); + OMPDependClause *Clause = + new (Mem) OMPDependClause(StartLoc, LParenLoc, EndLoc, VL.size()); + Clause->setVarRefs(VL); + Clause->setDependencyKind(DepKind); + Clause->setDependencyLoc(DepLoc); + Clause->setColonLoc(ColonLoc); + return Clause; +} + +OMPDependClause *OMPDependClause::CreateEmpty(const ASTContext &C, unsigned N) { + void *Mem = C.Allocate(llvm::RoundUpToAlignment(sizeof(OMPDependClause), + llvm::alignOf<Expr *>()) + + sizeof(Expr *) * N); + return new (Mem) OMPDependClause(N); +} + const OMPClause * OMPExecutableDirective::getSingleClause(OpenMPClauseKind K) const { auto &&I = getClausesOfKind(K); diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 658e3dfdeed..a82d104d7aa 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -799,6 +799,17 @@ void OMPClausePrinter::VisitOMPFlushClause(OMPFlushClause *Node) { OS << ")"; } } + +void OMPClausePrinter::VisitOMPDependClause(OMPDependClause *Node) { + if (!Node->varlist_empty()) { + OS << "depend("; + OS << getOpenMPSimpleClauseTypeName(Node->getClauseKind(), + Node->getDependencyKind()) + << " :"; + VisitOMPClauseList(Node, ' '); + OS << ")"; + } +} } //===----------------------------------------------------------------------===// diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index 23f8d0c8be7..8a48ee267f0 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -425,6 +425,9 @@ OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) { void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) { VisitOMPClauseList(C); } +void OMPClauseProfiler::VisitOMPDependClause(const OMPDependClause *C) { + VisitOMPClauseList(C); +} } void |