ccls/index_tests/lambdas/lambda.cc

119 lines
2.9 KiB
C++
Raw Normal View History

2018-03-31 03:16:33 +00:00
void foo() {
int x;
auto dosomething = [&x](int y) {
++x;
++y;
};
dosomething(1);
dosomething(1);
dosomething(1);
}
/*
OUTPUT:
{
"includes": [],
2018-07-07 23:56:47 +00:00
"skipped_ranges": [],
"usr2func": [{
"usr": 4259594751088586730,
"detailed_name": "void foo()",
"qual_name_offset": 5,
"short_name": "foo",
"kind": 12,
"storage": 0,
"declarations": [],
"spell": "1:6-1:9|0|1|2",
"extent": "1:1-12:2|0|1|0",
"declaring_type": 0,
"bases": [],
"derived": [],
2018-07-07 23:56:47 +00:00
"vars": [],
"uses": [],
2018-07-07 23:56:47 +00:00
"callees": []
}, {
"usr": 17926497908620168464,
2018-07-07 23:56:47 +00:00
"detailed_name": "inline void foo()::(anon class)::operator()(int y) const",
"qual_name_offset": 12,
"short_name": "operator()",
"kind": 6,
"storage": 0,
2018-03-31 03:16:33 +00:00
"declarations": [],
"declaring_type": 0,
2018-03-31 03:16:33 +00:00
"bases": [],
"derived": [],
"vars": [],
2018-07-07 23:56:47 +00:00
"uses": ["9:14-9:15|14635009347499519042|2|8228", "10:14-10:15|14635009347499519042|2|8228", "11:14-11:15|14635009347499519042|2|8228"],
"callees": []
}],
"usr2type": [{
2018-07-07 23:56:47 +00:00
"usr": 53,
2018-03-31 03:16:33 +00:00
"detailed_name": "",
"qual_name_offset": 0,
2018-03-31 03:16:33 +00:00
"short_name": "",
"kind": 0,
"declarations": [],
"alias_of": 0,
2018-03-31 03:16:33 +00:00
"bases": [],
"derived": [],
"types": [],
"funcs": [],
"vars": [],
2018-07-07 23:56:47 +00:00
"instances": [12666114896600231317],
2018-03-31 03:16:33 +00:00
"uses": []
}, {
"usr": 14635009347499519042,
2018-03-31 03:16:33 +00:00
"detailed_name": "",
"qual_name_offset": 0,
2018-03-31 03:16:33 +00:00
"short_name": "",
"kind": 0,
"declarations": [],
"alias_of": 0,
2018-03-31 03:16:33 +00:00
"bases": [],
"derived": [],
"types": [],
"funcs": [],
2018-03-31 03:16:33 +00:00
"vars": [],
2018-07-07 23:56:47 +00:00
"instances": [],
"uses": []
2018-03-31 03:16:33 +00:00
}],
"usr2var": [{
"usr": 2981279427664991319,
2018-07-07 23:56:47 +00:00
"detailed_name": "auto dosomething",
"qual_name_offset": 5,
"short_name": "dosomething",
2018-07-07 23:56:47 +00:00
"hover": "auto dosomething = [&x] (int y) {\n ++x;\n ++y;\n }\n",
2018-03-31 03:16:33 +00:00
"declarations": [],
"spell": "4:8-4:19|4259594751088586730|3|2",
"extent": "4:3-7:4|4259594751088586730|3|0",
2018-07-07 23:56:47 +00:00
"type": 0,
"uses": ["9:3-9:14|4259594751088586730|3|4", "10:3-10:14|4259594751088586730|3|4", "11:3-11:14|4259594751088586730|3|4"],
2018-03-31 03:16:33 +00:00
"kind": 13,
"storage": 0
2018-03-31 03:16:33 +00:00
}, {
"usr": 12666114896600231317,
"detailed_name": "int x",
"qual_name_offset": 4,
"short_name": "x",
2018-03-31 03:16:33 +00:00
"declarations": [],
"spell": "2:7-2:8|4259594751088586730|3|2",
"extent": "2:3-2:8|4259594751088586730|3|0",
2018-07-07 23:56:47 +00:00
"type": 53,
"uses": ["4:24-4:25|4259594751088586730|3|4", "5:7-5:8|4259594751088586730|3|28"],
2018-03-31 03:16:33 +00:00
"kind": 13,
"storage": 0
2018-03-31 03:16:33 +00:00
}, {
"usr": 12879188959314906706,
2018-03-31 03:16:33 +00:00
"detailed_name": "int y",
"qual_name_offset": 4,
2018-07-07 23:56:47 +00:00
"short_name": "y",
2018-03-31 03:16:33 +00:00
"declarations": [],
2018-07-07 23:56:47 +00:00
"type": 0,
"uses": ["6:7-6:8|17926497908620168464|3|28"],
2018-03-31 03:16:33 +00:00
"kind": 253,
"storage": 0
2018-03-31 03:16:33 +00:00
}]
}
*/