[flang-commits] [flang] [flang][cuda] Allow list-directed PRINT and WRITE stmt in device code (PR #87415)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Mon Apr 8 07:40:03 PDT 2024


================
@@ -275,9 +275,74 @@ template <bool IsCUFKernelDo> class DeviceContextChecker {
         },
         ec.u);
   }
+  template <typename SEEK, typename A>
+  static const auto *GetIOControl(const A &stmt) {
+    for (const auto &spec : stmt.controls) {
+      if (const auto *result = std::get_if<SEEK>(&spec.u)) {
+        return result;
+      }
+    }
+    return static_cast<const SEEK *>(nullptr);
+  }
+  template <typename A> static bool IsInternalIO(const A &stmt) {
+    if (stmt.iounit.has_value()) {
+      return std::holds_alternative<Fortran::parser::Variable>(stmt.iounit->u);
+    }
+    if (auto *unit = GetIOControl<Fortran::parser::IoUnit>(stmt)) {
----------------
klausler wrote:

Braces, please.

https://github.com/llvm/llvm-project/pull/87415


More information about the flang-commits mailing list