| 60 | } |
| 61 | |
| 62 | [[nodiscard]] |
| 63 | static bool direct_allocation_has_pointers(const TypeInfo& type_info) { |
| 64 | if (type_info.is_pointer()) { |
| 65 | if (type_info.tag() == GI_TYPE_TAG_ARRAY && |
| 66 | type_info.array_type() == GI_ARRAY_TYPE_C) { |
| 67 | return direct_allocation_has_pointers(type_info.element_type()); |
| 68 | } |
| 69 | |
| 70 | return type_info.tag() != GI_TYPE_TAG_VOID; |
| 71 | } |
| 72 | |
| 73 | if (type_info.tag() != GI_TYPE_TAG_INTERFACE) |
| 74 | return false; |
| 75 | |
| 76 | AutoBaseInfo interface{type_info.interface()}; |
| 77 | if (auto struct_info = interface.as<InfoTag::STRUCT>()) |
| 78 | return simple_struct_has_pointers(struct_info.value()); |
| 79 | if (auto union_info = interface.as<InfoTag::UNION>()) |
| 80 | return simple_struct_has_pointers(union_info.value()); |
| 81 | |
| 82 | return false; |
| 83 | } |
| 84 | |
| 85 | template <InfoTag TAG> |
| 86 | bool simple_struct_has_pointers(const UnownedInfo<TAG>& info) { |
no test coverage detected