ccls/tests/constructors/make_functions.cc

327 lines
8.3 KiB
C++
Raw Normal View History

#include "make_functions.h"
2017-11-07 09:00:59 +00:00
template <typename T, typename... Args>
T* MakeUnique(Args&&... args) {
return nullptr;
}
template <typename T, typename... Args>
T* maKE_NoRefs(Args... args) {
return nullptr;
}
void caller22() {
MakeUnique<Foobar>();
MakeUnique<Foobar>(1);
MakeUnique<Foobar>(1, new Bar(), nullptr);
maKE_NoRefs<Foobar>(1, new Bar(), nullptr);
}
// TODO: Eliminate the extra entries in the "types" array here. They come from
// the template function definitions.
// Foobar is defined in a separate file to ensure that we can attribute
// MakeUnique calls across translation units.
2017-11-07 09:00:59 +00:00
/*
OUTPUT: make_functions.h
2017-11-07 09:00:59 +00:00
{
2017-12-12 05:15:37 +00:00
"includes": [],
"skipped_by_preprocessor": [],
2017-11-07 09:00:59 +00:00
"types": [{
"id": 0,
"usr": "c:@S@Bar",
"short_name": "Bar",
"detailed_name": "Bar",
"hover": "Bar",
"definition_spelling": "1:8-1:11",
"definition_extent": "1:1-1:14",
2017-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [],
"vars": [],
"instances": [],
"uses": ["1:8-1:11", "7:17-7:20", "8:15-8:18"]
2017-11-07 09:00:59 +00:00
}, {
"id": 1,
2017-11-07 09:00:59 +00:00
"usr": "c:@S@Foobar",
"short_name": "Foobar",
"detailed_name": "Foobar",
"hover": "Foobar",
"definition_spelling": "3:7-3:13",
"definition_extent": "3:1-9:2",
2017-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [0, 1, 2, 3],
2017-12-12 05:15:37 +00:00
"vars": [],
"instances": [],
"uses": ["3:7-3:13", "5:3-5:9", "6:3-6:9", "7:3-7:9", "8:3-8:9"]
2017-11-07 09:00:59 +00:00
}],
"funcs": [{
"id": 0,
2017-12-02 01:07:03 +00:00
"is_operator": false,
2017-11-07 09:00:59 +00:00
"usr": "c:@S@Foobar@F@Foobar#",
"short_name": "Foobar",
"detailed_name": "void Foobar::Foobar()",
"hover": "void Foobar::Foobar()",
2017-12-12 05:15:37 +00:00
"declarations": [],
"definition_spelling": "5:3-5:9",
"definition_extent": "5:3-5:14",
2017-12-12 05:15:37 +00:00
"declaring_type": 1,
"derived": [],
"locals": [],
"callers": [],
"callees": []
2017-11-07 09:00:59 +00:00
}, {
"id": 1,
2017-12-02 01:07:03 +00:00
"is_operator": false,
2017-11-07 09:00:59 +00:00
"usr": "c:@S@Foobar@F@Foobar#I#",
"short_name": "Foobar",
"detailed_name": "void Foobar::Foobar(int)",
"hover": "void Foobar::Foobar(int)",
2017-12-12 05:15:37 +00:00
"declarations": [],
"definition_spelling": "6:3-6:9",
"definition_extent": "6:3-6:17",
2017-12-12 05:15:37 +00:00
"declaring_type": 1,
"derived": [],
"locals": [],
"callers": [],
"callees": []
2017-11-07 09:00:59 +00:00
}, {
"id": 2,
2017-12-02 01:07:03 +00:00
"is_operator": false,
2017-11-07 09:00:59 +00:00
"usr": "c:@S@Foobar@F@Foobar#&&I#*$@S@Bar#*b#",
"short_name": "Foobar",
"detailed_name": "void Foobar::Foobar(int &&, Bar *, bool *)",
"hover": "void Foobar::Foobar(int &&, Bar *, bool *)",
2017-12-12 05:15:37 +00:00
"declarations": [],
"definition_spelling": "7:3-7:9",
"definition_extent": "7:3-7:32",
2017-12-12 05:15:37 +00:00
"declaring_type": 1,
"derived": [],
"locals": [],
"callers": [],
"callees": []
2017-11-07 09:00:59 +00:00
}, {
"id": 3,
2017-12-02 01:07:03 +00:00
"is_operator": false,
2017-11-07 09:00:59 +00:00
"usr": "c:@S@Foobar@F@Foobar#I#*$@S@Bar#*b#",
"short_name": "Foobar",
"detailed_name": "void Foobar::Foobar(int, Bar *, bool *)",
"hover": "void Foobar::Foobar(int, Bar *, bool *)",
2017-12-12 05:15:37 +00:00
"declarations": [],
"definition_spelling": "8:3-8:9",
"definition_extent": "8:3-8:30",
2017-12-12 05:15:37 +00:00
"declaring_type": 1,
"derived": [],
"locals": [],
"callers": [],
"callees": []
}],
"vars": []
}
OUTPUT: make_functions.cc
{
"includes": [{
"line": 1,
2017-11-30 03:21:23 +00:00
"resolved_path": "&make_functions.h"
}],
2017-12-12 05:15:37 +00:00
"skipped_by_preprocessor": [],
"types": [{
"id": 0,
"usr": "c:make_functions.cc@41",
2017-12-12 05:06:27 +00:00
"short_name": "",
"detailed_name": "",
"hover": "",
2017-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [],
"vars": [],
"instances": [],
"uses": ["4:1-4:2"]
2017-11-07 09:00:59 +00:00
}, {
"id": 1,
"usr": "c:make_functions.cc@53",
2017-12-12 05:06:27 +00:00
"short_name": "",
"detailed_name": "",
"hover": "",
2017-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [],
"vars": [],
"instances": [],
"uses": ["4:15-4:19"]
}, {
"id": 2,
"usr": "c:make_functions.cc@139",
2017-12-12 05:06:27 +00:00
"short_name": "",
"detailed_name": "",
"hover": "",
2017-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [],
"vars": [],
"instances": [],
"uses": ["9:1-9:2"]
}, {
"id": 3,
"usr": "c:make_functions.cc@151",
2017-12-12 05:06:27 +00:00
"short_name": "",
"detailed_name": "",
"hover": "",
2017-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [],
"vars": [],
"instances": [],
"uses": ["9:16-9:20"]
}, {
"id": 4,
"usr": "c:@S@Foobar",
2017-12-12 05:06:27 +00:00
"short_name": "",
"detailed_name": "",
"hover": "",
2017-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [],
"vars": [],
"instances": [],
"uses": ["14:14-14:20", "15:14-15:20", "16:14-16:20", "17:15-17:21"]
}, {
"id": 5,
"usr": "c:@S@Bar",
2017-12-12 05:06:27 +00:00
"short_name": "",
"detailed_name": "",
"hover": "",
2017-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [],
"vars": [],
"instances": [],
"uses": ["16:29-16:32", "17:30-17:33"]
}],
"funcs": [{
"id": 0,
2017-12-02 01:07:03 +00:00
"is_operator": false,
"usr": "c:@FT@>2#T#pTMakeUnique#P&&t0.1#*t0.0#",
"short_name": "MakeUnique",
"detailed_name": "T *MakeUnique(Args &&...)",
"hover": "T *MakeUnique(Args &&...)",
2017-12-12 05:15:37 +00:00
"declarations": [],
"definition_spelling": "4:4-4:14",
"definition_extent": "4:1-6:2",
2017-12-12 05:15:37 +00:00
"derived": [],
"locals": [],
"callers": ["2@14:3-14:13", "2@15:3-15:13", "2@16:3-16:13"],
"callees": []
}, {
"id": 1,
2017-12-02 01:07:03 +00:00
"is_operator": false,
"usr": "c:@FT@>2#T#pTmaKE_NoRefs#Pt0.1#*t0.0#",
"short_name": "maKE_NoRefs",
"detailed_name": "T *maKE_NoRefs(Args...)",
"hover": "T *maKE_NoRefs(Args...)",
2017-12-12 05:15:37 +00:00
"declarations": [],
"definition_spelling": "9:4-9:15",
"definition_extent": "9:1-11:2",
2017-12-12 05:15:37 +00:00
"derived": [],
"locals": [],
"callers": ["2@17:3-17:14"],
"callees": []
}, {
"id": 2,
2017-12-02 01:07:03 +00:00
"is_operator": false,
2017-11-07 09:00:59 +00:00
"usr": "c:@F@caller22#",
"short_name": "caller22",
"detailed_name": "void caller22()",
"hover": "void caller22()",
2017-12-12 05:15:37 +00:00
"declarations": [],
"definition_spelling": "13:6-13:14",
"definition_extent": "13:1-18:2",
2017-12-12 05:15:37 +00:00
"derived": [],
"locals": [],
"callers": [],
"callees": ["0@14:3-14:13", "0@15:3-15:13", "0@16:3-16:13", "1@17:3-17:14"]
}, {
"id": 3,
2017-12-02 01:07:03 +00:00
"is_operator": false,
"usr": "c:@S@Foobar@F@Foobar#",
2017-12-12 05:06:27 +00:00
"short_name": "",
"detailed_name": "",
"hover": "",
2017-12-12 05:15:37 +00:00
"declarations": [],
"derived": [],
"locals": [],
"callers": ["~-1@14:3-14:13"],
"callees": []
}, {
"id": 4,
2017-12-02 01:07:03 +00:00
"is_operator": false,
"usr": "c:@S@Foobar@F@Foobar#I#",
2017-12-12 05:06:27 +00:00
"short_name": "",
"detailed_name": "",
"hover": "",
2017-12-12 05:15:37 +00:00
"declarations": [],
"derived": [],
"locals": [],
"callers": ["~-1@15:3-15:13"],
"callees": []
}, {
"id": 5,
2017-12-02 01:07:03 +00:00
"is_operator": false,
"usr": "c:@S@Foobar@F@Foobar#&&I#*$@S@Bar#*b#",
2017-12-12 05:06:27 +00:00
"short_name": "",
"detailed_name": "",
"hover": "",
2017-12-12 05:15:37 +00:00
"declarations": [],
"derived": [],
"locals": [],
"callers": ["~-1@16:3-16:13"],
"callees": []
}, {
"id": 6,
2017-12-02 01:07:03 +00:00
"is_operator": false,
"usr": "c:@S@Foobar@F@Foobar#I#*$@S@Bar#*b#",
2017-12-12 05:06:27 +00:00
"short_name": "",
"detailed_name": "",
"hover": "",
2017-12-12 05:15:37 +00:00
"declarations": [],
"derived": [],
"locals": [],
"callers": ["~-1@17:3-17:14"],
"callees": []
2017-11-07 09:00:59 +00:00
}],
"vars": [{
"id": 0,
"usr": "c:make_functions.cc@86@FT@>2#T#pTMakeUnique#P&&t0.1#*t0.0#@args",
2017-11-07 09:00:59 +00:00
"short_name": "args",
"detailed_name": "Args &&... args",
"hover": "Args &&...",
"definition_spelling": "4:25-4:29",
"definition_extent": "4:15-4:29",
2017-11-07 09:00:59 +00:00
"is_local": true,
"is_macro": false,
"uses": ["4:25-4:29"]
2017-11-07 09:00:59 +00:00
}, {
"id": 1,
"usr": "c:make_functions.cc@185@FT@>2#T#pTmaKE_NoRefs#Pt0.1#*t0.0#@args",
2017-11-07 09:00:59 +00:00
"short_name": "args",
"detailed_name": "Args... args",
"hover": "Args...",
"definition_spelling": "9:24-9:28",
"definition_extent": "9:16-9:28",
2017-11-07 09:00:59 +00:00
"is_local": true,
"is_macro": false,
"uses": ["9:24-9:28"]
2017-11-07 09:00:59 +00:00
}]
}
*/