MCPcopy Create free account
hub / github.com/pybind/pybind11 / determine_trampoline_state

Function determine_trampoline_state

tests/test_potentially_slicing_weak_ptr.cpp:42–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40
41template <typename VB>
42const char *determine_trampoline_state(const std::shared_ptr<VB> &sp) {
43 if (!sp) {
44 return "sp nullptr";
45 }
46 auto *tias = dynamic_cast<trampoline_is_alive_simple *>(sp.get());
47 if (!tias) {
48 return "dynamic_cast failed";
49 }
50 if (tias->magic_token == 197001010000u) {
51 return "trampoline alive";
52 }
53 if (tias->magic_token == 20380118191407u) {
54 return "trampoline DEAD";
55 }
56 return "UNDEFINED BEHAVIOR";
57}
58
59struct PyVirtBaseSH : VirtBaseSH, py::trampoline_self_life_support, trampoline_is_alive_simple {
60 using VirtBaseSH::VirtBaseSH;

Callers 2

get_trampoline_stateMethod · 0.85
get_trampoline_stateMethod · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected