[PATCH] [OPENMP] Parsing and sema support for #pragma omp target data" directive.

Alexey Bataev a.bataev at hotmail.com
Sat Jun 27 00:06:26 PDT 2015


================
Comment at: include/clang/AST/OpenMPClause.h:21
@@ -20,2 +20,3 @@
 #include "clang/AST/Stmt.h"
+#include "clang/AST/PrettyPrinter.h"
 #include "clang/Basic/OpenMPKinds.h"
----------------
Header file is not required, remove

================
Comment at: include/clang/AST/OpenMPClause.h:131
@@ -129,2 +130,3 @@
   varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
+  unsigned numberOfVariables() const { return NumVars; }
 
----------------
Method is not used, so it must be removed

================
Comment at: include/clang/AST/StmtOpenMP.h:1821
@@ +1820,3 @@
+    : OMPExecutableDirective(this, OMPTargetDataDirectiveClass, 
+            OMPD_target_data, StartLoc, EndLoc, NumClauses, 1) {}
+
----------------
Some of your changes are not formatted, use clang-format tool.

================
Comment at: include/clang/Sema/Sema.h:7765-7767
@@ -7763,1 +7764,5 @@
+  /// the associated statement.
+  StmtResult ActOnOpenMPTargetDataDirective(ArrayRef<OMPClause *> Clauses,
+                                        Stmt *AStmt, SourceLocation StartLoc,
+                                        SourceLocation EndLoc);
   /// \brief Called on well-formed '\#pragma omp teams' after parsing of the
----------------
Format

================
Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2100
@@ +2099,3 @@
+        const OMPTargetDataDirective &S) {
+  llvm_unreachable("CodeGen for 'omp target data' is not supported yet.");
+}
----------------
I think all target related directives should just emit original code at first, so the user could use them.

================
Comment at: lib/Parse/ParseOpenMP.cpp:43-55
@@ -42,2 +42,15 @@
           : getOpenMPDirectiveKind(P.getPreprocessor().getSpelling(Tok));
+
+  switch (DKind) {
+  case OMPD_target: {
+    auto SavedToken = P.getPreprocessor().LookAhead(0);
+    if (!SavedToken.isAnnotation()) {
+      if (P.getPreprocessor().getSpelling(SavedToken) == "data") {
+        DKind = OMPD_target_data;
+        P.ConsumeToken();
+      }
+    }
+    break;
+  }
+  default:
   for (unsigned i = 0; i < llvm::array_lengthof(F); ++i) {
----------------
This code is copied from clang-omp, we're using another solution in official clang. See the patch for 'declare simd' construct (http://reviews.llvm.org/D10599)

http://reviews.llvm.org/D10765

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list