1 | //===-- flang/runtime/non-tbp-dio.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 | // Defines a structure used to identify the non-type-bound defined I/O |
10 | // generic interfaces that are accessible in a particular scope. This |
11 | // table is used by some I/O APIs and is also part of the NAMELIST |
12 | // group table. |
13 | // |
14 | // A specific procedure for a particular derived type must appear in |
15 | // this table if it (a) is a dummy procedure or procedure pointer, |
16 | // (b) is part of the defined I/O generic definition in a scope other |
17 | // than the one that contains the derived type definition, or (c) |
18 | // is a null pointer signifying that some specific procedure from |
19 | // a containing scope has become inaccessible in a nested scope due |
20 | // to the use of "IMPORT, NONE" or "IMPORT, ONLY:". |
21 | |
22 | #ifndef FORTRAN_RUNTIME_NON_TBP_DIO_H_ |
23 | #define FORTRAN_RUNTIME_NON_TBP_DIO_H_ |
24 | |
25 | #include "flang/Common/Fortran.h" |
26 | #include <cstddef> |
27 | |
28 | namespace Fortran::runtime::typeInfo { |
29 | class DerivedType; |
30 | } // namespace Fortran::runtime::typeInfo |
31 | |
32 | namespace Fortran::runtime::io { |
33 | |
34 | struct NonTbpDefinedIo { |
35 | const typeInfo::DerivedType &derivedType; |
36 | void (*subroutine)(); // null means no non-TBP defined I/O here |
37 | common::DefinedIo definedIo; |
38 | bool isDtvArgPolymorphic; // first dummy arg is CLASS(T) |
39 | }; |
40 | |
41 | struct NonTbpDefinedIoTable { |
42 | RT_API_ATTRS const NonTbpDefinedIo *Find( |
43 | const typeInfo::DerivedType &, common::DefinedIo) const; |
44 | std::size_t items{0}; |
45 | const NonTbpDefinedIo *item{nullptr}; |
46 | // True when the only procedures to be used are the type-bound special |
47 | // procedures in the type information tables and any non-null procedures |
48 | // in this table. When false, the entries in this table override whatever |
49 | // non-type-bound specific procedures might be in the type information, |
50 | // but the remaining specifics remain visible. |
51 | bool ignoreNonTbpEntries{false}; |
52 | }; |
53 | |
54 | } // namespace Fortran::runtime::io |
55 | #endif // FORTRAN_RUNTIME_NON_TBP_DIO_H_ |
56 | |