diff options
author | Valentin Clement <clementval@gmail.com> | 2022-11-24 20:33:15 +0100 |
---|---|---|
committer | Valentin Clement <clementval@gmail.com> | 2022-11-24 20:47:21 +0100 |
commit | c1b7e9c96200a0972a64ee2d2611ea42a2088f32 (patch) | |
tree | 901c0769b887598f43f80f7c578a85b019bb6cc2 /flang/lib/Lower/ConvertType.cpp | |
parent | cb888971d233a53282c31f498b79b9d788a402d6 (diff) | |
download | llvm-c1b7e9c96200a0972a64ee2d2611ea42a2088f32.zip llvm-c1b7e9c96200a0972a64ee2d2611ea42a2088f32.tar.gz llvm-c1b7e9c96200a0972a64ee2d2611ea42a2088f32.tar.bz2 |
[flang] Adapt descriptor codegen to support unlimited polymorphic entities
Code generation to create and populate the descriptor (element size and
type code) is based on the boxed result type. This does not work well with
unlimited polymorphic entities since the fir type does not represent what is
actually emboxed or reboxed.
In the case of emboxing, the input type will be used to populate
the descriptor element size and type code.
When reboxing an unlimited polymorphic to a unlimited polymorphic entities, the
element size and type code is retrieve from the input box.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D138587
Diffstat (limited to 'flang/lib/Lower/ConvertType.cpp')
-rw-r--r-- | flang/lib/Lower/ConvertType.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/flang/lib/Lower/ConvertType.cpp b/flang/lib/Lower/ConvertType.cpp index 6f86cbf..30d9e5e 100644 --- a/flang/lib/Lower/ConvertType.cpp +++ b/flang/lib/Lower/ConvertType.cpp @@ -142,7 +142,9 @@ struct TypeBuilder { Fortran::common::TypeCategory category = dynamicType->category(); mlir::Type baseType; - if (category == Fortran::common::TypeCategory::Derived) { + if (dynamicType->IsUnlimitedPolymorphic()) { + baseType = mlir::NoneType::get(context); + } else if (category == Fortran::common::TypeCategory::Derived) { baseType = genDerivedType(dynamicType->GetDerivedTypeSpec()); } else { // LOGICAL, INTEGER, REAL, COMPLEX, CHARACTER |