1 //===-- runtime/derived.h -------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Internal runtime utilities for derived type operations.
11 #ifndef FORTRAN_RUNTIME_DERIVED_H_
12 #define FORTRAN_RUNTIME_DERIVED_H_
14 #include "flang/Common/api-attrs.h"
16 namespace Fortran::runtime::typeInfo
{
20 namespace Fortran::runtime
{
24 // Perform default component initialization, allocate automatic components.
25 // Returns a STAT= code (0 when all's well).
26 RT_API_ATTRS
int Initialize(const Descriptor
&, const typeInfo::DerivedType
&,
27 Terminator
&, bool hasStat
= false, const Descriptor
*errMsg
= nullptr);
29 // Call FINAL subroutines, if any
30 RT_API_ATTRS
void Finalize(
31 const Descriptor
&, const typeInfo::DerivedType
&derived
, Terminator
*);
33 // Call FINAL subroutines, deallocate allocatable & automatic components.
34 // Does not deallocate the original descriptor.
35 RT_API_ATTRS
void Destroy(const Descriptor
&, bool finalize
,
36 const typeInfo::DerivedType
&, Terminator
*);
38 // Return true if the passed descriptor is for a derived type
39 // entity that has a dynamic (allocatable, automatic) component.
40 RT_API_ATTRS
bool HasDynamicComponent(const Descriptor
&);
42 } // namespace Fortran::runtime
43 #endif // FORTRAN_RUNTIME_DERIVED_H_