Warning: This file is not a C or C++ file. It does not have highlighting.
1 | //===-- include/flang/Runtime/derived-api.h ---------------------*- C++ -*-===// |
---|---|
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 | // API for lowering to use for operations on derived type objects. |
10 | // Initialiaztion and finalization are implied for pointer and allocatable |
11 | // ALLOCATE()/DEALLOCATE() respectively, so these APIs should be used only for |
12 | // local variables. Whole allocatable assignment should use AllocatableAssign() |
13 | // instead of this Assign(). |
14 | |
15 | #ifndef FORTRAN_RUNTIME_DERIVED_API_H_ |
16 | #define FORTRAN_RUNTIME_DERIVED_API_H_ |
17 | |
18 | #include "flang/Runtime/entry-names.h" |
19 | |
20 | namespace Fortran::runtime { |
21 | class Descriptor; |
22 | |
23 | namespace typeInfo { |
24 | class DerivedType; |
25 | } |
26 | |
27 | extern "C" { |
28 | |
29 | // Initializes and allocates an object's components, if it has a derived type |
30 | // with any default component initialization or automatic components. |
31 | // The descriptor must be initialized and non-null. |
32 | void RTDECL(Initialize)( |
33 | const Descriptor &, const char *sourceFile = nullptr, int sourceLine = 0); |
34 | |
35 | // Finalizes an object and its components. Deallocates any |
36 | // allocatable/automatic components. Does not deallocate the descriptor's |
37 | // storage. |
38 | void RTDECL(Destroy)(const Descriptor &); |
39 | |
40 | // Finalizes the object and its components. |
41 | void RTDECL(Finalize)( |
42 | const Descriptor &, const char *sourceFile = nullptr, int sourceLine = 0); |
43 | |
44 | /// Deallocates any allocatable/automatic components. |
45 | /// Does not deallocate the descriptor's storage. |
46 | /// Does not perform any finalization. |
47 | void RTDECL(DestroyWithoutFinalization)(const Descriptor &); |
48 | |
49 | // Intrinsic or defined assignment, with scalar expansion but not type |
50 | // conversion. |
51 | void RTDECL(Assign)(const Descriptor &, const Descriptor &, |
52 | const char *sourceFile = nullptr, int sourceLine = 0); |
53 | |
54 | // Perform the test of the CLASS IS type guard statement of the SELECT TYPE |
55 | // construct. |
56 | bool RTDECL(ClassIs)(const Descriptor &, const typeInfo::DerivedType &); |
57 | |
58 | // Perform the test of the SAME_TYPE_AS intrinsic. |
59 | bool RTDECL(SameTypeAs)(const Descriptor &, const Descriptor &); |
60 | |
61 | // Perform the test of the EXTENDS_TYPE_OF intrinsic. |
62 | bool RTDECL(ExtendsTypeOf)(const Descriptor &, const Descriptor &); |
63 | |
64 | } // extern "C" |
65 | } // namespace Fortran::runtime |
66 | #endif // FORTRAN_RUNTIME_DERIVED_API_H_ |
67 |
Warning: This file is not a C or C++ file. It does not have highlighting.