ccls/tests/usage/var_usage_class_member.cc

85 lines
1.9 KiB
C++
Raw Normal View History

2017-02-19 05:47:16 +00:00
class Foo {
public:
int x;
int y;
};
void accept(int);
void accept(int*);
void foo() {
Foo f;
f.x = 3;
f.x += 5;
accept(f.x);
accept(f.x + 20);
accept(&f.x);
accept(f.y);
}
2017-02-18 21:18:08 +00:00
/*
OUTPUT:
{
2017-02-19 05:47:16 +00:00
"types": [{
"id": 0,
"usr": "c:@S@Foo",
"short_name": "Foo",
"qualified_name": "Foo",
2017-02-21 04:05:03 +00:00
"definition": "1:1:7",
2017-02-19 05:47:16 +00:00
"vars": [0, 1],
2017-04-03 01:34:15 +00:00
"instantiations": [2],
2017-02-21 05:55:48 +00:00
"uses": ["*1:1:7", "*1:11:3"]
2017-02-19 05:47:16 +00:00
}],
2017-03-08 00:21:23 +00:00
"funcs": [{
2017-02-19 05:47:16 +00:00
"id": 0,
"usr": "c:@F@accept#I#",
"short_name": "accept",
"qualified_name": "accept",
2017-02-25 06:08:14 +00:00
"declarations": ["1:7:6"],
2017-02-21 04:05:03 +00:00
"callers": ["2@1:14:3", "2@1:15:3", "2@1:17:3"],
2017-02-21 05:34:46 +00:00
"uses": ["1:7:6", "1:14:3", "1:15:3", "1:17:3"]
2017-02-19 05:47:16 +00:00
}, {
"id": 1,
"usr": "c:@F@accept#*I#",
"short_name": "accept",
"qualified_name": "accept",
2017-02-25 06:08:14 +00:00
"declarations": ["1:8:6"],
2017-02-21 04:05:03 +00:00
"callers": ["2@1:16:3"],
2017-02-21 05:34:46 +00:00
"uses": ["1:8:6", "1:16:3"]
2017-02-19 05:47:16 +00:00
}, {
"id": 2,
"usr": "c:@F@foo#",
"short_name": "foo",
"qualified_name": "foo",
2017-02-21 04:05:03 +00:00
"definition": "1:10:6",
"callees": ["0@1:14:3", "0@1:15:3", "1@1:16:3", "0@1:17:3"],
2017-02-21 05:34:46 +00:00
"uses": ["1:10:6"]
2017-02-19 05:47:16 +00:00
}],
2017-03-08 00:21:23 +00:00
"vars": [{
2017-02-19 05:47:16 +00:00
"id": 0,
"usr": "c:@S@Foo@FI@x",
"short_name": "x",
"qualified_name": "Foo::x",
2017-02-21 04:05:03 +00:00
"definition": "1:3:7",
2017-02-19 05:47:16 +00:00
"declaring_type": 0,
2017-02-21 05:34:46 +00:00
"uses": ["1:3:7", "1:12:5", "1:13:5", "1:14:12", "1:15:12", "1:16:13"]
2017-02-19 05:47:16 +00:00
}, {
"id": 1,
"usr": "c:@S@Foo@FI@y",
"short_name": "y",
"qualified_name": "Foo::y",
2017-02-21 04:05:03 +00:00
"definition": "1:4:7",
2017-02-19 05:47:16 +00:00
"declaring_type": 0,
2017-02-21 05:34:46 +00:00
"uses": ["1:4:7", "1:17:12"]
2017-02-19 05:47:16 +00:00
}, {
"id": 2,
"usr": "c:var_usage_class_member.cc@105@F@foo#@f",
"short_name": "f",
"qualified_name": "f",
2017-02-21 04:05:03 +00:00
"definition": "1:11:7",
2017-02-19 05:47:16 +00:00
"variable_type": 0,
2017-02-21 05:34:46 +00:00
"uses": ["1:11:7", "1:12:3", "1:13:3", "1:14:10", "1:15:10", "1:16:11", "1:17:10"]
2017-02-19 05:47:16 +00:00
}]
2017-02-18 21:18:08 +00:00
}
2017-03-08 00:21:23 +00:00
*/