[PATCH] D109635: [WIP][OpenMP] Support construct trait set for Clang

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 13 16:06:26 PDT 2021


jdoerfert added inline comments.


================
Comment at: clang/lib/AST/OpenMPClause.cpp:2488
+    addTrait(Property);
+  }
 }
----------------
Nit: no braces.


================
Comment at: clang/lib/Parse/ParseOpenMP.cpp:2052
+        /* CurrentFunctionDecl */ nullptr,
+        /* ConstructTraits */ ArrayRef<llvm::omp::TraitProperty>());
 
----------------
`{}` might do it but this is fine too.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:746
+        }
+      }
+  }
----------------
So, SmalVector has a pop_back_val which we could use to verify the properties are the ones we expect. However, we would need to first put them into a vector and if insert is false we would need to reverse the vector.
Maybe that's the way to go:
1) Where you call `handleConstructTrait` right now, just put the traits in a vector.
2) Make it `handleConstructTraits` and take a vector of construct traits.
3) For insert == true, just append them all.
4) For insert == falser reverse the vector and do pop_back_val with an assertion that they match the result of vector.pop_back_val();

Does that make sense?

(Apologies for making you rewrite this twice.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109635



More information about the cfe-commits mailing list