From: Valentin Clement Date: Thu, 25 Jun 2020 13:17:15 +0000 (-0400) Subject: [openmp] Use Directive_enumSize instead of OMPD_unknown position X-Git-Tag: llvmorg-12-init~1959 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b9ce07a761f7d62ad793f9827750243de597215;p=platform%2Fupstream%2Fllvm.git [openmp] Use Directive_enumSize instead of OMPD_unknown position Summary: 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. Reviewers: vdmitrie, jdoerfert, jdenny Reviewed By: jdoerfert Subscribers: yaxunl, guansong, sstefan1, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D82518 --- diff --git a/clang/lib/Basic/OpenMPKinds.cpp b/clang/lib/Basic/OpenMPKinds.cpp index a000e4d..87d2c4b 100644 --- a/clang/lib/Basic/OpenMPKinds.cpp +++ b/clang/lib/Basic/OpenMPKinds.cpp @@ -580,7 +580,7 @@ bool clang::isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind) { void clang::getOpenMPCaptureRegions( SmallVectorImpl &CaptureRegions, OpenMPDirectiveKind DKind) { - assert(DKind <= OMPD_unknown); + assert(unsigned(DKind) < llvm::omp::Directive_enumSize); switch (DKind) { case OMPD_parallel: case OMPD_parallel_for: diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index 546a265..9fa57d8 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -194,8 +194,9 @@ static OpenMPDirectiveKindExWrapper parseOpenMPDirectiveKind(Parser &P) { 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 &P) {