ccls/tests/usage/var_usage_class_member.cc

122 lines
2.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-12-12 05:15:37 +00:00
"includes": [],
"skipped_by_preprocessor": [],
2017-02-19 05:47:16 +00:00
"types": [{
"id": 0,
"usr": "c:@S@Foo",
"short_name": "Foo",
"detailed_name": "Foo",
2017-04-05 08:29:15 +00:00
"definition_spelling": "1:7-1:10",
"definition_extent": "1:1-5:2",
2017-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [],
2017-02-19 05:47:16 +00:00
"vars": [0, 1],
"instances": [2],
2017-04-19 04:58:39 +00:00
"uses": ["1:7-1:10", "11:3-11:6"]
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,
2017-12-02 01:07:03 +00:00
"is_operator": false,
2017-02-19 05:47:16 +00:00
"usr": "c:@F@accept#I#",
"short_name": "accept",
"detailed_name": "void accept(int)",
"declarations": [{
"spelling": "7:6-7:12",
"extent": "7:1-7:17",
"content": "void accept(int)",
"param_spellings": ["7:16-7:16"]
}],
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", "2@15:3-15:9", "2@17:3-17:9"],
"callees": []
2017-02-19 05:47:16 +00:00
}, {
"id": 1,
2017-12-02 01:07:03 +00:00
"is_operator": false,
2017-02-19 05:47:16 +00:00
"usr": "c:@F@accept#*I#",
"short_name": "accept",
"detailed_name": "void accept(int *)",
"declarations": [{
"spelling": "8:6-8:12",
"extent": "8:1-8:18",
"content": "void accept(int*)",
"param_spellings": ["8:17-8:17"]
}],
2017-12-19 06:15:46 +00:00
"base": [],
2017-12-12 05:15:37 +00:00
"derived": [],
"locals": [],
"callers": ["2@16:3-16:9"],
"callees": []
2017-02-19 05:47:16 +00:00
}, {
"id": 2,
2017-12-02 01:07:03 +00:00
"is_operator": false,
2017-02-19 05:47:16 +00:00
"usr": "c:@F@foo#",
"short_name": "foo",
"detailed_name": "void foo()",
2017-12-12 05:15:37 +00:00
"declarations": [],
2017-04-05 08:29:15 +00:00
"definition_spelling": "10:6-10:9",
"definition_extent": "10:1-18: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", "0@15:3-15:9", "1@16:3-16:9", "0@17:3-17:9"]
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",
"detailed_name": "int Foo::x",
2017-04-05 08:29:15 +00:00
"definition_spelling": "3:7-3:8",
"definition_extent": "3:3-3:8",
2017-02-19 05:47:16 +00:00
"declaring_type": 0,
2017-12-24 00:49:11 +00:00
"cls": 4,
2017-04-05 08:29:15 +00:00
"uses": ["3:7-3:8", "12:5-12:6", "13:5-13:6", "14:12-14:13", "15:12-15:13", "16:13-16:14"]
2017-02-19 05:47:16 +00:00
}, {
"id": 1,
"usr": "c:@S@Foo@FI@y",
"short_name": "y",
"detailed_name": "int Foo::y",
2017-04-05 08:29:15 +00:00
"definition_spelling": "4:7-4:8",
"definition_extent": "4:3-4:8",
2017-02-19 05:47:16 +00:00
"declaring_type": 0,
2017-12-24 00:49:11 +00:00
"cls": 4,
2017-04-05 08:29:15 +00:00
"uses": ["4:7-4:8", "17:12-17:13"]
2017-02-19 05:47:16 +00:00
}, {
"id": 2,
"usr": "c:var_usage_class_member.cc@105@F@foo#@f",
"short_name": "f",
"detailed_name": "Foo f",
2017-04-05 08:29:15 +00:00
"definition_spelling": "11:7-11:8",
"definition_extent": "11:3-11:8",
2017-02-19 05:47:16 +00:00
"variable_type": 0,
2017-12-24 00:49:11 +00:00
"cls": 1,
2017-04-05 08:29:15 +00:00
"uses": ["11:7-11:8", "12:3-12:4", "13:3-13:4", "14:10-14:11", "15:10-15:11", "16:11-16:12", "17:10-17:11"]
2017-02-19 05:47:16 +00:00
}]
2017-02-18 21:18:08 +00:00
}
2017-03-08 00:21:23 +00:00
*/