| 1 |
//===-- runtime/derived.h -------------------------------------------------===// |
| 2 |
// |
| 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 |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
// Internal runtime utilities for derived type operations. |
| 10 |
|
| 11 |
#ifndef FORTRAN_RUNTIME_DERIVED_H_ |
| 12 |
#define FORTRAN_RUNTIME_DERIVED_H_ |
| 13 |
|
| 14 |
#include "flang/Common/api-attrs.h" |
| 15 |
|
| 16 |
namespace Fortran::runtime::typeInfo { |
| 17 |
class DerivedType; |
| 18 |
} |
| 19 |
|
| 20 |
namespace Fortran::runtime { |
| 21 |
class Descriptor; |
| 22 |
class Terminator; |
| 23 |
|
| 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); |
| 28 |
|
| 29 |
// Call FINAL subroutines, if any |
| 30 |
RT_API_ATTRS void Finalize( |
| 31 |
const Descriptor &, const typeInfo::DerivedType &derived, Terminator *); |
| 32 |
|
| 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 *); |
| 37 |
|
| 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 &); |
| 41 |
|
| 42 |
} // namespace Fortran::runtime |
| 43 |
#endif // FORTRAN_RUNTIME_DERIVED_H_ |