[PATCH] D69853: [OpenMP][NFCI] Introduce llvm/IR/OpenMPConstants.h

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 5 09:05:36 PST 2019


ABataev added inline comments.


================
Comment at: clang/lib/Basic/OpenMPKinds.cpp:408
                                         OpenMPClauseKind CKind) {
-  assert(DKind <= OMPD_unknown);
   assert(CKind <= OMPC_unknown);
----------------
Why assert is removed?


================
Comment at: clang/lib/Parse/ParseOpenMP.cpp:51-60
+// Helper to unify the enum class OpenMPDirectiveKind with its extension
+// OpenMPDirectiveKindEx.
+struct OpenMPDirectiveKindExWrapper {
+  OpenMPDirectiveKindExWrapper(OpenMPDirectiveKind DK) : Value(unsigned(DK)) {}
+  OpenMPDirectiveKindExWrapper(OpenMPDirectiveKindEx DKE)
+      : Value(unsigned(DKE)) {}
+  operator unsigned() const { return Value; }
----------------
Why do we need this?


================
Comment at: llvm/include/llvm/IR/OpenMPConstants.h:40
+/// Return a textual representation of the directive \p D.
+const char *getOpenMPDirectiveName(Directive D);
+
----------------
1. Better to return StringRef, I think.
2. Do we really need these 2 convert functions here? Are we going to use them in LLVM or just in clang?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69853





More information about the llvm-commits mailing list