ccls/tests/templates/template_var_usage_folded_into_one.cc

85 lines
1.8 KiB
C++
Raw Normal View History

2017-03-05 22:49:23 +00:00
enum A {};
enum B {};
template<typename T>
T var = 3;
int a = var<A>;
int b = var<B>;
2017-03-14 04:31:53 +00:00
// NOTE: libclang before 4.0 doesn't expose template usage on |var|.
2017-03-05 22:49:23 +00:00
#if false
EnumDecl A
EnumDecl B
UnexposedDecl var
VarDecl a
UnexposedExpr var
UnexposedExpr var
DeclRefExpr var
TypeRef enum A
UnexposedDecl var
VarDecl b
UnexposedExpr var
UnexposedExpr var
DeclRefExpr var
TypeRef enum B
UnexposedDecl var
#endif
/*
OUTPUT:
{
"skipped_by_preprocessor": ["12:1-28:7"],
2017-03-05 22:49:23 +00:00
"types": [{
"id": 0,
"usr": "c:@E@A",
"short_name": "A",
"detailed_name": "A",
2017-04-05 08:29:15 +00:00
"definition_spelling": "1:6-1:7",
"definition_extent": "1:1-1:10",
2017-04-19 04:58:39 +00:00
"uses": ["1:6-1:7", "7:13-7:14"]
2017-03-05 22:49:23 +00:00
}, {
"id": 1,
"usr": "c:@E@B",
"short_name": "B",
"detailed_name": "B",
2017-04-05 08:29:15 +00:00
"definition_spelling": "2:6-2:7",
"definition_extent": "2:1-2:10",
2017-04-19 04:58:39 +00:00
"uses": ["2:6-2:7", "8:13-8:14"]
2017-04-03 01:34:15 +00:00
}, {
"id": 2,
"usr": "c:template_var_usage_folded_into_one.cc@35",
2017-04-19 04:58:39 +00:00
"uses": ["5:1-5:2"]
2017-03-05 22:49:23 +00:00
}],
2017-03-07 18:17:49 +00:00
"vars": [{
2017-03-05 22:49:23 +00:00
"id": 0,
2017-03-14 04:31:53 +00:00
"usr": "c:@VT>1#T@var",
2017-03-05 22:49:23 +00:00
"short_name": "var",
"detailed_name": "T var",
2017-04-05 08:29:15 +00:00
"definition_spelling": "5:3-5:6",
"definition_extent": "5:1-5:10",
"is_local": false,
2017-04-05 08:29:15 +00:00
"uses": ["5:3-5:6", "7:9-7:12", "8:9-8:12"]
2017-03-05 22:49:23 +00:00
}, {
"id": 1,
"usr": "c:@a",
"short_name": "a",
"detailed_name": "int a",
2017-04-05 08:29:15 +00:00
"definition_spelling": "7:5-7:6",
"definition_extent": "7:1-7:15",
"is_local": false,
2017-04-05 08:29:15 +00:00
"uses": ["7:5-7:6"]
2017-03-05 22:49:23 +00:00
}, {
"id": 2,
"usr": "c:@b",
"short_name": "b",
"detailed_name": "int b",
2017-04-05 08:29:15 +00:00
"definition_spelling": "8:5-8:6",
"definition_extent": "8:1-8:15",
"is_local": false,
2017-04-05 08:29:15 +00:00
"uses": ["8:5-8:6"]
2017-03-05 22:49:23 +00:00
}]
}
2017-03-07 18:17:49 +00:00
*/