[flang] Support lowering of parent component in strecture constructor
authorPeixin-Qiao <qiaopeixin@huawei.com>
Wed, 26 Oct 2022 01:12:45 +0000 (09:12 +0800)
committerPeixin-Qiao <qiaopeixin@huawei.com>
Wed, 26 Oct 2022 01:12:45 +0000 (09:12 +0800)
commit531219865464146010d9611d6d7515499e109b5a
treea7616a77d86fa68a981711cc56f511d796c0dec8
parentb385395c97e1422ddd83e9cd3b93c6b15fbadc6e
[flang] Support lowering of parent component in strecture constructor

Reuse the previous record assignment code. Use gen(expr) to generate
the fir::ExtendedValue of parent component recursively and convert the
structure to a fir.ref<T> type, where T is the record type of parent
component. Then, fir::factory::genRecordAssignment can be reused to
assign the parent component to the type-casted structure.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D136530
flang/lib/Lower/ConvertExpr.cpp
flang/test/Lower/structure-constructors.f90