[PATCH] D30135: [OpenMP] Generate better diagnostics for cancel and cancellation point

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 20 03:44:05 PST 2017


ABataev added inline comments.


================
Comment at: lib/Sema/SemaOpenMP.cpp:1959
 
+static bool CheckCancelRegion(Sema &SemaRef, OpenMPDirectiveKind CurrentRegion,
+                              OpenMPDirectiveKind CancelRegion,
----------------
Should be `checkCancelRegion`


================
Comment at: lib/Sema/SemaOpenMP.cpp:1964-1966
+      CurrentRegion != OMPD_cancellation_point) {
+    return false;
+  }
----------------
No need for braces


================
Comment at: lib/Sema/SemaOpenMP.cpp:1968-1973
+  if (CancelRegion != OMPD_parallel && CancelRegion != OMPD_for &&
+      CancelRegion != OMPD_sections && CancelRegion != OMPD_taskgroup) {
+    SemaRef.Diag(StartLoc, diag::err_omp_wrong_cancel_region)
+        << getOpenMPDirectiveName(CancelRegion);
+    return true;
+  }
----------------
It is better to convert this to return `false` and make error message and `return true` statement unconditional


https://reviews.llvm.org/D30135





More information about the cfe-commits mailing list