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

2020-06-25 Thread Valentin Clement via Phabricator via cfe-commits
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=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(DKind)
-  : OMPD_unknown;
+  return unsigned(DKind) < llvm::omp::Directive_enumSize
+ ? static_cast(DKind)
+ : OMPD_unknown;
 }
 
 static DeclarationName parseOpenMPReductionId(Parser ) {
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 DKind) {
-  assert(DKind <= OMPD_unknown);
+  assert(unsigned(DKind) < llvm::omp::Directive_enumSize);
   switch (DKind) {
   case OMPD_parallel:
   case OMPD_parallel_for:


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(DKind)
-  : OMPD_unknown;
+  return unsigned(DKind) < llvm::omp::Directive_enumSize
+ ? static_cast(DKind)
+ : OMPD_unknown;
 }
 
 static DeclarationName parseOpenMPReductionId(Parser ) {
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 DKind) {
-  assert(DKind <= OMPD_unknown);
+  assert(unsigned(DKind) < llvm::omp::Directive_enumSize);
   switch (DKind) {
   case OMPD_parallel:
   case OMPD_parallel_for:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2020-06-25 Thread Valentin Clement via Phabricator via cfe-commits
clementval marked 2 inline comments as done.
clementval added inline comments.



Comment at: clang/lib/Basic/OpenMPKinds.cpp:583
 OpenMPDirectiveKind DKind) {
-  assert(DKind <= OMPD_unknown);
+  assert(unsigned(DKind) <= llvm::omp::Directive_enumSize);
   switch (DKind) {

jdoerfert wrote:
> `<`, right?
You are right.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82518



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2020-06-24 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

LGTM, maybe a minor adjustment necessary.




Comment at: clang/lib/Basic/OpenMPKinds.cpp:583
 OpenMPDirectiveKind DKind) {
-  assert(DKind <= OMPD_unknown);
+  assert(unsigned(DKind) <= llvm::omp::Directive_enumSize);
   switch (DKind) {

`<`, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82518



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2020-06-24 Thread Valentin Clement via Phabricator via cfe-commits
clementval updated this revision to Diff 273216.
clementval added a comment.

add unsigned cast


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(DKind)
-  : OMPD_unknown;
+  return unsigned(DKind) < llvm::omp::Directive_enumSize
+ ? static_cast(DKind)
+ : OMPD_unknown;
 }
 
 static DeclarationName parseOpenMPReductionId(Parser ) {
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 DKind) {
-  assert(DKind <= OMPD_unknown);
+  assert(unsigned(DKind) <= llvm::omp::Directive_enumSize);
   switch (DKind) {
   case OMPD_parallel:
   case OMPD_parallel_for:


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(DKind)
-  : OMPD_unknown;
+  return unsigned(DKind) < llvm::omp::Directive_enumSize
+ ? static_cast(DKind)
+ : OMPD_unknown;
 }
 
 static DeclarationName parseOpenMPReductionId(Parser ) {
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 DKind) {
-  assert(DKind <= OMPD_unknown);
+  assert(unsigned(DKind) <= llvm::omp::Directive_enumSize);
   switch (DKind) {
   case OMPD_parallel:
   case OMPD_parallel_for:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2020-06-24 Thread Valentin Clement via Phabricator via cfe-commits
clementval created this revision.
clementval added reviewers: vdmitrie, jdoerfert, jdenny.
Herald added subscribers: cfe-commits, sstefan1, guansong, yaxunl.
Herald added a project: clang.

Previously OMPD_unknown was last item in the Directive enumeration and its 
position was
used in various comparison and assertion. With the new Directive enumeration, 
this should be
change with  llvm::omp::Directive_enumSize. This patch fix two place where it 
was not done in
D81736 .


Repository:
  rG LLVM Github Monorepo

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(DKind)
-  : OMPD_unknown;
+  return DKind < llvm::omp::Directive_enumSize
+ ? static_cast(DKind)
+ : OMPD_unknown;
 }
 
 static DeclarationName parseOpenMPReductionId(Parser ) {
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 DKind) {
-  assert(DKind <= OMPD_unknown);
+  assert(DKind <= llvm::omp::Directive_enumSize);
   switch (DKind) {
   case OMPD_parallel:
   case OMPD_parallel_for:


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(DKind)
-  : OMPD_unknown;
+  return DKind < llvm::omp::Directive_enumSize
+ ? static_cast(DKind)
+ : OMPD_unknown;
 }
 
 static DeclarationName parseOpenMPReductionId(Parser ) {
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 DKind) {
-  assert(DKind <= OMPD_unknown);
+  assert(DKind <= llvm::omp::Directive_enumSize);
   switch (DKind) {
   case OMPD_parallel:
   case OMPD_parallel_for:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits