summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-07-11 11:25:16 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-07-11 11:25:16 +0000
commit9c2e8ee72fe8c99a016a204a2f2b167cd17e188a (patch)
tree813773957814bc63d730a1a0476cb5fa60cf8d2f /clang/lib/AST
parent83442bb8b2e5284276d3eb5a97457401ed61d3f7 (diff)
downloadbcm5719-llvm-9c2e8ee72fe8c99a016a204a2f2b167cd17e188a.tar.gz
bcm5719-llvm-9c2e8ee72fe8c99a016a204a2f2b167cd17e188a.zip
[OPENMP] Parsing and sema analysis for 'omp task' directive.
llvm-svn: 212804
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/Stmt.cpp26
-rw-r--r--clang/lib/AST/StmtPrinter.cpp5
-rw-r--r--clang/lib/AST/StmtProfile.cpp4
3 files changed, 35 insertions, 0 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp
index 9cd3831bf26..b415e9201e5 100644
--- a/clang/lib/AST/Stmt.cpp
+++ b/clang/lib/AST/Stmt.cpp
@@ -1528,3 +1528,29 @@ OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C,
return new (Mem) OMPParallelSectionsDirective(NumClauses);
}
+OMPTaskDirective *OMPTaskDirective::Create(const ASTContext &C,
+ SourceLocation StartLoc,
+ SourceLocation EndLoc,
+ ArrayRef<OMPClause *> Clauses,
+ Stmt *AssociatedStmt) {
+ unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPTaskDirective),
+ llvm::alignOf<OMPClause *>());
+ void *Mem =
+ C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
+ OMPTaskDirective *Dir =
+ new (Mem) OMPTaskDirective(StartLoc, EndLoc, Clauses.size());
+ Dir->setClauses(Clauses);
+ Dir->setAssociatedStmt(AssociatedStmt);
+ return Dir;
+}
+
+OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C,
+ unsigned NumClauses,
+ EmptyShell) {
+ unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPTaskDirective),
+ llvm::alignOf<OMPClause *>());
+ void *Mem =
+ C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
+ return new (Mem) OMPTaskDirective(NumClauses);
+}
+
diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp
index 1d01e655655..03515718323 100644
--- a/clang/lib/AST/StmtPrinter.cpp
+++ b/clang/lib/AST/StmtPrinter.cpp
@@ -826,6 +826,11 @@ void StmtPrinter::VisitOMPParallelSectionsDirective(
PrintOMPExecutableDirective(Node);
}
+void StmtPrinter::VisitOMPTaskDirective(OMPTaskDirective *Node) {
+ Indent() << "#pragma omp task ";
+ PrintOMPExecutableDirective(Node);
+}
+
//===----------------------------------------------------------------------===//
// Expr printing methods.
//===----------------------------------------------------------------------===//
diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp
index db691a93edb..a364f68e305 100644
--- a/clang/lib/AST/StmtProfile.cpp
+++ b/clang/lib/AST/StmtProfile.cpp
@@ -390,6 +390,10 @@ void StmtProfiler::VisitOMPParallelSectionsDirective(
VisitOMPExecutableDirective(S);
}
+void StmtProfiler::VisitOMPTaskDirective(const OMPTaskDirective *S) {
+ VisitOMPExecutableDirective(S);
+}
+
void StmtProfiler::VisitExpr(const Expr *S) {
VisitStmt(S);
}
OpenPOWER on IntegriCloud