Debian Codegraph @

index_tests/constructors/destructor.cc

raw
1 class Foo {
2 public:
3 Foo() {}
4 ~Foo() {};
5 };
6
7 void foo() {
8 Foo f;
9 }
10
11 // TODO: Support destructors (notice how the dtor has no usages listed).
12 // - check if variable is a pointer. if so, do *not* insert dtor
13 // - check if variable is normal type. if so, insert dtor
14 // - scan for statements that look like dtors in function def handler
15 // - figure out some way to support w/ unique_ptrs?
16 /*
17 OUTPUT:
18 {
19 "includes": [],
20 "skipped_ranges": [],
21 "usr2func": [{
22 "usr": 3385168158331140247,
23 "detailed_name": "Foo::Foo()",
24 "qual_name_offset": 0,
25 "short_name": "Foo",
26 "spell": "3:3-3:6|3:3-3:11|1026|-1",
27 "bases": [],
28 "vars": [],
29 "callees": [],
30 "kind": 9,
31 "parent_kind": 5,
32 "storage": 0,
33 "declarations": [],
34 "derived": [],
35 "uses": ["8:7-8:8|16676|-1"]
36 }, {
37 "usr": 4259594751088586730,
38 "detailed_name": "void foo()",
39 "qual_name_offset": 5,
40 "short_name": "foo",
41 "spell": "7:6-7:9|7:1-9:2|2|-1",
42 "bases": [],
43 "vars": [1893354193220338759],
44 "callees": ["8:7-8:8|3385168158331140247|3|16676", "8:7-8:8|3385168158331140247|3|16676"],
45 "kind": 12,
46 "parent_kind": 1,
47 "storage": 0,
48 "declarations": [],
49 "derived": [],
50 "uses": []
51 }, {
52 "usr": 7440261702884428359,
53 "detailed_name": "Foo::~Foo() noexcept",
54 "qual_name_offset": 0,
55 "short_name": "~Foo",
56 "spell": "4:3-4:7|4:3-4:12|1026|-1",
57 "bases": [],
58 "vars": [],
59 "callees": [],
60 "kind": 6,
61 "parent_kind": 5,
62 "storage": 0,
63 "declarations": [],
64 "derived": [],
65 "uses": []
66 }],
67 "usr2type": [{
68 "usr": 15041163540773201510,
69 "detailed_name": "class Foo {}",
70 "qual_name_offset": 6,
71 "short_name": "Foo",
72 "spell": "1:7-1:10|1:1-5:2|2|-1",
73 "bases": [],
74 "funcs": [3385168158331140247, 7440261702884428359],
75 "types": [],
76 "vars": [],
77 "alias_of": 0,
78 "kind": 5,
79 "parent_kind": 1,
80 "declarations": [],
81 "derived": [],
82 "instances": [1893354193220338759],
83 "uses": ["3:3-3:6|4|-1", "4:4-4:7|4|-1", "8:3-8:6|4|-1"]
84 }],
85 "usr2var": [{
86 "usr": 1893354193220338759,
87 "detailed_name": "Foo f",
88 "qual_name_offset": 4,
89 "short_name": "f",
90 "spell": "8:7-8:8|8:3-8:8|2|-1",
91 "type": 15041163540773201510,
92 "kind": 13,
93 "parent_kind": 12,
94 "storage": 0,
95 "declarations": [],
96 "uses": []
97 }]
98 }
99 */