ccls/tests/templates/implicit_variable_instantiation.cc

93 lines
2.3 KiB
C++
Raw Normal View History

namespace ns {
enum VarType {};
template<typename _>
struct Holder {
static constexpr VarType static_var = (VarType)0x0;
};
template<typename _>
const typename VarType Holder<_>::static_var;
int Foo = Holder<int>::static_var;
int Foo2 = Holder<int>::static_var;
}
/*
OUTPUT:
{
2017-12-12 05:15:37 +00:00
"includes": [],
"skipped_by_preprocessor": [],
"types": [{
"id": 0,
"usr": "c:@N@ns@E@VarType",
"short_name": "VarType",
"detailed_name": "ns::VarType",
"hover": "ns::VarType",
2017-04-05 08:29:15 +00:00
"definition_spelling": "2:8-2:15",
"definition_extent": "2:3-2:18",
2017-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [],
"vars": [],
"instances": [0],
2017-04-19 04:58:39 +00:00
"uses": ["2:8-2:15", "6:22-6:29", "6:44-6:51", "10:18-10:25"]
}, {
"id": 1,
"usr": "c:@N@ns@ST>1#T@Holder",
"short_name": "Holder",
"detailed_name": "ns::Holder",
"hover": "ns::Holder",
2017-04-05 08:29:15 +00:00
"definition_spelling": "5:10-5:16",
"definition_extent": "5:3-7:4",
2017-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [],
"vars": [0],
2017-12-12 05:15:37 +00:00
"instances": [],
2017-04-19 04:58:39 +00:00
"uses": ["5:10-5:16", "10:26-10:32", "13:13-13:19", "14:14-14:20"]
}],
2017-12-12 05:15:37 +00:00
"funcs": [],
2017-03-07 18:17:49 +00:00
"vars": [{
"id": 0,
"usr": "c:@N@ns@ST>1#T@Holder@static_var",
"short_name": "static_var",
"detailed_name": "const ns::VarType ns::Holder::static_var",
"hover": "const ns::VarType",
2017-04-05 08:29:15 +00:00
"declaration": "6:30-6:40",
"definition_spelling": "10:37-10:47",
"definition_extent": "9:3-10:47",
"variable_type": 0,
"declaring_type": 1,
"is_local": false,
"is_macro": false,
2017-04-05 08:29:15 +00:00
"uses": ["6:30-6:40", "10:37-10:47", "13:26-13:36", "14:27-14:37"]
}, {
"id": 1,
"usr": "c:@N@ns@Foo",
"short_name": "Foo",
"detailed_name": "int ns::Foo",
"hover": "int",
2017-04-05 08:29:15 +00:00
"definition_spelling": "13:7-13:10",
"definition_extent": "13:3-13:36",
"is_local": false,
"is_macro": false,
2017-04-05 08:29:15 +00:00
"uses": ["13:7-13:10"]
}, {
"id": 2,
"usr": "c:@N@ns@Foo2",
"short_name": "Foo2",
"detailed_name": "int ns::Foo2",
"hover": "int",
2017-04-05 08:29:15 +00:00
"definition_spelling": "14:7-14:11",
"definition_extent": "14:3-14:37",
"is_local": false,
"is_macro": false,
2017-04-05 08:29:15 +00:00
"uses": ["14:7-14:11"]
}]
}
2017-03-07 18:17:49 +00:00
*/