object-introspection/types/weak_ptr_type.toml
Jay Kamat e27f725a85 Avoid following weak_ptrs
Previously, we treated weak_ptrs as normal types and we recursed
within them, following the internal data pointer and possibly causing
crashes. We really shouldn't be following them, so I added a custom
type to simply abort processing. If we want to handle them (ie: check
if they are valid, and follow them if so), that should be fairly easy
with the work there is here so far.
2023-03-28 14:10:27 -07:00

23 lines
460 B
TOML

[info]
typeName = "std::weak_ptr"
numTemplateParams = 1
ctype = "WEAK_PTR_TYPE"
header = "memory"
ns = ["namespace std"]
replaceTemplateParamIndex = []
[codegen]
decl = """
template<typename T>
void getSizeType(const %1%<T> &s_ptr, size_t& returnArg);
"""
# Weak pointers do not have ownership, so let's not follow them (for now)
func = """
template<typename T>
void getSizeType(const %1%<T> &s_ptr, size_t& returnArg)
{
SAVE_SIZE(sizeof(%1%<T>));
}
"""