ccls/tests/usage/usage_inside_of_call.cc

81 lines
1.7 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:
{
"types": [{
"id": 0,
"usr": "c:@S@Foo",
"short_name": "Foo",
"qualified_name": "Foo",
2017-04-05 08:06:18 +00:00
"definition": "5:8",
2017-02-20 06:06:46 +00:00
"vars": [1, 0],
2017-04-05 08:06:18 +00:00
"uses": ["*5:8", "10:5", "14:22", "14:40"]
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,
"usr": "c:@F@called#I#",
"short_name": "called",
"qualified_name": "called",
2017-04-05 08:06:18 +00:00
"declarations": ["1:6"],
"callers": ["2@14:3"],
"uses": ["1:6", "14:3"]
2017-02-19 09:17:37 +00:00
}, {
"id": 1,
"usr": "c:@F@gen#",
"short_name": "gen",
"qualified_name": "gen",
2017-04-05 08:06:18 +00:00
"declarations": ["3:5"],
"callers": ["2@14:14"],
"uses": ["3:5", "14:14"]
2017-02-19 09:17:37 +00:00
}, {
"id": 2,
"usr": "c:@F@foo#",
"short_name": "foo",
"qualified_name": "foo",
2017-04-05 08:06:18 +00:00
"definition": "12:6",
"callees": ["0@14:3", "1@14:14"],
"uses": ["12:6"]
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",
"qualified_name": "Foo::static_var",
2017-04-05 08:06:18 +00:00
"declaration": "6:14",
"definition": "10:10",
2017-02-19 09:17:37 +00:00
"declaring_type": 0,
2017-04-05 08:06:18 +00:00
"uses": ["6:14", "10:10", "14:45"]
2017-02-19 09:17:37 +00:00
}, {
"id": 1,
"usr": "c:@S@Foo@FI@field_var",
"short_name": "field_var",
"qualified_name": "Foo::field_var",
2017-04-05 08:06:18 +00:00
"definition": "7:7",
2017-02-19 09:17:37 +00:00
"declaring_type": 0,
2017-04-05 08:06:18 +00:00
"uses": ["7:7", "14:28"]
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",
"qualified_name": "a",
2017-04-05 08:06:18 +00:00
"definition": "13:7",
"uses": ["13:7", "14:10"]
2017-02-19 09:17:37 +00:00
}]
}
2017-03-08 00:21:23 +00:00
*/