ccls/tests/usage/usage_inside_of_call.cc

129 lines
3.1 KiB
C++
Raw Normal View History

2017-02-19 09:17:37 +00:00
void called(int a);
int gen();
struct Foo {
static int static_var;
int field_var;
};
2017-02-20 06:06:46 +00:00
int Foo::static_var = 0;
2017-02-19 09:17:37 +00:00
void foo() {
int a = 5;
called(a + gen() + Foo().field_var + Foo::static_var);
}
/*
OUTPUT:
{
2017-12-12 05:15:37 +00:00
"includes": [],
"skipped_by_preprocessor": [],
2017-02-19 09:17:37 +00:00
"types": [{
"id": 0,
"usr": "c:@S@Foo",
"short_name": "Foo",
"detailed_name": "Foo",
"hover": "Foo",
2017-04-05 08:29:15 +00:00
"definition_spelling": "5:8-5:11",
"definition_extent": "5:1-8:2",
2017-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [],
2017-02-20 06:06:46 +00:00
"vars": [1, 0],
2017-12-12 05:15:37 +00:00
"instances": [],
2017-04-19 04:58:39 +00:00
"uses": ["5:8-5:11", "10:5-10:8", "14:22-14:25", "14:40-14:43"]
2017-02-19 09:17:37 +00:00
}],
2017-03-08 00:21:23 +00:00
"funcs": [{
2017-02-19 09:17:37 +00:00
"id": 0,
2017-12-02 01:07:03 +00:00
"is_operator": false,
2017-02-19 09:17:37 +00:00
"usr": "c:@F@called#I#",
"short_name": "called",
"detailed_name": "void called(int)",
"hover": "void called(int)",
"declarations": [{
"spelling": "1:6-1:12",
"extent": "1:1-1:19",
"content": "void called(int a)",
"param_spellings": ["1:17-1:18"]
}],
2017-12-19 06:15:46 +00:00
"base": [],
2017-12-12 05:15:37 +00:00
"derived": [],
"locals": [],
"callers": ["2@14:3-14:9"],
"callees": []
2017-02-19 09:17:37 +00:00
}, {
"id": 1,
2017-12-02 01:07:03 +00:00
"is_operator": false,
2017-02-19 09:17:37 +00:00
"usr": "c:@F@gen#",
"short_name": "gen",
"detailed_name": "int gen()",
"hover": "int gen()",
"declarations": [{
"spelling": "3:5-3:8",
"extent": "3:1-3:10",
2017-12-12 05:15:37 +00:00
"content": "int gen()",
"param_spellings": []
}],
2017-12-19 06:15:46 +00:00
"base": [],
2017-12-12 05:15:37 +00:00
"derived": [],
"locals": [],
"callers": ["2@14:14-14:17"],
"callees": []
2017-02-19 09:17:37 +00:00
}, {
"id": 2,
2017-12-02 01:07:03 +00:00
"is_operator": false,
2017-02-19 09:17:37 +00:00
"usr": "c:@F@foo#",
"short_name": "foo",
"detailed_name": "void foo()",
"hover": "void foo()",
2017-12-12 05:15:37 +00:00
"declarations": [],
2017-04-05 08:29:15 +00:00
"definition_spelling": "12:6-12:9",
"definition_extent": "12:1-15:2",
2017-12-19 06:15:46 +00:00
"base": [],
2017-12-12 05:15:37 +00:00
"derived": [],
"locals": [],
"callers": [],
"callees": ["0@14:3-14:9", "1@14:14-14:17"]
2017-02-19 09:17:37 +00:00
}],
2017-03-08 00:21:23 +00:00
"vars": [{
2017-02-19 09:17:37 +00:00
"id": 0,
"usr": "c:@S@Foo@static_var",
"short_name": "static_var",
"detailed_name": "int Foo::static_var",
"hover": "int",
2017-04-05 08:29:15 +00:00
"declaration": "6:14-6:24",
"definition_spelling": "10:10-10:20",
"definition_extent": "10:1-10:24",
2017-02-19 09:17:37 +00:00
"declaring_type": 0,
"is_local": false,
"is_macro": false,
2017-04-05 08:29:15 +00:00
"uses": ["6:14-6:24", "10:10-10:20", "14:45-14:55"]
2017-02-19 09:17:37 +00:00
}, {
"id": 1,
"usr": "c:@S@Foo@FI@field_var",
"short_name": "field_var",
"detailed_name": "int Foo::field_var",
"hover": "int",
2017-04-05 08:29:15 +00:00
"definition_spelling": "7:7-7:16",
"definition_extent": "7:3-7:16",
2017-02-19 09:17:37 +00:00
"declaring_type": 0,
"is_local": false,
"is_macro": false,
2017-04-05 08:29:15 +00:00
"uses": ["7:7-7:16", "14:28-14:37"]
2017-02-19 09:17:37 +00:00
}, {
"id": 2,
2017-02-20 06:24:05 +00:00
"usr": "c:usage_inside_of_call.cc@145@F@foo#@a",
2017-02-19 09:17:37 +00:00
"short_name": "a",
"detailed_name": "int a",
"hover": "int",
2017-04-05 08:29:15 +00:00
"definition_spelling": "13:7-13:8",
"definition_extent": "13:3-13:12",
"is_local": true,
"is_macro": false,
2017-04-05 08:29:15 +00:00
"uses": ["13:7-13:8", "14:10-14:11"]
2017-02-19 09:17:37 +00:00
}]
}
2017-03-08 00:21:23 +00:00
*/