ccls/tests/templates/template_var_usage_folded_into_one.cc

115 lines
2.4 KiB
C++
Raw Normal View History

2017-03-05 22:49:23 +00:00
enum A {};
enum B {};
template<typename T>
2017-12-20 17:43:26 +00:00
T var = T();
2017-03-05 22:49:23 +00:00
2017-12-20 17:43:26 +00:00
A a = var<A>;
B b = var<B>;
2017-03-05 22:49:23 +00:00
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
/*
2017-12-20 17:43:26 +00:00
EXTRA_FLAGS:
-std=c++14
2017-03-05 22:49:23 +00:00
OUTPUT:
{
2017-12-12 05:15:37 +00:00
"includes": [],
"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-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [],
"vars": [],
2017-12-20 17:43:26 +00:00
"instances": [1],
"uses": ["1:6-1:7", "7:1-7:2", "7:11-7:12"]
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-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [],
"vars": [],
2017-12-20 17:43:26 +00:00
"instances": [2],
"uses": ["2:6-2:7", "8:1-8:2", "8:11-8:12"]
2017-04-03 01:34:15 +00:00
}, {
"id": 2,
"usr": "c:template_var_usage_folded_into_one.cc@35",
2017-12-12 05:06:27 +00:00
"short_name": "",
"detailed_name": "",
2017-12-12 05:15:37 +00:00
"parents": [],
"derived": [],
"types": [],
"funcs": [],
"vars": [],
"instances": [],
2017-12-20 17:43:26 +00:00
"uses": ["5:1-5:2", "5:9-5:10"]
2017-03-05 22:49:23 +00:00
}],
2017-12-12 05:15:37 +00:00
"funcs": [],
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",
2017-12-20 17:43:26 +00:00
"definition_extent": "5:1-5:12",
"is_local": false,
"is_macro": false,
2017-12-20 17:43:26 +00:00
"uses": ["5:3-5:6", "7:7-7:10", "8:7-8:10"]
2017-03-05 22:49:23 +00:00
}, {
"id": 1,
"usr": "c:@a",
"short_name": "a",
2017-12-20 17:43:26 +00:00
"detailed_name": "A a",
"definition_spelling": "7:3-7:4",
"definition_extent": "7:1-7:13",
"variable_type": 0,
"is_local": false,
"is_macro": false,
2017-12-20 17:43:26 +00:00
"uses": ["7:3-7:4"]
2017-03-05 22:49:23 +00:00
}, {
"id": 2,
"usr": "c:@b",
"short_name": "b",
2017-12-20 17:43:26 +00:00
"detailed_name": "B b",
"definition_spelling": "8:3-8:4",
"definition_extent": "8:1-8:13",
"variable_type": 1,
"is_local": false,
"is_macro": false,
2017-12-20 17:43:26 +00:00
"uses": ["8:3-8:4"]
2017-03-05 22:49:23 +00:00
}]
}
2017-03-07 18:17:49 +00:00
*/