MCPcopy Create free account
hub / github.com/GNOME/gjs / direct_allocation_has_pointers

Function direct_allocation_has_pointers

gi/gi-utils.cpp:62–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62[[nodiscard]]
63static 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
85template <InfoTag TAG>
86bool simple_struct_has_pointers(const UnownedInfo<TAG>& info) {

Callers 1

Calls 7

array_typeMethod · 0.80
element_typeMethod · 0.80
interfaceMethod · 0.80
is_pointerMethod · 0.45
tagMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected