diff options
author | Valentin Clement <clementval@gmail.com> | 2023-01-31 13:46:12 +0100 |
---|---|---|
committer | Valentin Clement <clementval@gmail.com> | 2023-01-31 13:46:39 +0100 |
commit | 97492fd1aed56e3d041952914849d95b5ff999af (patch) | |
tree | a7c650d14ef9ae0f7a97a3d938986be3570f1e67 /flang/lib/Lower/ConvertType.cpp | |
parent | 1a8abab26980f9339f9dfa858863d6eaf5595231 (diff) | |
download | llvm-97492fd1aed56e3d041952914849d95b5ff999af.zip llvm-97492fd1aed56e3d041952914849d95b5ff999af.tar.gz llvm-97492fd1aed56e3d041952914849d95b5ff999af.tar.bz2 |
[flang] derived-type finalization
This patch implements the derived-type finalization for
monomorphic and polymorphic derived-type.
The finalization is done through a call to the `Destroy`
runtime function so the allocatable component object are also
finalized correctly when needed. It would be possible to finalize
monomorphic derived-type with non finalizable component with a
direct call to their finalize subroutine.
7.5.6.3 point 1: LHS nonallocatable object and LHS allocatable
object finalization. Done with call to `Destroy` for monomorphic
derived-type and through `Assign` for polymorphic entities.
7.5.6.3 point 2: Done within the deallocation calls.
7.5.6.3 point 3: A function context is added to the bridge to
attach finalization that need to happen on function/subroutine
exit.
7.5.6.3 point 4: BLOCK construct not yet implemented.
7.5.6.3 point 5/6: Finalization attach to the stmtCtx in a
similar way than 9.7.3.2 point 4.
7.5.6.3 point 7: INTENT(OUT) finalization done with a
call to `Destroy` runtime function call.
This patch passes 9/10 tests in the proposed test-suite
https://github.com/llvm/llvm-test-suite/pull/13
- The case with BLOCK construct will be implemented later when
BLOCK are implemented upstream.
- Automatic deallocation is not yet implemented. Finalization triggered
by automatic deallocation is then not triggered.
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D142707
Diffstat (limited to 'flang/lib/Lower/ConvertType.cpp')
-rw-r--r-- | flang/lib/Lower/ConvertType.cpp | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/flang/lib/Lower/ConvertType.cpp b/flang/lib/Lower/ConvertType.cpp index db18553..e8d688a 100644 --- a/flang/lib/Lower/ConvertType.cpp +++ b/flang/lib/Lower/ConvertType.cpp @@ -302,9 +302,6 @@ struct TypeBuilderImpl { if (mlir::Type ty = getTypeIfDerivedAlreadyInConstruction(typeSymbol)) return ty; - if (Fortran::semantics::IsFinalizable(tySpec)) - TODO(converter.genLocation(tySpec.name()), "derived type finalization"); - auto rec = fir::RecordType::get(context, Fortran::lower::mangle::mangleName(tySpec)); // Maintain the stack of types for recursive references. |