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
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:
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) {