[flang] Add AllocatableInit functions for use in allocate lowering
authorValentin Clement <clementval@gmail.com>
Mon, 20 Mar 2023 09:00:08 +0000 (10:00 +0100)
committerValentin Clement <clementval@gmail.com>
Mon, 20 Mar 2023 09:00:43 +0000 (10:00 +0100)
commit52e239794f35be6a68b2273f88a99d9207e77cab
treec692e616a2bbcedd86035bc5d19f56bbad331355
parent257f4fd3b9e47cf66d4fcd20b598a17fcd2282f5
[flang] Add AllocatableInit functions for use in allocate lowering

`AllocatableInitIntrinsic`, `AllocatableInitCharacter` and
`AllocatableInitDerived` are meant to be used to initialize a
descriptor when it is instantiated and not to be used multiple
times in a scope.
Add `AllocatableInitDerivedForAllocate`, `AllocatableInitCharacterForAllocate`
and `AllocatableInitDerivedForAllocate` to be used for the allocation
in allocate statement.
These new functions are meant to be used on an initialized descriptor
and will return directly if the descriptor is allocated so the
error handling is done by the call to `AllocatableAllocate`.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D146290
flang/include/flang/Runtime/allocatable.h
flang/runtime/allocatable.cpp
flang/unittests/Runtime/Allocatable.cpp