[PATCH] D82518: [openmp] Use Directive_enumSize instead of OMPD_unknown position

Valentin Clement via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 25 06:20:45 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5b9ce07a761f: [openmp] Use Directive_enumSize instead of OMPD_unknown position (authored by clementval).

Changed prior to commit:
  https://reviews.llvm.org/D82518?vs=273216&id=273327#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82518

Files:
  clang/lib/Basic/OpenMPKinds.cpp
  clang/lib/Parse/ParseOpenMP.cpp


Index: clang/lib/Parse/ParseOpenMP.cpp
===================================================================
--- clang/lib/Parse/ParseOpenMP.cpp
+++ clang/lib/Parse/ParseOpenMP.cpp
@@ -194,8 +194,9 @@
       DKind = F[I][2];
     }
   }
-  return DKind < OMPD_unknown ? static_cast<OpenMPDirectiveKind>(DKind)
-                              : OMPD_unknown;
+  return unsigned(DKind) < llvm::omp::Directive_enumSize
+             ? static_cast<OpenMPDirectiveKind>(DKind)
+             : OMPD_unknown;
 }
 
 static DeclarationName parseOpenMPReductionId(Parser &P) {
Index: clang/lib/Basic/OpenMPKinds.cpp
===================================================================
--- clang/lib/Basic/OpenMPKinds.cpp
+++ clang/lib/Basic/OpenMPKinds.cpp
@@ -580,7 +580,7 @@
 void clang::getOpenMPCaptureRegions(
     SmallVectorImpl<OpenMPDirectiveKind> &CaptureRegions,
     OpenMPDirectiveKind DKind) {
-  assert(DKind <= OMPD_unknown);
+  assert(unsigned(DKind) < llvm::omp::Directive_enumSize);
   switch (DKind) {
   case OMPD_parallel:
   case OMPD_parallel_for:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82518.273327.patch
Type: text/x-patch
Size: 1058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200625/f5492fe1/attachment.bin>


More information about the cfe-commits mailing list