@@ -51,6 +51,7 @@ template <typename T> struct Variable;
5151struct BaseObject {
5252 EVALUATE_UNION_CLASS_BOILERPLATE (BaseObject)
5353 int Rank () const ;
54+ int Corank () const ;
5455 std::optional<Expr<SubscriptInteger>> LEN () const ;
5556 llvm::raw_ostream &AsFortran (llvm::raw_ostream &) const ;
5657 const Symbol *symbol () const {
@@ -84,6 +85,7 @@ class Component {
8485 SymbolRef &symbol () { return symbol_; }
8586
8687 int Rank () const ;
88+ int Corank () const ;
8789 const Symbol &GetFirstSymbol () const ;
8890 const Symbol &GetLastSymbol () const { return symbol_; }
8991 std::optional<Expr<SubscriptInteger>> LEN () const ;
@@ -116,6 +118,7 @@ class NamedEntity {
116118 Component *UnwrapComponent ();
117119
118120 int Rank () const ;
121+ int Corank () const ;
119122 std::optional<Expr<SubscriptInteger>> LEN () const ;
120123 bool operator ==(const NamedEntity &) const ;
121124 llvm::raw_ostream &AsFortran (llvm::raw_ostream &) const ;
@@ -224,6 +227,7 @@ class ArrayRef {
224227 }
225228
226229 int Rank () const ;
230+ int Corank () const ;
227231 const Symbol &GetFirstSymbol () const ;
228232 const Symbol &GetLastSymbol () const ;
229233 std::optional<Expr<SubscriptInteger>> LEN () const ;
@@ -271,6 +275,7 @@ class CoarrayRef {
271275 CoarrayRef &set_team (Expr<SomeInteger> &&, bool isTeamNumber = false );
272276
273277 int Rank () const ;
278+ int Corank () const { return 0 ; }
274279 const Symbol &GetFirstSymbol () const ;
275280 const Symbol &GetLastSymbol () const ;
276281 NamedEntity GetBase () const ;
@@ -294,6 +299,7 @@ class CoarrayRef {
294299struct DataRef {
295300 EVALUATE_UNION_CLASS_BOILERPLATE (DataRef)
296301 int Rank () const ;
302+ int Corank () const ;
297303 const Symbol &GetFirstSymbol () const ;
298304 const Symbol &GetLastSymbol () const ;
299305 std::optional<Expr<SubscriptInteger>> LEN () const ;
@@ -331,6 +337,7 @@ class Substring {
331337 Parent &parent () { return parent_; }
332338
333339 int Rank () const ;
340+ int Corank () const ;
334341 template <typename A> const A *GetParentIf () const {
335342 return std::get_if<A>(&parent_);
336343 }
@@ -361,6 +368,7 @@ class ComplexPart {
361368 const DataRef &complex () const { return complex_; }
362369 Part part () const { return part_; }
363370 int Rank () const ;
371+ int Corank () const ;
364372 const Symbol &GetFirstSymbol () const { return complex_.GetFirstSymbol (); }
365373 const Symbol &GetLastSymbol () const { return complex_.GetLastSymbol (); }
366374 bool operator ==(const ComplexPart &) const ;
@@ -396,6 +404,7 @@ template <typename T> class Designator {
396404
397405 std::optional<DynamicType> GetType () const ;
398406 int Rank () const ;
407+ int Corank () const ;
399408 BaseObject GetBaseObject () const ;
400409 const Symbol *GetLastSymbol () const ;
401410 std::optional<Expr<SubscriptInteger>> LEN () const ;
0 commit comments