|
1 |
| -includes = ["memory"] |
| 1 | +includes = ["functional", "memory"] |
2 | 2 | definitions = '''
|
3 | 3 | struct RawNode {
|
4 | 4 | uint64_t value;
|
@@ -28,107 +28,219 @@ definitions = '''
|
28 | 28 | third->next = first;
|
29 | 29 | return first;
|
30 | 30 | '''
|
31 |
| - cli_options = ["--chase-raw-pointers"] |
| 31 | + cli_options = ["--chase-raw-pointers"] |
32 | 32 | expect_json = '''
|
33 |
| - [{ |
34 |
| - "typeName": "RawNode", |
35 |
| - "isTypedef": false, |
36 |
| - "staticSize": 16, |
37 |
| - "dynamicSize": 32, |
38 |
| - "members": [ |
39 |
| - { |
40 |
| - "name": "value", |
41 |
| - "typePath": "value", |
42 |
| - "typeName": "uint64_t", |
43 |
| - "staticSize": 8, |
44 |
| - "dynamicSize": 0 |
45 |
| - }, |
46 |
| - { |
47 |
| - "name": "next", |
48 |
| - "typePath": "next", |
49 |
| - "typeName": "struct RawNode *", |
50 |
| - "isTypedef": false, |
51 |
| - "staticSize": 8, |
52 |
| - "dynamicSize": 32, |
53 |
| - "members": [ |
54 |
| - { |
55 |
| - "name": "", |
56 |
| - "typePath": "", |
57 |
| - "typeName": "RawNode", |
58 |
| - "isTypedef": false, |
59 |
| - "staticSize": 16, |
60 |
| - "dynamicSize": 16, |
61 |
| - "members": [ |
62 |
| - { |
63 |
| - "name": "value", |
64 |
| - "typePath": "value", |
65 |
| - "typeName": "uint64_t", |
66 |
| - "staticSize": 8, |
67 |
| - "dynamicSize": 0 |
68 |
| - }, |
69 |
| - { |
70 |
| - "name": "next", |
71 |
| - "typePath": "next", |
72 |
| - "typeName": "struct RawNode *", |
73 |
| - "isTypedef": false, |
74 |
| - "staticSize": 8, |
75 |
| - "dynamicSize": 16, |
76 |
| - "members": [ |
77 |
| - { |
78 |
| - "name": "", |
79 |
| - "typePath": "", |
80 |
| - "typeName": "RawNode", |
81 |
| - "isTypedef": false, |
82 |
| - "staticSize": 16, |
83 |
| - "dynamicSize": 0, |
84 |
| - "members": [ |
85 |
| - { |
86 |
| - "name": "value", |
87 |
| - "typePath": "value", |
88 |
| - "typeName": "uint64_t", |
89 |
| - "staticSize": 8, |
90 |
| - "dynamicSize": 0 |
91 |
| - }, |
92 |
| - { |
93 |
| - "name": "next", |
94 |
| - "typePath": "next", |
95 |
| - "typeName": "struct RawNode *", |
96 |
| - "isTypedef": false, |
97 |
| - "staticSize": 8, |
98 |
| - "dynamicSize": 0 |
99 |
| - } |
100 |
| - ] |
101 |
| - } |
102 |
| - ] |
103 |
| - } |
104 |
| - ] |
105 |
| - } |
106 |
| - ] |
107 |
| - } |
108 |
| - ] |
109 |
| - }] |
| 33 | + [ |
| 34 | + { |
| 35 | + "typeName": "RawNode", |
| 36 | + "staticSize": 16, |
| 37 | + "dynamicSize": 32, |
| 38 | + "members": [ |
| 39 | + { |
| 40 | + "typeName": "uint64_t", |
| 41 | + "staticSize": 8, |
| 42 | + "dynamicSize": 0 |
| 43 | + }, |
| 44 | + { |
| 45 | + "typeName": "struct RawNode *", |
| 46 | + "staticSize": 8, |
| 47 | + "dynamicSize": 32, |
| 48 | + "members": [ |
| 49 | + { |
| 50 | + "typeName": "RawNode", |
| 51 | + "staticSize": 16, |
| 52 | + "dynamicSize": 16, |
| 53 | + "members": [ |
| 54 | + { |
| 55 | + "typeName": "uint64_t", |
| 56 | + "staticSize": 8, |
| 57 | + "dynamicSize": 0 |
| 58 | + }, |
| 59 | + { |
| 60 | + "typeName": "struct RawNode *", |
| 61 | + "staticSize": 8, |
| 62 | + "dynamicSize": 16, |
| 63 | + "members": [ |
| 64 | + { |
| 65 | + "typeName": "RawNode", |
| 66 | + "staticSize": 16, |
| 67 | + "dynamicSize": 0, |
| 68 | + "members": [ |
| 69 | + { |
| 70 | + "typeName": "uint64_t", |
| 71 | + "staticSize": 8, |
| 72 | + "dynamicSize": 0 |
| 73 | + }, |
| 74 | + { |
| 75 | + "typeName": "struct RawNode *", |
| 76 | + "staticSize": 8, |
| 77 | + "dynamicSize": 0 |
| 78 | + } |
| 79 | + ] |
| 80 | + } |
| 81 | + ] |
| 82 | + } |
| 83 | + ] |
| 84 | + } |
| 85 | + ] |
| 86 | + } |
| 87 | + ] |
| 88 | + } |
| 89 | + ] |
110 | 90 | '''
|
111 | 91 |
|
112 | 92 | [cases.unique_ptr]
|
113 |
| - param_types = ["UniqueNode*"] |
| 93 | + oil_skip = "OIL processes one node in the cycle twice" # https://github.com/facebookexperimental/object-introspection/issues/104 |
| 94 | + param_types = ["std::reference_wrapper<UniqueNode>&"] |
114 | 95 | setup = '''
|
115 | 96 | auto first = std::make_unique<UniqueNode>();
|
116 | 97 | auto firstPtr = first.get();
|
117 | 98 | first->next = std::make_unique<UniqueNode>();
|
118 | 99 | first->next->next = std::make_unique<UniqueNode>();
|
119 | 100 | first->next->next->next = std::move(first);
|
120 |
| - return firstPtr; |
| 101 | + return *firstPtr; |
| 102 | + ''' |
| 103 | + expect_json = ''' |
| 104 | + [ |
| 105 | + { |
| 106 | + "typeName": "reference_wrapper<ns_cycles::UniqueNode>", |
| 107 | + "staticSize": 8, |
| 108 | + "dynamicSize": 48, |
| 109 | + "members": [ |
| 110 | + { |
| 111 | + "typeName": "UniqueNode", |
| 112 | + "staticSize": 16, |
| 113 | + "dynamicSize": 32, |
| 114 | + "members": [ |
| 115 | + { |
| 116 | + "typeName": "uint64_t", |
| 117 | + "staticSize": 8, |
| 118 | + "dynamicSize": 0 |
| 119 | + }, |
| 120 | + { |
| 121 | + "typeName": "unique_ptr<ns_cycles::UniqueNode, std::default_delete<ns_cycles::UniqueNode> >", |
| 122 | + "staticSize": 8, |
| 123 | + "dynamicSize": 32, |
| 124 | + "members": [ |
| 125 | + { |
| 126 | + "typeName": "UniqueNode", |
| 127 | + "staticSize": 16, |
| 128 | + "dynamicSize": 16, |
| 129 | + "members": [ |
| 130 | + { |
| 131 | + "typeName": "uint64_t", |
| 132 | + "staticSize": 8, |
| 133 | + "dynamicSize": 0 |
| 134 | + }, |
| 135 | + { |
| 136 | + "typeName": "unique_ptr<ns_cycles::UniqueNode, std::default_delete<ns_cycles::UniqueNode> >", |
| 137 | + "staticSize": 8, |
| 138 | + "dynamicSize": 16, |
| 139 | + "members": [ |
| 140 | + { |
| 141 | + "typeName": "UniqueNode", |
| 142 | + "staticSize": 16, |
| 143 | + "dynamicSize": 0, |
| 144 | + "members": [ |
| 145 | + { |
| 146 | + "typeName": "uint64_t", |
| 147 | + "staticSize": 8, |
| 148 | + "dynamicSize": 0 |
| 149 | + }, |
| 150 | + { |
| 151 | + "typeName": "unique_ptr<ns_cycles::UniqueNode, std::default_delete<ns_cycles::UniqueNode> >", |
| 152 | + "staticSize": 8, |
| 153 | + "dynamicSize": 0 |
| 154 | + } |
| 155 | + ] |
| 156 | + } |
| 157 | + ] |
| 158 | + } |
| 159 | + ] |
| 160 | + } |
| 161 | + ] |
| 162 | + } |
| 163 | + ] |
| 164 | + } |
| 165 | + ] |
| 166 | + } |
| 167 | + ] |
121 | 168 | '''
|
122 |
| - # TODO check JSON |
123 | 169 |
|
124 | 170 | [cases.shared_ptr]
|
125 |
| - param_types = ["SharedNode*"] |
| 171 | + oil_skip = "OIL processes one node in the cycle twice" # https://github.com/facebookexperimental/object-introspection/issues/104 |
| 172 | + param_types = ["std::reference_wrapper<SharedNode>&"] |
126 | 173 | setup = '''
|
127 | 174 | auto first = std::make_shared<SharedNode>();
|
128 | 175 | auto firstPtr = first.get();
|
129 | 176 | first->next = std::make_shared<SharedNode>();
|
130 | 177 | first->next->next = std::make_shared<SharedNode>();
|
131 | 178 | first->next->next->next = first;
|
132 |
| - return firstPtr; |
| 179 | + return *firstPtr; |
| 180 | + ''' |
| 181 | + expect_json = ''' |
| 182 | + [ |
| 183 | + { |
| 184 | + "typeName": "reference_wrapper<ns_cycles::SharedNode>", |
| 185 | + "staticSize": 8, |
| 186 | + "dynamicSize": 72, |
| 187 | + "members": [ |
| 188 | + { |
| 189 | + "typeName": "SharedNode", |
| 190 | + "staticSize": 24, |
| 191 | + "dynamicSize": 48, |
| 192 | + "members": [ |
| 193 | + { |
| 194 | + "typeName": "uint64_t", |
| 195 | + "staticSize": 8, |
| 196 | + "dynamicSize": 0 |
| 197 | + }, |
| 198 | + { |
| 199 | + "typeName": "shared_ptr<ns_cycles::SharedNode>", |
| 200 | + "staticSize": 16, |
| 201 | + "dynamicSize": 48, |
| 202 | + "members": [ |
| 203 | + { |
| 204 | + "typeName": "SharedNode", |
| 205 | + "staticSize": 24, |
| 206 | + "dynamicSize": 24, |
| 207 | + "members": [ |
| 208 | + { |
| 209 | + "typeName": "uint64_t", |
| 210 | + "staticSize": 8, |
| 211 | + "dynamicSize": 0 |
| 212 | + }, |
| 213 | + { |
| 214 | + "typeName": "shared_ptr<ns_cycles::SharedNode>", |
| 215 | + "staticSize": 16, |
| 216 | + "dynamicSize": 24, |
| 217 | + "members": [ |
| 218 | + { |
| 219 | + "typeName": "SharedNode", |
| 220 | + "staticSize": 24, |
| 221 | + "dynamicSize": 0, |
| 222 | + "members": [ |
| 223 | + { |
| 224 | + "typeName": "uint64_t", |
| 225 | + "staticSize": 8, |
| 226 | + "dynamicSize": 0 |
| 227 | + }, |
| 228 | + { |
| 229 | + "typeName": "shared_ptr<ns_cycles::SharedNode>", |
| 230 | + "staticSize": 16, |
| 231 | + "dynamicSize": 0 |
| 232 | + } |
| 233 | + ] |
| 234 | + } |
| 235 | + ] |
| 236 | + } |
| 237 | + ] |
| 238 | + } |
| 239 | + ] |
| 240 | + } |
| 241 | + ] |
| 242 | + } |
| 243 | + ] |
| 244 | + } |
| 245 | + ] |
133 | 246 | '''
|
134 |
| - # TODO check JSON |
|
0 commit comments