[OpenMP] Check for at least one map clause on target data directive.
Summary:
Adds the following restriction in the OpenMP specifications.
OpenMP [2.10.1, Restrictions, p. 97]
At least one map clause must appear on the directive.
Reviewers: ABataev
Differential Revision: http://reviews.llvm.org/D16341
llvm-svn: 258425
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 3273bd1..40c8c18 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -5618,6 +5618,14 @@
assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");
+ // OpenMP [2.10.1, Restrictions, p. 97]
+ // At least one map clause must appear on the directive.
+ if (!HasMapClause(Clauses)) {
+ Diag(StartLoc, diag::err_omp_no_map_for_directive) <<
+ getOpenMPDirectiveName(OMPD_target_data);
+ return StmtError();
+ }
+
getCurFunction()->setHasBranchProtectedScope();
return OMPTargetDataDirective::Create(Context, StartLoc, EndLoc, Clauses,