@@ -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 ;
@@ -147,6 +150,7 @@ class TypeParamInquiry {
147150 const Symbol ¶meter () const { return parameter_; }
148151
149152 static constexpr int Rank () { return 0 ; } // always scalar
153+ static constexpr int Corank () { return 0 ; }
150154 bool operator ==(const TypeParamInquiry &) const ;
151155 llvm::raw_ostream &AsFortran (llvm::raw_ostream &) const ;
152156
@@ -224,6 +228,7 @@ class ArrayRef {
224228 }
225229
226230 int Rank () const ;
231+ int Corank () const ;
227232 const Symbol &GetFirstSymbol () const ;
228233 const Symbol &GetLastSymbol () const ;
229234 std::optional<Expr<SubscriptInteger>> LEN () const ;
@@ -271,6 +276,7 @@ class CoarrayRef {
271276 CoarrayRef &set_team (Expr<SomeInteger> &&, bool isTeamNumber = false );
272277
273278 int Rank () const ;
279+ int Corank () const { return 0 ; }
274280 const Symbol &GetFirstSymbol () const ;
275281 const Symbol &GetLastSymbol () const ;
276282 NamedEntity GetBase () const ;
@@ -294,6 +300,7 @@ class CoarrayRef {
294300struct DataRef {
295301 EVALUATE_UNION_CLASS_BOILERPLATE (DataRef)
296302 int Rank () const ;
303+ int Corank () const ;
297304 const Symbol &GetFirstSymbol () const ;
298305 const Symbol &GetLastSymbol () const ;
299306 std::optional<Expr<SubscriptInteger>> LEN () const ;
@@ -331,6 +338,7 @@ class Substring {
331338 Parent &parent () { return parent_; }
332339
333340 int Rank () const ;
341+ int Corank () const ;
334342 template <typename A> const A *GetParentIf () const {
335343 return std::get_if<A>(&parent_);
336344 }
@@ -361,6 +369,7 @@ class ComplexPart {
361369 const DataRef &complex () const { return complex_; }
362370 Part part () const { return part_; }
363371 int Rank () const ;
372+ int Corank () const ;
364373 const Symbol &GetFirstSymbol () const { return complex_.GetFirstSymbol (); }
365374 const Symbol &GetLastSymbol () const { return complex_.GetLastSymbol (); }
366375 bool operator ==(const ComplexPart &) const ;
@@ -396,6 +405,7 @@ template <typename T> class Designator {
396405
397406 std::optional<DynamicType> GetType () const ;
398407 int Rank () const ;
408+ int Corank () const ;
399409 BaseObject GetBaseObject () const ;
400410 const Symbol *GetLastSymbol () const ;
401411 std::optional<Expr<SubscriptInteger>> LEN () const ;
@@ -421,6 +431,7 @@ class DescriptorInquiry {
421431 int dimension () const { return dimension_; }
422432
423433 static constexpr int Rank () { return 0 ; } // always scalar
434+ static constexpr int Corank () { return 0 ; }
424435 bool operator ==(const DescriptorInquiry &) const ;
425436 llvm::raw_ostream &AsFortran (llvm::raw_ostream &) const ;
426437
0 commit comments