1 //===-- include/flang/Semantics/runtime-type-info.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 // BuildRuntimeDerivedTypeTables() translates the scopes of derived types 10 // and parameterized derived type instantiations into the type descriptions 11 // defined in module/__fortran_type_info.f90, packaging these descriptions 12 // as static initializers for compiler-created objects. 13 14 #ifndef FORTRAN_SEMANTICS_RUNTIME_TYPE_INFO_H_ 15 #define FORTRAN_SEMANTICS_RUNTIME_TYPE_INFO_H_ 16 17 #include "flang/Common/reference.h" 18 #include "flang/Semantics/symbol.h" 19 #include <map> 20 #include <set> 21 #include <string> 22 #include <vector> 23 24 namespace llvm { 25 class raw_ostream; 26 } 27 28 namespace Fortran::semantics { 29 30 struct RuntimeDerivedTypeTables { 31 Scope *schemata{nullptr}; 32 std::set<std::string> names; 33 }; 34 35 RuntimeDerivedTypeTables BuildRuntimeDerivedTypeTables(SemanticsContext &); 36 37 /// Name of the builtin module that defines builtin derived types meant 38 /// to describe other derived types at runtime in flang descriptor. 39 constexpr char typeInfoBuiltinModule[]{"__fortran_type_info"}; 40 41 /// Name of the bindings descriptor component in the DerivedType type of the 42 /// __Fortran_type_info module 43 constexpr char bindingDescCompName[]{"binding"}; 44 45 /// Name of the __builtin_c_funptr component in the Binding type of the 46 /// __Fortran_type_info module 47 constexpr char procCompName[]{"proc"}; 48 49 SymbolVector CollectBindings(const Scope &dtScope); 50 51 struct NonTbpDefinedIo { 52 const Symbol *subroutine; 53 common::DefinedIo definedIo; 54 bool isDtvArgPolymorphic; 55 }; 56 57 std::multimap<const Symbol *, NonTbpDefinedIo> 58 CollectNonTbpDefinedIoGenericInterfaces( 59 const Scope &, bool useRuntimeTypeInfoEntries); 60 61 bool ShouldIgnoreRuntimeTypeInfoNonTbpGenericInterfaces( 62 const Scope &, const DerivedTypeSpec *); 63 bool ShouldIgnoreRuntimeTypeInfoNonTbpGenericInterfaces( 64 const Scope &, const DeclTypeSpec *); 65 bool ShouldIgnoreRuntimeTypeInfoNonTbpGenericInterfaces( 66 const Scope &, const Symbol *); 67 68 } // namespace Fortran::semantics 69 #endif // FORTRAN_SEMANTICS_RUNTIME_TYPE_INFO_H_ 70