| 1 |
#include "make_functions.h" |
| 2 |
|
| 3 |
template <typename T, typename... Args> |
| 4 |
T* MakeUnique(Args&&... args) { |
| 5 |
return nullptr; |
| 6 |
} |
| 7 |
|
| 8 |
template <typename T, typename... Args> |
| 9 |
T* maKE_NoRefs(Args... args) { |
| 10 |
return nullptr; |
| 11 |
} |
| 12 |
|
| 13 |
void caller22() { |
| 14 |
MakeUnique<Foobar>(); |
| 15 |
MakeUnique<Foobar>(1); |
| 16 |
MakeUnique<Foobar>(1, new Bar(), nullptr); |
| 17 |
maKE_NoRefs<Foobar>(1, new Bar(), nullptr); |
| 18 |
} |
| 19 |
|
| 20 |
// TODO: Eliminate the extra entries in the "types" array here. They come from |
| 21 |
// the template function definitions. |
| 22 |
|
| 23 |
// Foobar is defined in a separate file to ensure that we can attribute |
| 24 |
// MakeUnique calls across translation units. |
| 25 |
|
| 26 |
/* |
| 27 |
OUTPUT: make_functions.h |
| 28 |
{ |
| 29 |
"includes": [], |
| 30 |
"skipped_ranges": [], |
| 31 |
"usr2func": [{ |
| 32 |
"usr": 3765833212244435302, |
| 33 |
"detailed_name": "Foobar::Foobar(int &&, Bar *, bool *)", |
| 34 |
"qual_name_offset": 0, |
| 35 |
"short_name": "Foobar", |
| 36 |
"spell": "7:3-7:9|7:3-7:32|1026|-1", |
| 37 |
"bases": [], |
| 38 |
"vars": [], |
| 39 |
"callees": [], |
| 40 |
"kind": 9, |
| 41 |
"parent_kind": 5, |
| 42 |
"storage": 0, |
| 43 |
"declarations": [], |
| 44 |
"derived": [], |
| 45 |
"uses": [] |
| 46 |
}, { |
| 47 |
"usr": 13028995015627606181, |
| 48 |
"detailed_name": "Foobar::Foobar(int)", |
| 49 |
"qual_name_offset": 0, |
| 50 |
"short_name": "Foobar", |
| 51 |
"spell": "6:3-6:9|6:3-6:17|1026|-1", |
| 52 |
"bases": [], |
| 53 |
"vars": [], |
| 54 |
"callees": [], |
| 55 |
"kind": 9, |
| 56 |
"parent_kind": 5, |
| 57 |
"storage": 0, |
| 58 |
"declarations": [], |
| 59 |
"derived": [], |
| 60 |
"uses": [] |
| 61 |
}, { |
| 62 |
"usr": 13131778807733950299, |
| 63 |
"detailed_name": "Foobar::Foobar()", |
| 64 |
"qual_name_offset": 0, |
| 65 |
"short_name": "Foobar", |
| 66 |
"spell": "5:3-5:9|5:3-5:14|1026|-1", |
| 67 |
"bases": [], |
| 68 |
"vars": [], |
| 69 |
"callees": [], |
| 70 |
"kind": 9, |
| 71 |
"parent_kind": 5, |
| 72 |
"storage": 0, |
| 73 |
"declarations": [], |
| 74 |
"derived": [], |
| 75 |
"uses": [] |
| 76 |
}, { |
| 77 |
"usr": 17321436359755983845, |
| 78 |
"detailed_name": "Foobar::Foobar(int, Bar *, bool *)", |
| 79 |
"qual_name_offset": 0, |
| 80 |
"short_name": "Foobar", |
| 81 |
"spell": "8:3-8:9|8:3-8:30|1026|-1", |
| 82 |
"bases": [], |
| 83 |
"vars": [], |
| 84 |
"callees": [], |
| 85 |
"kind": 9, |
| 86 |
"parent_kind": 5, |
| 87 |
"storage": 0, |
| 88 |
"declarations": [], |
| 89 |
"derived": [], |
| 90 |
"uses": [] |
| 91 |
}], |
| 92 |
"usr2type": [{ |
| 93 |
"usr": 12993848456528750350, |
| 94 |
"detailed_name": "struct Bar {}", |
| 95 |
"qual_name_offset": 7, |
| 96 |
"short_name": "Bar", |
| 97 |
"spell": "1:8-1:11|1:1-1:14|2|-1", |
| 98 |
"bases": [], |
| 99 |
"funcs": [], |
| 100 |
"types": [], |
| 101 |
"vars": [], |
| 102 |
"alias_of": 0, |
| 103 |
"kind": 23, |
| 104 |
"parent_kind": 1, |
| 105 |
"declarations": [], |
| 106 |
"derived": [], |
| 107 |
"instances": [], |
| 108 |
"uses": ["7:17-7:20|4|-1", "8:15-8:18|4|-1"] |
| 109 |
}, { |
| 110 |
"usr": 14935975554338052500, |
| 111 |
"detailed_name": "class Foobar {}", |
| 112 |
"qual_name_offset": 6, |
| 113 |
"short_name": "Foobar", |
| 114 |
"spell": "3:7-3:13|3:1-9:2|2|-1", |
| 115 |
"bases": [], |
| 116 |
"funcs": [13131778807733950299, 13028995015627606181, 3765833212244435302, 17321436359755983845], |
| 117 |
"types": [], |
| 118 |
"vars": [], |
| 119 |
"alias_of": 0, |
| 120 |
"kind": 5, |
| 121 |
"parent_kind": 1, |
| 122 |
"declarations": [], |
| 123 |
"derived": [], |
| 124 |
"instances": [], |
| 125 |
"uses": ["5:3-5:9|4|-1", "6:3-6:9|4|-1", "7:3-7:9|4|-1", "8:3-8:9|4|-1"] |
| 126 |
}], |
| 127 |
"usr2var": [] |
| 128 |
} |
| 129 |
OUTPUT: make_functions.cc |
| 130 |
{ |
| 131 |
"includes": [{ |
| 132 |
"line": 0, |
| 133 |
"resolved_path": "&make_functions.h" |
| 134 |
}], |
| 135 |
"skipped_ranges": [], |
| 136 |
"usr2func": [{ |
| 137 |
"usr": 768523651983844320, |
| 138 |
"detailed_name": "", |
| 139 |
"qual_name_offset": 0, |
| 140 |
"short_name": "", |
| 141 |
"bases": [], |
| 142 |
"vars": [2555873744476712860, 2555873744476712860, 2555873744476712860], |
| 143 |
"callees": [], |
| 144 |
"kind": 0, |
| 145 |
"parent_kind": 0, |
| 146 |
"storage": 0, |
| 147 |
"declarations": [], |
| 148 |
"derived": [], |
| 149 |
"uses": [] |
| 150 |
}, { |
| 151 |
"usr": 2532818908869373467, |
| 152 |
"detailed_name": "T *maKE_NoRefs(Args ...args)", |
| 153 |
"qual_name_offset": 3, |
| 154 |
"short_name": "maKE_NoRefs", |
| 155 |
"spell": "9:4-9:15|9:1-11:2|2|-1", |
| 156 |
"bases": [], |
| 157 |
"vars": [3908732770590594660], |
| 158 |
"callees": [], |
| 159 |
"kind": 12, |
| 160 |
"parent_kind": 1, |
| 161 |
"storage": 0, |
| 162 |
"declarations": [], |
| 163 |
"derived": [], |
| 164 |
"uses": ["17:3-17:14|16420|-1"] |
| 165 |
}, { |
| 166 |
"usr": 2816883305867289955, |
| 167 |
"detailed_name": "void caller22()", |
| 168 |
"qual_name_offset": 5, |
| 169 |
"short_name": "caller22", |
| 170 |
"spell": "13:6-13:14|13:1-18:2|2|-1", |
| 171 |
"bases": [], |
| 172 |
"vars": [], |
| 173 |
"callees": ["14:3-14:13|15793662558620604611|3|16420", "15:3-15:13|15793662558620604611|3|16420", |
| 174 |
"16:3-16:13|15793662558620604611|3|16420", "17:3-17:14|2532818908869373467|3|16420"], "kind": 12, "parent_kind": 1, |
| 175 |
"storage": 0, |
| 176 |
"declarations": [], |
| 177 |
"derived": [], |
| 178 |
"uses": [] |
| 179 |
}, { |
| 180 |
"usr": 11138976705878544996, |
| 181 |
"detailed_name": "", |
| 182 |
"qual_name_offset": 0, |
| 183 |
"short_name": "", |
| 184 |
"bases": [], |
| 185 |
"vars": [16395392342608151399], |
| 186 |
"callees": [], |
| 187 |
"kind": 0, |
| 188 |
"parent_kind": 0, |
| 189 |
"storage": 0, |
| 190 |
"declarations": [], |
| 191 |
"derived": [], |
| 192 |
"uses": [] |
| 193 |
}, { |
| 194 |
"usr": 11363675606380070883, |
| 195 |
"detailed_name": "", |
| 196 |
"qual_name_offset": 0, |
| 197 |
"short_name": "", |
| 198 |
"bases": [], |
| 199 |
"vars": [180270746871803062, 180270746871803062, 180270746871803062], |
| 200 |
"callees": [], |
| 201 |
"kind": 0, |
| 202 |
"parent_kind": 0, |
| 203 |
"storage": 0, |
| 204 |
"declarations": [], |
| 205 |
"derived": [], |
| 206 |
"uses": [] |
| 207 |
}, { |
| 208 |
"usr": 15793662558620604611, |
| 209 |
"detailed_name": "T *MakeUnique(Args &&...args)", |
| 210 |
"qual_name_offset": 3, |
| 211 |
"short_name": "MakeUnique", |
| 212 |
"spell": "4:4-4:14|4:1-6:2|2|-1", |
| 213 |
"bases": [], |
| 214 |
"vars": [8463700030555379526], |
| 215 |
"callees": [], |
| 216 |
"kind": 12, |
| 217 |
"parent_kind": 1, |
| 218 |
"storage": 0, |
| 219 |
"declarations": [], |
| 220 |
"derived": [], |
| 221 |
"uses": ["14:3-14:13|16420|-1", "15:3-15:13|16420|-1", "16:3-16:13|16420|-1"] |
| 222 |
}], |
| 223 |
"usr2type": [{ |
| 224 |
"usr": 452, |
| 225 |
"detailed_name": "", |
| 226 |
"qual_name_offset": 0, |
| 227 |
"short_name": "", |
| 228 |
"bases": [], |
| 229 |
"funcs": [], |
| 230 |
"types": [], |
| 231 |
"vars": [], |
| 232 |
"alias_of": 0, |
| 233 |
"kind": 0, |
| 234 |
"parent_kind": 0, |
| 235 |
"declarations": [], |
| 236 |
"derived": [], |
| 237 |
"instances": [180270746871803062], |
| 238 |
"uses": [] |
| 239 |
}, { |
| 240 |
"usr": 488, |
| 241 |
"detailed_name": "", |
| 242 |
"qual_name_offset": 0, |
| 243 |
"short_name": "", |
| 244 |
"bases": [], |
| 245 |
"funcs": [], |
| 246 |
"types": [], |
| 247 |
"vars": [], |
| 248 |
"alias_of": 0, |
| 249 |
"kind": 0, |
| 250 |
"parent_kind": 0, |
| 251 |
"declarations": [], |
| 252 |
"derived": [], |
| 253 |
"instances": [180270746871803062], |
| 254 |
"uses": [] |
| 255 |
}, { |
| 256 |
"usr": 3337128087216004141, |
| 257 |
"detailed_name": "Args", |
| 258 |
"qual_name_offset": 0, |
| 259 |
"short_name": "", |
| 260 |
"bases": [], |
| 261 |
"funcs": [], |
| 262 |
"types": [], |
| 263 |
"vars": [], |
| 264 |
"alias_of": 0, |
| 265 |
"kind": 26, |
| 266 |
"parent_kind": 0, |
| 267 |
"declarations": ["8:35-8:39|8:23-8:39|1|-1"], |
| 268 |
"derived": [], |
| 269 |
"instances": [], |
| 270 |
"uses": ["9:16-9:20|4|-1"] |
| 271 |
}, { |
| 272 |
"usr": 9281343527065946499, |
| 273 |
"detailed_name": "T", |
| 274 |
"qual_name_offset": 0, |
| 275 |
"short_name": "", |
| 276 |
"bases": [], |
| 277 |
"funcs": [], |
| 278 |
"types": [], |
| 279 |
"vars": [], |
| 280 |
"alias_of": 0, |
| 281 |
"kind": 26, |
| 282 |
"parent_kind": 0, |
| 283 |
"declarations": ["3:20-3:21|3:11-3:21|1|-1"], |
| 284 |
"derived": [], |
| 285 |
"instances": [], |
| 286 |
"uses": ["4:1-4:2|4|-1"] |
| 287 |
}, { |
| 288 |
"usr": 10771590811355716928, |
| 289 |
"detailed_name": "Args", |
| 290 |
"qual_name_offset": 0, |
| 291 |
"short_name": "", |
| 292 |
"bases": [], |
| 293 |
"funcs": [], |
| 294 |
"types": [], |
| 295 |
"vars": [], |
| 296 |
"alias_of": 0, |
| 297 |
"kind": 26, |
| 298 |
"parent_kind": 0, |
| 299 |
"declarations": ["3:35-3:39|3:23-3:39|1|-1"], |
| 300 |
"derived": [], |
| 301 |
"instances": [], |
| 302 |
"uses": ["4:15-4:19|4|-1"] |
| 303 |
}, { |
| 304 |
"usr": 11897454629873246477, |
| 305 |
"detailed_name": "T", |
| 306 |
"qual_name_offset": 0, |
| 307 |
"short_name": "", |
| 308 |
"bases": [], |
| 309 |
"funcs": [], |
| 310 |
"types": [], |
| 311 |
"vars": [], |
| 312 |
"alias_of": 0, |
| 313 |
"kind": 26, |
| 314 |
"parent_kind": 0, |
| 315 |
"declarations": ["8:20-8:21|8:11-8:21|1|-1"], |
| 316 |
"derived": [], |
| 317 |
"instances": [], |
| 318 |
"uses": ["9:1-9:2|4|-1"] |
| 319 |
}, { |
| 320 |
"usr": 12993848456528750350, |
| 321 |
"detailed_name": "struct Bar {}", |
| 322 |
"qual_name_offset": 7, |
| 323 |
"short_name": "Bar", |
| 324 |
"bases": [], |
| 325 |
"funcs": [], |
| 326 |
"types": [], |
| 327 |
"vars": [], |
| 328 |
"alias_of": 0, |
| 329 |
"kind": 23, |
| 330 |
"parent_kind": 0, |
| 331 |
"declarations": [], |
| 332 |
"derived": [], |
| 333 |
"instances": [], |
| 334 |
"uses": ["16:29-16:32|4|-1", "17:30-17:33|4|-1"] |
| 335 |
}, { |
| 336 |
"usr": 14935975554338052500, |
| 337 |
"detailed_name": "class Foobar {}", |
| 338 |
"qual_name_offset": 6, |
| 339 |
"short_name": "Foobar", |
| 340 |
"bases": [], |
| 341 |
"funcs": [], |
| 342 |
"types": [], |
| 343 |
"vars": [], |
| 344 |
"alias_of": 0, |
| 345 |
"kind": 5, |
| 346 |
"parent_kind": 0, |
| 347 |
"declarations": [], |
| 348 |
"derived": [], |
| 349 |
"instances": [], |
| 350 |
"uses": ["14:14-14:20|4|-1", "15:14-15:20|4|-1", "16:14-16:20|4|-1", "17:15-17:21|4|-1"] |
| 351 |
}], |
| 352 |
"usr2var": [{ |
| 353 |
"usr": 180270746871803062, |
| 354 |
"detailed_name": "int args", |
| 355 |
"qual_name_offset": 4, |
| 356 |
"short_name": "args", |
| 357 |
"spell": "9:24-9:28|9:16-9:28|1026|-1", |
| 358 |
"type": 488, |
| 359 |
"kind": 253, |
| 360 |
"parent_kind": 12, |
| 361 |
"storage": 0, |
| 362 |
"declarations": [], |
| 363 |
"uses": [] |
| 364 |
}, { |
| 365 |
"usr": 2555873744476712860, |
| 366 |
"detailed_name": "int &&args", |
| 367 |
"qual_name_offset": 6, |
| 368 |
"short_name": "args", |
| 369 |
"spell": "4:25-4:29|4:15-4:29|1026|-1", |
| 370 |
"type": 0, |
| 371 |
"kind": 253, |
| 372 |
"parent_kind": 12, |
| 373 |
"storage": 0, |
| 374 |
"declarations": [], |
| 375 |
"uses": [] |
| 376 |
}, { |
| 377 |
"usr": 3908732770590594660, |
| 378 |
"detailed_name": "Args ...args", |
| 379 |
"qual_name_offset": 8, |
| 380 |
"short_name": "args", |
| 381 |
"spell": "9:24-9:28|9:16-9:28|1026|-1", |
| 382 |
"type": 0, |
| 383 |
"kind": 253, |
| 384 |
"parent_kind": 12, |
| 385 |
"storage": 0, |
| 386 |
"declarations": [], |
| 387 |
"uses": [] |
| 388 |
}, { |
| 389 |
"usr": 8463700030555379526, |
| 390 |
"detailed_name": "Args &&...args", |
| 391 |
"qual_name_offset": 10, |
| 392 |
"short_name": "args", |
| 393 |
"spell": "4:25-4:29|4:15-4:29|1026|-1", |
| 394 |
"type": 0, |
| 395 |
"kind": 253, |
| 396 |
"parent_kind": 12, |
| 397 |
"storage": 0, |
| 398 |
"declarations": [], |
| 399 |
"uses": [] |
| 400 |
}, { |
| 401 |
"usr": 16395392342608151399, |
| 402 |
"detailed_name": "int &&args", |
| 403 |
"qual_name_offset": 6, |
| 404 |
"short_name": "args", |
| 405 |
"spell": "4:25-4:29|4:15-4:29|1026|-1", |
| 406 |
"type": 0, |
| 407 |
"kind": 253, |
| 408 |
"parent_kind": 12, |
| 409 |
"storage": 0, |
| 410 |
"declarations": [], |
| 411 |
"uses": [] |
| 412 |
}] |
| 413 |
} |
| 414 |
*/ |