[PATCH] [OPENMP] Allow to use global variables as lcv in loop-based directives.

Richard Smith richard at metafoo.co.uk
Wed Apr 29 10:49:57 PDT 2015


================
Comment at: include/clang/Sema/Sema.h:7427
@@ -7426,1 +7426,3 @@
 
+  /// \brief Checks if the current region is an OpenMP loop region and if it so,
+  /// marks loop control variable, used in \a Init for loop initialization, as
----------------
Grammar error around "if it so"

================
Comment at: include/clang/Sema/Sema.h:7428
@@ +7427,3 @@
+  /// \brief Checks if the current region is an OpenMP loop region and if it so,
+  /// marks loop control variable, used in \a Init for loop initialization, as
+  /// private by default.
----------------
Use `\p`, not `\a`, for references to function parameters.

================
Comment at: lib/Sema/SemaOpenMP.cpp:2476-2482
@@ +2475,9 @@
+      isOpenMPLoopDirective(DSAStack->getCurrentDirective())) {
+    bool Suppress = getDiagnostics().getSuppressAllDiagnostics();
+    getDiagnostics().setSuppressAllDiagnostics(/*Val=*/true);
+    OpenMPIterationSpaceChecker ISC(*this, ForLoc);
+    if (!ISC.CheckInit(Init)) {
+      DSAStack->addLoopControlVariable(ISC.GetLoopVar());
+    }
+    getDiagnostics().setSuppressAllDiagnostics(Suppress);
+    DSAStack->setCollapseNumber(CollapseIteration - 1);
----------------
Please just pass a flag into `CheckInit` to tell it not to produce diagnostics rather than disabling the diagnostics engine.

http://reviews.llvm.org/D9336

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list