[flang-commits] [flang] [flang] get rid of descriptor in scalar type is (PR #188762)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Thu Mar 26 08:10:05 PDT 2026


================
@@ -68,11 +70,20 @@ class BaseBoxType : public mlir::Type {
   /// Is this a box describing volatile memory?
   bool isVolatile() const;
 
+  /// Is this a box describing an array or assumed-rank?
+  bool isArray() const;
+
   /// Return the same type, except for the shape, that is taken the shape
   /// of shapeMold.
   BaseBoxType getBoxTypeWithNewShape(mlir::Type shapeMold) const;
   BaseBoxType getBoxTypeWithNewShape(int rank) const;
 
+  /// Return a box type with the same attributes and shape, except that the
+  /// element type that is changed to the provided one. The returned box will be
+  /// a fir.class if \p polymorphic is true and a fir.box otherwise.
+  BaseBoxType getBoxTypeWithNewElementType(mlir::Type elementType,
----------------
eugeneepshteyn wrote:

I was thinking whether maybe `polymorphic` should have default of `false`, but at least in this PR it could be 'true' or 'false'. Do you envision more usages of `getBoxTypeWithNewElementType()` beyond the changes in this PR?

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


More information about the flang-commits mailing list