[PATCH] D141871: [Clang][OpenMP] Add parse and sema for iterator map modifier

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 17 07:07:26 PST 2023


ABataev added a comment.

Erroneous test are required



================
Comment at: clang/include/clang/AST/OpenMPClause.h:310-314
+  /// Fetches list of variables associated with this clause.
+  Expr *getIteratorRef() {
+    return (static_cast<T *>(this)
+                ->template getTrailingObjects<Expr *>())[2 * NumVars];
+  }
----------------
Why do we need it here, if it is specific to map clause?


================
Comment at: clang/include/clang/AST/OpenMPClause.h:317
+  /// Sets the list of variables for this clause.
+  void setIteratorRef(ArrayRef<Expr *> IL) {
+    assert(IL.size() == 1 && "Number of iterator expressions must be 1");
----------------
Why ArrayRef if only one expression is expected?


================
Comment at: clang/include/clang/AST/OpenMPClause.h:5940-5942
+    if (HasIteratorModifier)
+      return getIteratorRef();
+    return nullptr;
----------------
Just `getIteratorRef()` should be enough.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:1166-1169
+    for (auto *IteratorVD : Top->IteratorVarDecls)
+      if (IteratorVD == VD->getCanonicalDecl())
+        return true;
+    return false;
----------------
Use llvm::any_of()


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141871/new/

https://reviews.llvm.org/D141871



More information about the cfe-commits mailing list