[PATCH] D15989: [OpenMP] Parsing + sema for "target enter data" and "target exit data" directives.

Arpith Jacob via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 7 18:50:03 PST 2016


arpith-jacob added inline comments.

================
Comment at: lib/Parse/ParseOpenMP.cpp:42
@@ -37,1 +41,3 @@
+      {OMPD_unknown /*target exit*/, OMPD_unknown /*data*/,
+       OMPD_target_exit_data},
       {OMPD_for, OMPD_simd, OMPD_for_simd},
----------------
I have written this code based on the comments in the 'target data' patch and also the approach to parsing 'cancellation'.  This requires hard coded array index numbers below (see diff with cancellation and point tokens).  If anyone can suggest better alternatives I will be happy to rework the code.

================
Comment at: lib/Sema/SemaOpenMP.cpp:5918
@@ -5866,1 +5917,3 @@
+}
+
 OMPClause *Sema::ActOnOpenMPSafelenClause(Expr *Len, SourceLocation StartLoc,
----------------
This method is required to ensure that target enter/exit directives always have a map clause.  It can be reused by other directives such as target data.

================
Comment at: lib/Sema/SemaOpenMP.cpp:8507
@@ +8506,3 @@
+      Diag(StartLoc, diag::err_omp_invalid_map_type_for_directive) <<
+          static_cast<unsigned>(IsMapTypeImplicit) <<
+          getOpenMPSimpleClauseTypeName(OMPC_map, MapType) <<
----------------
I have to capture 'IsMapTypeImplicit' from the parser for more informative error messages.  This helps me support the following case:

#pragma omp target enter data map(r) // expected-error {{map type must be specified for '#pragma omp target enter data'}}

and distinguish it from:

#pragma omp target enter data map(tofrom: r) // expected-error {{map type 'tofrom' is not allowed for '#pragma omp target enter data'}}

================
Comment at: lib/Sema/SemaOpenMP.cpp:8510
@@ +8509,3 @@
+          getOpenMPDirectiveName(DKind);
+      // Proceed to add the variable in a map clause anyway, to prevent
+      // further spurious messages
----------------
This error occurs when the user specifies an invalid map type.  After reporting the error I proceed to retain the clause so that it doesn't trigger the 'map clause not present' error.


http://reviews.llvm.org/D15989





More information about the cfe-commits mailing list