ccls/tests/templates/template_var_usage_folded_into_one.cc

76 lines
1.4 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:
{
"types": [{
"id": 0,
"usr": "c:@E@A",
"short_name": "A",
"qualified_name": "A",
2017-04-05 08:06:18 +00:00
"definition": "1:6",
"uses": ["*1:6", "7:13"]
2017-03-05 22:49:23 +00:00
}, {
"id": 1,
"usr": "c:@E@B",
"short_name": "B",
"qualified_name": "B",
2017-04-05 08:06:18 +00:00
"definition": "2:6",
"uses": ["*2:6", "8:13"]
2017-04-03 01:34:15 +00:00
}, {
"id": 2,
"usr": "c:template_var_usage_folded_into_one.cc@35",
2017-04-05 08:06:18 +00:00
"uses": ["*5:1"]
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",
"qualified_name": "var",
2017-04-05 08:06:18 +00:00
"definition": "5:3",
"uses": ["5:3", "7:9", "8:9"]
2017-03-05 22:49:23 +00:00
}, {
"id": 1,
"usr": "c:@a",
"short_name": "a",
"qualified_name": "a",
2017-04-05 08:06:18 +00:00
"definition": "7:5",
"uses": ["7:5"]
2017-03-05 22:49:23 +00:00
}, {
"id": 2,
"usr": "c:@b",
"short_name": "b",
"qualified_name": "b",
2017-04-05 08:06:18 +00:00
"definition": "8:5",
"uses": ["8:5"]
2017-03-05 22:49:23 +00:00
}]
}
2017-03-07 18:17:49 +00:00
*/