[PATCH] D66559: [OPENMP] Update the diagnosis message for canonical loop form
Chi Chun Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 28 13:20:40 PDT 2019
cchen updated this revision to Diff 217710.
cchen added a comment.
Update the diagnosis message for canonical loop form based on OpenMP version
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66559/new/
https://reviews.llvm.org/D66559
Files:
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaOpenMP.cpp
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -5413,12 +5413,15 @@
bool OpenMPIterationSpaceChecker::checkAndSetCond(Expr *S) {
// Check test-expr for canonical form, save upper-bound UB, flags for
// less/greater and for strict/non-strict comparison.
- // OpenMP [2.6] Canonical loop form. Test-expr may be one of the following:
+ // OpenMP [2.9] Canonical loop form. Test-expr may be one of the following:
// var relational-op b
// b relational-op var
//
if (!S) {
- SemaRef.Diag(DefaultLoc, diag::err_omp_loop_not_canonical_cond) << LCDecl;
+ if (SemaRef.getLangOpts().OpenMP < 50)
+ SemaRef.Diag(DefaultLoc, diag::err_omp_before_50_loop_not_canonical_cond) << LCDecl;
+ else
+ SemaRef.Diag(DefaultLoc, diag::err_omp_after_50_loop_not_canonical_cond) << LCDecl;
return true;
}
Condition = S;
@@ -5474,8 +5477,12 @@
}
if (dependent() || SemaRef.CurContext->isDependentContext())
return false;
- SemaRef.Diag(CondLoc, diag::err_omp_loop_not_canonical_cond)
- << S->getSourceRange() << LCDecl;
+ if (SemaRef.getLangOpts().OpenMP < 50)
+ SemaRef.Diag(CondLoc, diag::err_omp_before_50_loop_not_canonical_cond)
+ << S->getSourceRange() << LCDecl;
+ else
+ SemaRef.Diag(CondLoc, diag::err_omp_after_50_loop_not_canonical_cond)
+ << S->getSourceRange() << LCDecl;
return true;
}
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -9024,9 +9024,12 @@
def ext_omp_loop_not_canonical_init : ExtWarn<
"initialization clause of OpenMP for loop is not in canonical form "
"('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
-def err_omp_loop_not_canonical_cond : Error<
+def err_omp_before_50_loop_not_canonical_cond : Error<
"condition of OpenMP for loop must be a relational comparison "
- "('<', '<=', '>', or '>=') of loop variable %0">;
+ "('<', '<=', '>', or '>=') of loop variable %0">;
+def err_omp_after_50_loop_not_canonical_cond : Error<
+ "condition of OpenMP for loop must be a relational comparison "
+ "('<', '<=', '>', '>=', or '!=') of loop variable %0">;
def err_omp_loop_not_canonical_incr : Error<
"increment clause of OpenMP for loop must perform simple addition "
"or subtraction on loop variable %0">;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66559.217710.patch
Type: text/x-patch
Size: 2531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190828/48f3e8bc/attachment.bin>
More information about the cfe-commits
mailing list