[flang-commits] [flang] [flang] Regularize TODO messages for coarray related features (PR #69227)

Pete Steinfeld via flang-commits flang-commits at lists.llvm.org
Mon Oct 16 11:43:08 PDT 2023


https://github.com/psteinfeld updated https://github.com/llvm/llvm-project/pull/69227

>From f39420b7c7cd7e7a22946f5e4663eec293f06dcb Mon Sep 17 00:00:00 2001
From: Peter Steinfeld <psteinfeld at nvidia.com>
Date: Mon, 16 Oct 2023 10:03:18 -0700
Subject: [PATCH 1/2] [flang] Regularize TODO messages for coarray related
 features

I want to make "not yet implemented" messages for features related to
coarrays easy to identify and make them easy for users to read.
---
 flang/lib/Lower/Allocatable.cpp        |  4 ++--
 flang/lib/Lower/Bridge.cpp             | 18 +++++++++---------
 flang/lib/Lower/CallInterface.cpp      |  2 +-
 flang/lib/Lower/Coarray.cpp            |  8 ++++----
 flang/lib/Lower/ConvertExpr.cpp        |  4 ++--
 flang/lib/Lower/ConvertExprToHLFIR.cpp |  4 ++--
 flang/lib/Lower/Runtime.cpp            | 16 ++++++++--------
 flang/lib/Lower/VectorSubscripts.cpp   |  3 ++-
 8 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/flang/lib/Lower/Allocatable.cpp b/flang/lib/Lower/Allocatable.cpp
index a05f06aead173cc..e82b2f050ca893c 100644
--- a/flang/lib/Lower/Allocatable.cpp
+++ b/flang/lib/Lower/Allocatable.cpp
@@ -462,7 +462,7 @@ class AllocateStmtHelper {
     errorManager.genStatCheck(builder, loc);
     genAllocateObjectInit(box);
     if (alloc.hasCoarraySpec())
-      TODO(loc, "coarray allocation");
+      TODO(loc, "coarray: allocation of a coarray object");
     if (alloc.type.IsPolymorphic())
       genSetType(alloc, box, loc);
     genSetDeferredLengthParameters(alloc, box);
@@ -582,7 +582,7 @@ class AllocateStmtHelper {
     errorManager.genStatCheck(builder, loc);
     genAllocateObjectInit(box);
     if (alloc.hasCoarraySpec())
-      TODO(loc, "coarray allocation");
+      TODO(loc, "coarray: allocation of a corrary object");
     // Set length of the allocate object if it has. Otherwise, get the length
     // from source for the deferred length parameter.
     if (lenParams.empty() && box.isCharacter() &&
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index 5ac4d822faaae58..ef8540c35a37286 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -2625,35 +2625,35 @@ class FirConverter : public Fortran::lower::AbstractConverter {
   }
 
   void genFIR(const Fortran::parser::ChangeTeamConstruct &construct) {
-    TODO(toLocation(), "ChangeTeamConstruct implementation");
+    TODO(toLocation(), "coarray: ChangeTeamConstruct");
   }
   void genFIR(const Fortran::parser::ChangeTeamStmt &stmt) {
-    TODO(toLocation(), "ChangeTeamStmt implementation");
+    TODO(toLocation(), "coarray: ChangeTeamStmt");
   }
   void genFIR(const Fortran::parser::EndChangeTeamStmt &stmt) {
-    TODO(toLocation(), "EndChangeTeamStmt implementation");
+    TODO(toLocation(), "coarray: EndChangeTeamStmt");
   }
 
   void genFIR(const Fortran::parser::CriticalConstruct &criticalConstruct) {
     setCurrentPositionAt(criticalConstruct);
-    TODO(toLocation(), "CriticalConstruct implementation");
+    TODO(toLocation(), "coarray: CriticalConstruct");
   }
   void genFIR(const Fortran::parser::CriticalStmt &) {
-    TODO(toLocation(), "CriticalStmt implementation");
+    TODO(toLocation(), "coarray: CriticalStmt");
   }
   void genFIR(const Fortran::parser::EndCriticalStmt &) {
-    TODO(toLocation(), "EndCriticalStmt implementation");
+    TODO(toLocation(), "coarray: EndCriticalStmt");
   }
 
   void genFIR(const Fortran::parser::SelectRankConstruct &selectRankConstruct) {
     setCurrentPositionAt(selectRankConstruct);
-    TODO(toLocation(), "SelectRankConstruct implementation");
+    TODO(toLocation(), "coarray: SelectRankConstruct");
   }
   void genFIR(const Fortran::parser::SelectRankStmt &) {
-    TODO(toLocation(), "SelectRankStmt implementation");
+    TODO(toLocation(), "coarray: SelectRankStmt");
   }
   void genFIR(const Fortran::parser::SelectRankCaseStmt &) {
-    TODO(toLocation(), "SelectRankCaseStmt implementation");
+    TODO(toLocation(), "coarray: SelectRankCaseStmt");
   }
 
   void genFIR(const Fortran::parser::SelectTypeConstruct &selectTypeConstruct) {
diff --git a/flang/lib/Lower/CallInterface.cpp b/flang/lib/Lower/CallInterface.cpp
index 379d9be0e53a3dc..017cf48dd544133 100644
--- a/flang/lib/Lower/CallInterface.cpp
+++ b/flang/lib/Lower/CallInterface.cpp
@@ -939,7 +939,7 @@ class Fortran::lower::CallInterfaceImpl {
     if (shapeAttrs.test(ShapeAttr::AssumedRank))
       TODO(loc, "assumed rank in procedure interface");
     if (shapeAttrs.test(ShapeAttr::Coarray))
-      TODO(loc, "coarray in procedure interface");
+      TODO(loc, "coarray: dummy argument coarray in procedure interface");
 
     // So far assume that if the argument cannot be passed by implicit interface
     // it must be by box. That may no be always true (e.g for simple optionals)
diff --git a/flang/lib/Lower/Coarray.cpp b/flang/lib/Lower/Coarray.cpp
index b5ab7b51fb00a93..a84f65a5c49e80a 100644
--- a/flang/lib/Lower/Coarray.cpp
+++ b/flang/lib/Lower/Coarray.cpp
@@ -27,27 +27,27 @@ void Fortran::lower::genChangeTeamConstruct(
     Fortran::lower::AbstractConverter &converter,
     Fortran::lower::pft::Evaluation &,
     const Fortran::parser::ChangeTeamConstruct &) {
-  TODO(converter.getCurrentLocation(), "CHANGE TEAM construct");
+  TODO(converter.getCurrentLocation(), "coarray: CHANGE TEAM construct");
 }
 
 void Fortran::lower::genChangeTeamStmt(
     Fortran::lower::AbstractConverter &converter,
     Fortran::lower::pft::Evaluation &,
     const Fortran::parser::ChangeTeamStmt &) {
-  TODO(converter.getCurrentLocation(), "CHANGE TEAM stmt");
+  TODO(converter.getCurrentLocation(), "coarray: CHANGE TEAM statement");
 }
 
 void Fortran::lower::genEndChangeTeamStmt(
     Fortran::lower::AbstractConverter &converter,
     Fortran::lower::pft::Evaluation &,
     const Fortran::parser::EndChangeTeamStmt &) {
-  TODO(converter.getCurrentLocation(), "END CHANGE TEAM");
+  TODO(converter.getCurrentLocation(), "coarray: END CHANGE TEAM statement");
 }
 
 void Fortran::lower::genFormTeamStatement(
     Fortran::lower::AbstractConverter &converter,
     Fortran::lower::pft::Evaluation &, const Fortran::parser::FormTeamStmt &) {
-  TODO(converter.getCurrentLocation(), "FORM TEAM");
+  TODO(converter.getCurrentLocation(), "coarray: FORM TEAM statement");
 }
 
 //===----------------------------------------------------------------------===//
diff --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp
index 8788e82b59a8df0..1bedf8c52cb0459 100644
--- a/flang/lib/Lower/ConvertExpr.cpp
+++ b/flang/lib/Lower/ConvertExpr.cpp
@@ -3814,7 +3814,7 @@ class ArrayExprLowering {
     return false;
   }
   bool genShapeFromDataRef(const Fortran::evaluate::CoarrayRef &) {
-    TODO(getLoc(), "coarray ref");
+    TODO(getLoc(), "coarray: reference to a corrary in an expression");
     return false;
   }
   bool genShapeFromDataRef(const Fortran::evaluate::Component &x) {
@@ -7091,7 +7091,7 @@ class ArrayExprLowering {
   }
 
   CC genarr(const Fortran::evaluate::CoarrayRef &x, ComponentPath &components) {
-    TODO(getLoc(), "coarray reference");
+    TODO(getLoc(), "coarray: reference to a coarray in an expression");
   }
 
   CC genarr(const Fortran::evaluate::NamedEntity &x,
diff --git a/flang/lib/Lower/ConvertExprToHLFIR.cpp b/flang/lib/Lower/ConvertExprToHLFIR.cpp
index bc98fdd917d41d0..ae6cc080f02068e 100644
--- a/flang/lib/Lower/ConvertExprToHLFIR.cpp
+++ b/flang/lib/Lower/ConvertExprToHLFIR.cpp
@@ -371,11 +371,11 @@ class HlfirDesignatorBuilder {
 
   fir::FortranVariableOpInterface
   gen(const Fortran::evaluate::CoarrayRef &coarrayRef) {
-    TODO(getLoc(), "lowering CoarrayRef to HLFIR");
+    TODO(getLoc(), "coarray: lowering a reference to a coarray object");
   }
 
   mlir::Type visit(const Fortran::evaluate::CoarrayRef &, PartInfo &) {
-    TODO(getLoc(), "lowering CoarrayRef to HLFIR");
+    TODO(getLoc(), "coarray: lowering a reference to a coarray object");
   }
 
   fir::FortranVariableOpInterface
diff --git a/flang/lib/Lower/Runtime.cpp b/flang/lib/Lower/Runtime.cpp
index 2cf1e522d330d4c..8855cab8b5174ea 100644
--- a/flang/lib/Lower/Runtime.cpp
+++ b/flang/lib/Lower/Runtime.cpp
@@ -140,49 +140,49 @@ void Fortran::lower::genFailImageStatement(
 void Fortran::lower::genEventPostStatement(
     Fortran::lower::AbstractConverter &converter,
     const Fortran::parser::EventPostStmt &) {
-  TODO(converter.getCurrentLocation(), "EVENT POST runtime");
+  TODO(converter.getCurrentLocation(), "coarray: EVENT POST runtime");
 }
 
 void Fortran::lower::genEventWaitStatement(
     Fortran::lower::AbstractConverter &converter,
     const Fortran::parser::EventWaitStmt &) {
-  TODO(converter.getCurrentLocation(), "EVENT WAIT runtime");
+  TODO(converter.getCurrentLocation(), "coarray: EVENT WAIT runtime");
 }
 
 void Fortran::lower::genLockStatement(
     Fortran::lower::AbstractConverter &converter,
     const Fortran::parser::LockStmt &) {
-  TODO(converter.getCurrentLocation(), "LOCK runtime");
+  TODO(converter.getCurrentLocation(), "coarray: LOCK runtime");
 }
 
 void Fortran::lower::genUnlockStatement(
     Fortran::lower::AbstractConverter &converter,
     const Fortran::parser::UnlockStmt &) {
-  TODO(converter.getCurrentLocation(), "UNLOCK runtime");
+  TODO(converter.getCurrentLocation(), "coarray: UNLOCK runtime");
 }
 
 void Fortran::lower::genSyncAllStatement(
     Fortran::lower::AbstractConverter &converter,
     const Fortran::parser::SyncAllStmt &) {
-  TODO(converter.getCurrentLocation(), "SYNC ALL runtime");
+  TODO(converter.getCurrentLocation(), "coarray: SYNC ALL runtime");
 }
 
 void Fortran::lower::genSyncImagesStatement(
     Fortran::lower::AbstractConverter &converter,
     const Fortran::parser::SyncImagesStmt &) {
-  TODO(converter.getCurrentLocation(), "SYNC IMAGES runtime");
+  TODO(converter.getCurrentLocation(), "coarray: SYNC IMAGES runtime");
 }
 
 void Fortran::lower::genSyncMemoryStatement(
     Fortran::lower::AbstractConverter &converter,
     const Fortran::parser::SyncMemoryStmt &) {
-  TODO(converter.getCurrentLocation(), "SYNC MEMORY runtime");
+  TODO(converter.getCurrentLocation(), "coarray: SYNC MEMORY runtime");
 }
 
 void Fortran::lower::genSyncTeamStatement(
     Fortran::lower::AbstractConverter &converter,
     const Fortran::parser::SyncTeamStmt &) {
-  TODO(converter.getCurrentLocation(), "SYNC TEAM runtime");
+  TODO(converter.getCurrentLocation(), "coarray: SYNC TEAM runtime");
 }
 
 void Fortran::lower::genPauseStatement(
diff --git a/flang/lib/Lower/VectorSubscripts.cpp b/flang/lib/Lower/VectorSubscripts.cpp
index ca5dfc836e5dc3c..7439b9f7df8fdb4 100644
--- a/flang/lib/Lower/VectorSubscripts.cpp
+++ b/flang/lib/Lower/VectorSubscripts.cpp
@@ -212,7 +212,8 @@ class VectorSubscriptBoxBuilder {
 
   mlir::Type gen(const Fortran::evaluate::CoarrayRef &) {
     // Is this possible/legal ?
-    TODO(loc, "coarray ref with vector subscript in IO input");
+    TODO(loc, "coarray: reference to coarray object with vector subscript in "
+              "IO input");
   }
 
   template <typename A>

>From 6aa2b0a227ace70bd3f4e9931624bf46a5168c67 Mon Sep 17 00:00:00 2001
From: Peter Steinfeld <psteinfeld at nvidia.com>
Date: Mon, 16 Oct 2023 11:42:13 -0700
Subject: [PATCH 2/2] [flang] Fixing misspellings.

Thanks, Val!
---
 flang/lib/Lower/Allocatable.cpp | 2 +-
 flang/lib/Lower/ConvertExpr.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/flang/lib/Lower/Allocatable.cpp b/flang/lib/Lower/Allocatable.cpp
index e82b2f050ca893c..898f34786a248e5 100644
--- a/flang/lib/Lower/Allocatable.cpp
+++ b/flang/lib/Lower/Allocatable.cpp
@@ -582,7 +582,7 @@ class AllocateStmtHelper {
     errorManager.genStatCheck(builder, loc);
     genAllocateObjectInit(box);
     if (alloc.hasCoarraySpec())
-      TODO(loc, "coarray: allocation of a corrary object");
+      TODO(loc, "coarray: allocation of a coarray object");
     // Set length of the allocate object if it has. Otherwise, get the length
     // from source for the deferred length parameter.
     if (lenParams.empty() && box.isCharacter() &&
diff --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp
index 1bedf8c52cb0459..6d2ac62b61b74c3 100644
--- a/flang/lib/Lower/ConvertExpr.cpp
+++ b/flang/lib/Lower/ConvertExpr.cpp
@@ -3814,7 +3814,7 @@ class ArrayExprLowering {
     return false;
   }
   bool genShapeFromDataRef(const Fortran::evaluate::CoarrayRef &) {
-    TODO(getLoc(), "coarray: reference to a corrary in an expression");
+    TODO(getLoc(), "coarray: reference to a coarray in an expression");
     return false;
   }
   bool genShapeFromDataRef(const Fortran::evaluate::Component &x) {



More information about the flang-commits mailing list