mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 00:55:08 +00:00
Misc changes to clangIndex
This commit is contained in:
parent
96e0f0fafa
commit
8e4d62212b
@ -17,7 +17,7 @@ OUTPUT:
|
|||||||
"kind": 5,
|
"kind": 5,
|
||||||
"declarations": ["1:7-1:10|0|1|1", "2:7-2:10|0|1|1", "4:7-4:10|0|1|1"],
|
"declarations": ["1:7-1:10|0|1|1", "2:7-2:10|0|1|1", "4:7-4:10|0|1|1"],
|
||||||
"spell": "3:7-3:10|0|1|2",
|
"spell": "3:7-3:10|0|1|2",
|
||||||
"extent": "1:1-1:10|0|1|0",
|
"extent": "3:1-3:13|0|1|0",
|
||||||
"alias_of": 0,
|
"alias_of": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -20,7 +20,7 @@ OUTPUT:
|
|||||||
"kind": 9,
|
"kind": 9,
|
||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": [],
|
"declarations": [],
|
||||||
"spell": "4:6-4:9|0|1|514",
|
"spell": "4:6-4:9|15041163540773201510|2|514",
|
||||||
"extent": "4:1-4:11|0|1|0",
|
"extent": "4:1-4:11|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
|
@ -132,7 +132,10 @@ OUTPUT: make_functions.h
|
|||||||
}
|
}
|
||||||
OUTPUT: make_functions.cc
|
OUTPUT: make_functions.cc
|
||||||
{
|
{
|
||||||
"includes": [],
|
"includes": [{
|
||||||
|
"line": 0,
|
||||||
|
"resolved_path": "&make_functions.h"
|
||||||
|
}],
|
||||||
"skipped_ranges": [],
|
"skipped_ranges": [],
|
||||||
"usr2func": [{
|
"usr2func": [{
|
||||||
"usr": 2532818908869373467,
|
"usr": 2532818908869373467,
|
||||||
|
@ -19,7 +19,7 @@ OUTPUT:
|
|||||||
"kind": 5,
|
"kind": 5,
|
||||||
"declarations": ["1:7-1:10|0|1|1", "2:7-2:10|0|1|1", "4:7-4:10|0|1|1"],
|
"declarations": ["1:7-1:10|0|1|1", "2:7-2:10|0|1|1", "4:7-4:10|0|1|1"],
|
||||||
"spell": "3:7-3:10|0|1|2",
|
"spell": "3:7-3:10|0|1|2",
|
||||||
"extent": "1:1-1:10|0|1|0",
|
"extent": "3:1-3:13|0|1|0",
|
||||||
"alias_of": 0,
|
"alias_of": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -64,7 +64,7 @@ OUTPUT:
|
|||||||
"short_name": "foo",
|
"short_name": "foo",
|
||||||
"declarations": ["2:14-2:17|15041163540773201510|2|513"],
|
"declarations": ["2:14-2:17|15041163540773201510|2|513"],
|
||||||
"spell": "5:10-5:13|15041163540773201510|2|514",
|
"spell": "5:10-5:13|15041163540773201510|2|514",
|
||||||
"extent": "2:3-2:17|15041163540773201510|2|0",
|
"extent": "5:1-5:13|0|1|0",
|
||||||
"type": 53,
|
"type": 53,
|
||||||
"uses": [],
|
"uses": [],
|
||||||
"kind": 13,
|
"kind": 13,
|
||||||
|
@ -18,7 +18,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["1:6-1:9|0|1|1", "2:6-2:9|0|1|1", "4:6-4:9|0|1|1"],
|
"declarations": ["1:6-1:9|0|1|1", "2:6-2:9|0|1|1", "4:6-4:9|0|1|1"],
|
||||||
"spell": "3:6-3:9|0|1|2",
|
"spell": "3:6-3:9|0|1|2",
|
||||||
"extent": "1:1-1:11|0|1|0",
|
"extent": "3:1-3:14|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -18,7 +18,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["1:5-1:8|0|1|1", "2:5-2:8|0|1|1", "4:5-4:8|0|1|1"],
|
"declarations": ["1:5-1:8|0|1|1", "2:5-2:8|0|1|1", "4:5-4:8|0|1|1"],
|
||||||
"spell": "5:5-5:8|0|1|2",
|
"spell": "5:5-5:8|0|1|2",
|
||||||
"extent": "1:1-1:18|0|1|0",
|
"extent": "5:1-5:36|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -48,7 +48,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["4:8-4:11|15041163540773201510|2|513"],
|
"declarations": ["4:8-4:11|15041163540773201510|2|513"],
|
||||||
"spell": "7:11-7:14|15041163540773201510|2|514",
|
"spell": "7:11-7:14|15041163540773201510|2|514",
|
||||||
"extent": "4:3-4:13|15041163540773201510|2|0",
|
"extent": "7:1-7:19|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -77,7 +77,6 @@ OUTPUT:
|
|||||||
"detailed_name": "Foo::B = 20",
|
"detailed_name": "Foo::B = 20",
|
||||||
"qual_name_offset": 0,
|
"qual_name_offset": 0,
|
||||||
"short_name": "B",
|
"short_name": "B",
|
||||||
"hover": "Foo::B = 20 = 20",
|
|
||||||
"declarations": [],
|
"declarations": [],
|
||||||
"spell": "4:3-4:4|16985894625255407295|2|514",
|
"spell": "4:3-4:4|16985894625255407295|2|514",
|
||||||
"extent": "4:3-4:9|16985894625255407295|2|0",
|
"extent": "4:3-4:9|16985894625255407295|2|0",
|
||||||
|
@ -59,7 +59,6 @@ OUTPUT:
|
|||||||
"detailed_name": "B = 20",
|
"detailed_name": "B = 20",
|
||||||
"qual_name_offset": 0,
|
"qual_name_offset": 0,
|
||||||
"short_name": "B",
|
"short_name": "B",
|
||||||
"hover": "B = 20 = 20",
|
|
||||||
"declarations": [],
|
"declarations": [],
|
||||||
"spell": "3:3-3:4|16985894625255407295|2|514",
|
"spell": "3:3-3:4|16985894625255407295|2|514",
|
||||||
"extent": "3:3-3:9|16985894625255407295|2|0",
|
"extent": "3:3-3:9|16985894625255407295|2|0",
|
||||||
|
@ -114,7 +114,6 @@ OUTPUT:
|
|||||||
"detailed_name": "B = 20",
|
"detailed_name": "B = 20",
|
||||||
"qual_name_offset": 0,
|
"qual_name_offset": 0,
|
||||||
"short_name": "B",
|
"short_name": "B",
|
||||||
"hover": "B = 20 = 20",
|
|
||||||
"declarations": [],
|
"declarations": [],
|
||||||
"spell": "3:3-3:4|16985894625255407295|2|514",
|
"spell": "3:3-3:4|16985894625255407295|2|514",
|
||||||
"extent": "3:3-3:9|16985894625255407295|2|0",
|
"extent": "3:3-3:9|16985894625255407295|2|0",
|
||||||
@ -140,7 +139,6 @@ OUTPUT:
|
|||||||
"detailed_name": "E::E20 = 20",
|
"detailed_name": "E::E20 = 20",
|
||||||
"qual_name_offset": 0,
|
"qual_name_offset": 0,
|
||||||
"short_name": "E20",
|
"short_name": "E20",
|
||||||
"hover": "E::E20 = 20 = 20",
|
|
||||||
"declarations": [],
|
"declarations": [],
|
||||||
"spell": "10:3-10:6|2986879766914123941|2|514",
|
"spell": "10:3-10:6|2986879766914123941|2|514",
|
||||||
"extent": "10:3-10:11|2986879766914123941|2|0",
|
"extent": "10:3-10:11|2986879766914123941|2|0",
|
||||||
|
@ -74,7 +74,6 @@ OUTPUT:
|
|||||||
"detailed_name": "Foo::B = 20",
|
"detailed_name": "Foo::B = 20",
|
||||||
"qual_name_offset": 0,
|
"qual_name_offset": 0,
|
||||||
"short_name": "B",
|
"short_name": "B",
|
||||||
"hover": "Foo::B = 20 = 20",
|
|
||||||
"declarations": [],
|
"declarations": [],
|
||||||
"spell": "3:3-3:4|16985894625255407295|2|514",
|
"spell": "3:3-3:4|16985894625255407295|2|514",
|
||||||
"extent": "3:3-3:9|16985894625255407295|2|0",
|
"extent": "3:3-3:9|16985894625255407295|2|0",
|
||||||
|
@ -16,7 +16,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["1:6-1:9|0|1|1"],
|
"declarations": ["1:6-1:9|0|1|1"],
|
||||||
"spell": "3:6-3:9|0|1|2",
|
"spell": "3:6-3:9|0|1|2",
|
||||||
"extent": "1:1-1:11|0|1|0",
|
"extent": "3:1-3:14|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -18,7 +18,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["2:8-2:11|15041163540773201510|2|513"],
|
"declarations": ["2:8-2:11|15041163540773201510|2|513"],
|
||||||
"spell": "5:11-5:14|15041163540773201510|2|514",
|
"spell": "5:11-5:14|15041163540773201510|2|514",
|
||||||
"extent": "2:3-2:19|15041163540773201510|2|0",
|
"extent": "5:1-5:25|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -87,7 +87,10 @@ OUTPUT: funky_enum.h
|
|||||||
}
|
}
|
||||||
OUTPUT: funky_enum.cc
|
OUTPUT: funky_enum.cc
|
||||||
{
|
{
|
||||||
"includes": [],
|
"includes": [{
|
||||||
|
"line": 1,
|
||||||
|
"resolved_path": "&funky_enum.h"
|
||||||
|
}],
|
||||||
"skipped_ranges": [],
|
"skipped_ranges": [],
|
||||||
"usr2func": [],
|
"usr2func": [],
|
||||||
"usr2type": [{
|
"usr2type": [{
|
||||||
|
@ -208,7 +208,10 @@ OUTPUT: header.h
|
|||||||
}
|
}
|
||||||
OUTPUT: impl.cc
|
OUTPUT: impl.cc
|
||||||
{
|
{
|
||||||
"includes": [],
|
"includes": [{
|
||||||
|
"line": 0,
|
||||||
|
"resolved_path": "&header.h"
|
||||||
|
}],
|
||||||
"skipped_ranges": [],
|
"skipped_ranges": [],
|
||||||
"usr2func": [{
|
"usr2func": [{
|
||||||
"usr": 5817708529036841195,
|
"usr": 5817708529036841195,
|
||||||
|
@ -29,7 +29,10 @@ OUTPUT: simple_header.h
|
|||||||
}
|
}
|
||||||
OUTPUT: simple_impl.cc
|
OUTPUT: simple_impl.cc
|
||||||
{
|
{
|
||||||
"includes": [],
|
"includes": [{
|
||||||
|
"line": 0,
|
||||||
|
"resolved_path": "&simple_header.h"
|
||||||
|
}],
|
||||||
"skipped_ranges": [],
|
"skipped_ranges": [],
|
||||||
"usr2func": [{
|
"usr2func": [{
|
||||||
"usr": 3373269392705484958,
|
"usr": 3373269392705484958,
|
||||||
|
@ -44,7 +44,10 @@ OUTPUT: static.h
|
|||||||
}
|
}
|
||||||
OUTPUT: static.cc
|
OUTPUT: static.cc
|
||||||
{
|
{
|
||||||
"includes": [],
|
"includes": [{
|
||||||
|
"line": 0,
|
||||||
|
"resolved_path": "&static.h"
|
||||||
|
}],
|
||||||
"skipped_ranges": [],
|
"skipped_ranges": [],
|
||||||
"usr2func": [{
|
"usr2func": [{
|
||||||
"usr": 14576076421851654759,
|
"usr": 14576076421851654759,
|
||||||
@ -55,7 +58,7 @@ OUTPUT: static.cc
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": [],
|
"declarations": [],
|
||||||
"spell": "3:14-3:32|9411323049603567600|2|514",
|
"spell": "3:14-3:32|9411323049603567600|2|514",
|
||||||
"extent": "4:3-4:35|9411323049603567600|2|0",
|
"extent": "3:1-3:37|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -20,7 +20,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["3:8-3:11|4508214972876735896|2|513"],
|
"declarations": ["3:8-3:11|4508214972876735896|2|513"],
|
||||||
"spell": "6:11-6:14|4508214972876735896|2|514",
|
"spell": "6:11-6:14|4508214972876735896|2|514",
|
||||||
"extent": "3:3-3:13|4508214972876735896|2|0",
|
"extent": "6:1-6:19|2029211996748007610|2|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -78,7 +78,10 @@ OUTPUT: static_function_in_type.h
|
|||||||
}
|
}
|
||||||
OUTPUT: static_function_in_type.cc
|
OUTPUT: static_function_in_type.cc
|
||||||
{
|
{
|
||||||
"includes": [],
|
"includes": [{
|
||||||
|
"line": 0,
|
||||||
|
"resolved_path": "&static_function_in_type.h"
|
||||||
|
}],
|
||||||
"skipped_ranges": [],
|
"skipped_ranges": [],
|
||||||
"usr2func": [{
|
"usr2func": [{
|
||||||
"usr": 17019747379608639279,
|
"usr": 17019747379608639279,
|
||||||
@ -89,7 +92,7 @@ OUTPUT: static_function_in_type.cc
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": [],
|
"declarations": [],
|
||||||
"spell": "5:11-5:19|17262466801709381811|2|514",
|
"spell": "5:11-5:19|17262466801709381811|2|514",
|
||||||
"extent": "6:3-6:33|17262466801709381811|2|0",
|
"extent": "5:1-6:2|11072669167287398027|2|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -21,7 +21,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["5:8-5:11|15041163540773201510|2|513"],
|
"declarations": ["5:8-5:11|15041163540773201510|2|513"],
|
||||||
"spell": "8:11-8:14|15041163540773201510|2|514",
|
"spell": "8:11-8:14|15041163540773201510|2|514",
|
||||||
"extent": "5:3-5:30|15041163540773201510|2|0",
|
"extent": "8:1-8:36|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -121,9 +121,9 @@ OUTPUT:
|
|||||||
"hover": "static constexpr ns::VarType ns::Holder::static_var = (ns::VarType)0",
|
"hover": "static constexpr ns::VarType ns::Holder::static_var = (ns::VarType)0",
|
||||||
"declarations": ["6:30-6:40|12688716854043726585|2|513"],
|
"declarations": ["6:30-6:40|12688716854043726585|2|513"],
|
||||||
"spell": "10:37-10:47|12688716854043726585|2|514",
|
"spell": "10:37-10:47|12688716854043726585|2|514",
|
||||||
"extent": "6:5-6:55|12688716854043726585|2|0",
|
"extent": "9:3-10:47|11072669167287398027|2|0",
|
||||||
"type": 1532099849728741556,
|
"type": 1532099849728741556,
|
||||||
"uses": ["13:26-13:36|12688716854043726585|2|12", "14:27-14:37|12688716854043726585|2|12"],
|
"uses": ["13:26-13:36|11072669167287398027|2|12", "14:27-14:37|11072669167287398027|2|12"],
|
||||||
"kind": 13,
|
"kind": 13,
|
||||||
"storage": 2
|
"storage": 2
|
||||||
}, {
|
}, {
|
||||||
|
@ -31,7 +31,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": [],
|
"declarations": [],
|
||||||
"spell": "10:22-10:25|17649312483543982122|2|514",
|
"spell": "10:22-10:25|17649312483543982122|2|514",
|
||||||
"extent": "3:3-3:13|17649312483543982122|2|0",
|
"extent": "9:1-10:30|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
@ -47,7 +47,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["3:8-3:11|17107291254533526269|2|513"],
|
"declarations": ["3:8-3:11|17107291254533526269|2|513"],
|
||||||
"spell": "7:19-7:22|17107291254533526269|2|514",
|
"spell": "7:19-7:22|17107291254533526269|2|514",
|
||||||
"extent": "3:3-3:13|17107291254533526269|2|0",
|
"extent": "6:1-7:24|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -38,7 +38,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["4:3-4:6|15041163540773201510|2|513"],
|
"declarations": ["4:3-4:6|15041163540773201510|2|513"],
|
||||||
"spell": "7:6-7:9|15041163540773201510|2|514",
|
"spell": "7:6-7:9|15041163540773201510|2|514",
|
||||||
"extent": "4:3-4:8|15041163540773201510|2|0",
|
"extent": "7:1-9:2|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -124,7 +124,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["65:23-65:26|15041163540773201510|2|513"],
|
"declarations": ["65:23-65:26|15041163540773201510|2|513"],
|
||||||
"spell": "79:26-79:29|15041163540773201510|2|514",
|
"spell": "79:26-79:29|15041163540773201510|2|514",
|
||||||
"extent": "65:3-65:28|15041163540773201510|2|0",
|
"extent": "79:1-79:51|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -22,7 +22,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["3:6-3:9|0|1|1"],
|
"declarations": ["3:6-3:9|0|1|1"],
|
||||||
"spell": "4:6-4:9|0|1|2",
|
"spell": "4:6-4:9|0|1|2",
|
||||||
"extent": "3:1-3:23|0|1|0",
|
"extent": "4:1-4:26|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -31,7 +31,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["9:8-9:13|15041163540773201510|2|513"],
|
"declarations": ["9:8-9:13|15041163540773201510|2|513"],
|
||||||
"spell": "13:11-13:16|15041163540773201510|2|514",
|
"spell": "13:11-13:16|15041163540773201510|2|514",
|
||||||
"extent": "9:3-9:15|15041163540773201510|2|0",
|
"extent": "13:1-13:21|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
@ -47,7 +47,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["3:7-3:10|0|1|1", "4:7-4:10|0|1|1"],
|
"declarations": ["3:7-3:10|0|1|1", "4:7-4:10|0|1|1"],
|
||||||
"spell": "5:7-5:10|0|1|2",
|
"spell": "5:7-5:10|0|1|2",
|
||||||
"extent": "3:1-3:12|0|1|0",
|
"extent": "5:1-5:32|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
@ -77,7 +77,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["8:9-8:12|15041163540773201510|2|513"],
|
"declarations": ["8:9-8:12|15041163540773201510|2|513"],
|
||||||
"spell": "12:12-12:15|15041163540773201510|2|514",
|
"spell": "12:12-12:15|15041163540773201510|2|514",
|
||||||
"extent": "8:3-8:17|15041163540773201510|2|0",
|
"extent": "12:1-12:40|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
@ -93,7 +93,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["17:14-17:17|0|1|1"],
|
"declarations": ["17:14-17:17|0|1|1"],
|
||||||
"spell": "18:14-18:17|0|1|2",
|
"spell": "18:14-18:17|0|1|2",
|
||||||
"extent": "17:1-17:19|0|1|0",
|
"extent": "18:1-18:39|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -23,7 +23,7 @@ OUTPUT:
|
|||||||
"storage": 0,
|
"storage": 0,
|
||||||
"declarations": ["2:8-2:12|15041163540773201510|2|513"],
|
"declarations": ["2:8-2:12|15041163540773201510|2|513"],
|
||||||
"spell": "5:11-5:15|15041163540773201510|2|514",
|
"spell": "5:11-5:15|15041163540773201510|2|514",
|
||||||
"extent": "2:3-2:14|15041163540773201510|2|0",
|
"extent": "5:1-8:2|0|1|0",
|
||||||
"declaring_type": 0,
|
"declaring_type": 0,
|
||||||
"bases": [],
|
"bases": [],
|
||||||
"derived": [],
|
"derived": [],
|
||||||
|
@ -147,9 +147,9 @@ OUTPUT:
|
|||||||
"hover": "int Foo::static_var = 0",
|
"hover": "int Foo::static_var = 0",
|
||||||
"declarations": ["6:14-6:24|15041163540773201510|2|513"],
|
"declarations": ["6:14-6:24|15041163540773201510|2|513"],
|
||||||
"spell": "10:10-10:20|15041163540773201510|2|514",
|
"spell": "10:10-10:20|15041163540773201510|2|514",
|
||||||
"extent": "6:3-6:24|15041163540773201510|2|0",
|
"extent": "10:1-10:24|0|1|0",
|
||||||
"type": 53,
|
"type": 53,
|
||||||
"uses": ["14:45-14:55|15041163540773201510|2|12"],
|
"uses": ["14:45-14:55|0|1|12"],
|
||||||
"kind": 13,
|
"kind": 13,
|
||||||
"storage": 2
|
"storage": 2
|
||||||
}]
|
}]
|
||||||
|
@ -70,7 +70,7 @@ OUTPUT:
|
|||||||
"hover": "static constexpr VarType Holder::static_var = (VarType)0",
|
"hover": "static constexpr VarType Holder::static_var = (VarType)0",
|
||||||
"declarations": ["4:28-4:38|10028537921178202800|2|513"],
|
"declarations": ["4:28-4:38|10028537921178202800|2|513"],
|
||||||
"spell": "7:23-7:33|10028537921178202800|2|514",
|
"spell": "7:23-7:33|10028537921178202800|2|514",
|
||||||
"extent": "4:3-4:53|10028537921178202800|2|0",
|
"extent": "7:1-7:33|0|1|0",
|
||||||
"type": 5792006888140599735,
|
"type": 5792006888140599735,
|
||||||
"uses": [],
|
"uses": [],
|
||||||
"kind": 13,
|
"kind": 13,
|
||||||
|
@ -49,7 +49,7 @@ OUTPUT:
|
|||||||
"hover": "Foo *Foo::member = nullptr",
|
"hover": "Foo *Foo::member = nullptr",
|
||||||
"declarations": ["2:15-2:21|15041163540773201510|2|513"],
|
"declarations": ["2:15-2:21|15041163540773201510|2|513"],
|
||||||
"spell": "4:11-4:17|15041163540773201510|2|514",
|
"spell": "4:11-4:17|15041163540773201510|2|514",
|
||||||
"extent": "2:3-2:21|15041163540773201510|2|0",
|
"extent": "4:1-4:27|0|1|0",
|
||||||
"type": 15041163540773201510,
|
"type": 15041163540773201510,
|
||||||
"uses": [],
|
"uses": [],
|
||||||
"kind": 13,
|
"kind": 13,
|
||||||
|
@ -80,7 +80,7 @@ bool VFS::Stamp(const std::string& file, int64_t ts) {
|
|||||||
|
|
||||||
void VFS::ResetLocked(const std::string& file) {
|
void VFS::ResetLocked(const std::string& file) {
|
||||||
State& st = state[file];
|
State& st = state[file];
|
||||||
if (st.owner == g_thread_id)
|
if (st.owner == 0 || st.owner == g_thread_id)
|
||||||
st.stage = 0;
|
st.stage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,9 +7,8 @@
|
|||||||
#include <clang-c/Index.h>
|
#include <clang-c/Index.h>
|
||||||
#include <clang/Basic/FileManager.h>
|
#include <clang/Basic/FileManager.h>
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include <map>
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
struct IndexFile;
|
struct IndexFile;
|
||||||
@ -43,6 +42,17 @@ struct VFS {
|
|||||||
void Reset(const std::string& file);
|
void Reset(const std::string& file);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
template <>
|
||||||
|
struct hash<llvm::sys::fs::UniqueID> {
|
||||||
|
std::size_t operator()(llvm::sys::fs::UniqueID ID) const {
|
||||||
|
size_t ret = ID.getDevice();
|
||||||
|
hash_combine(ret, ID.getFile());
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// FileConsumer is used by the indexer. When it encouters a file, it tries to
|
// FileConsumer is used by the indexer. When it encouters a file, it tries to
|
||||||
// take ownership over it. If the indexer has ownership over a file, it will
|
// take ownership over it. If the indexer has ownership over a file, it will
|
||||||
// produce an index, otherwise, it will emit nothing for that declarations
|
// produce an index, otherwise, it will emit nothing for that declarations
|
||||||
@ -66,7 +76,7 @@ struct FileConsumer {
|
|||||||
std::vector<std::unique_ptr<IndexFile>> TakeLocalState();
|
std::vector<std::unique_ptr<IndexFile>> TakeLocalState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<llvm::sys::fs::UniqueID, std::unique_ptr<IndexFile>> local_;
|
std::unordered_map<llvm::sys::fs::UniqueID, std::unique_ptr<IndexFile>> local_;
|
||||||
VFS* vfs_;
|
VFS* vfs_;
|
||||||
std::string parse_file_;
|
std::string parse_file_;
|
||||||
int thread_id_;
|
int thread_id_;
|
||||||
|
128
src/indexer.cc
128
src/indexer.cc
@ -14,8 +14,8 @@ using ccls::Intern;
|
|||||||
#include <clang/Index/USRGeneration.h>
|
#include <clang/Index/USRGeneration.h>
|
||||||
#include <clang/Lex/PreprocessorOptions.h>
|
#include <clang/Lex/PreprocessorOptions.h>
|
||||||
#include <llvm/ADT/DenseSet.h>
|
#include <llvm/ADT/DenseSet.h>
|
||||||
#include <llvm/Support/Timer.h>
|
|
||||||
#include <llvm/Support/CrashRecoveryContext.h>
|
#include <llvm/Support/CrashRecoveryContext.h>
|
||||||
|
#include <llvm/Support/Timer.h>
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
using llvm::Timer;
|
using llvm::Timer;
|
||||||
|
|
||||||
@ -35,19 +35,10 @@ struct IndexParam {
|
|||||||
std::unordered_map<std::string, int64_t> file2write_time;
|
std::unordered_map<std::string, int64_t> file2write_time;
|
||||||
llvm::DenseMap<const Decl*, Usr> Decl2usr;
|
llvm::DenseMap<const Decl*, Usr> Decl2usr;
|
||||||
|
|
||||||
// Only use this when strictly needed (ie, primary translation unit is
|
|
||||||
// needed). Most logic should get the IndexFile instance via
|
|
||||||
// |file_consumer|.
|
|
||||||
//
|
|
||||||
// This can be null if we're not generating an index for the primary
|
|
||||||
// translation unit.
|
|
||||||
IndexFile* primary_file = nullptr;
|
|
||||||
|
|
||||||
ASTUnit& Unit;
|
ASTUnit& Unit;
|
||||||
ASTContext* Ctx;
|
ASTContext* Ctx;
|
||||||
|
|
||||||
FileConsumer* file_consumer = nullptr;
|
FileConsumer* file_consumer = nullptr;
|
||||||
NamespaceHelper ns;
|
|
||||||
|
|
||||||
IndexParam(ASTUnit& Unit, FileConsumer* file_consumer)
|
IndexParam(ASTUnit& Unit, FileConsumer* file_consumer)
|
||||||
: Unit(Unit), file_consumer(file_consumer) {}
|
: Unit(Unit), file_consumer(file_consumer) {}
|
||||||
@ -455,7 +446,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
SourceLocation Spell = SM.getSpellingLoc(Loc);
|
SourceLocation Spell = SM.getSpellingLoc(Loc);
|
||||||
Loc = SM.getFileLoc(Loc);
|
Loc = SM.getFileLoc(Loc);
|
||||||
Range loc = FromTokenRange(SM, Ctx->getLangOpts(), SourceRange(Loc, Loc));
|
Range loc = FromTokenRange(SM, Lang, SourceRange(Loc, Loc));
|
||||||
const FileEntry *FE = SM.getFileEntryForID(SM.getFileID(Loc));
|
const FileEntry *FE = SM.getFileEntryForID(SM.getFileID(Loc));
|
||||||
if (!FE) {
|
if (!FE) {
|
||||||
// TODO
|
// TODO
|
||||||
@ -465,7 +456,7 @@ public:
|
|||||||
FE = SM.getFileEntryForID(SM.getFileID(P.first));
|
FE = SM.getFileEntryForID(SM.getFileID(P.first));
|
||||||
#else
|
#else
|
||||||
auto R = SM.getExpansionRange(Loc);
|
auto R = SM.getExpansionRange(Loc);
|
||||||
loc = FromTokenRange(SM, Ctx->getLangOpts(), R.getAsRange());
|
loc = FromTokenRange(SM, Lang, R.getAsRange());
|
||||||
FE = SM.getFileEntryForID(SM.getFileID(R.getBegin()));
|
FE = SM.getFileEntryForID(SM.getFileID(R.getBegin()));
|
||||||
#endif
|
#endif
|
||||||
if (!FE)
|
if (!FE)
|
||||||
@ -475,11 +466,9 @@ public:
|
|||||||
if (!db)
|
if (!db)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
const DeclContext *SemDC = D->getDeclContext();
|
const Decl* OrigD = ASTNode.OrigD;
|
||||||
const DeclContext *LexDC = D->getLexicalDeclContext();
|
const DeclContext *SemDC = OrigD->getDeclContext();
|
||||||
(void)SemDC;
|
const DeclContext *LexDC = OrigD->getLexicalDeclContext();
|
||||||
(void)LexDC;
|
|
||||||
Range extent = FromTokenRange(SM, Lang, D->getSourceRange());
|
|
||||||
Role role = static_cast<Role>(Roles);
|
Role role = static_cast<Role>(Roles);
|
||||||
|
|
||||||
bool is_decl = Roles & uint32_t(index::SymbolRole::Declaration);
|
bool is_decl = Roles & uint32_t(index::SymbolRole::Declaration);
|
||||||
@ -501,13 +490,14 @@ public:
|
|||||||
auto do_def_decl = [&](auto *entity) {
|
auto do_def_decl = [&](auto *entity) {
|
||||||
if (!entity->def.detailed_name[0]) {
|
if (!entity->def.detailed_name[0]) {
|
||||||
SetName(D, short_name, qualified, entity->def);
|
SetName(D, short_name, qualified, entity->def);
|
||||||
if (g_config->index.comments)
|
if (entity->def.comments[0] == '\0' && g_config->index.comments)
|
||||||
entity->def.comments = Intern(GetComment(D));
|
entity->def.comments = Intern(GetComment(D));
|
||||||
}
|
}
|
||||||
if (is_def) {
|
if (is_def) {
|
||||||
entity->def.spell = GetUse(db, loc, LexDC, role);
|
entity->def.spell = GetUse(db, loc, SemDC, role);
|
||||||
// extent may come from a declaration.
|
entity->def.extent =
|
||||||
entity->def.extent = GetUse(db, extent, LexDC, Role::None);
|
GetUse(db, FromTokenRange(SM, Lang, OrigD->getSourceRange()), LexDC,
|
||||||
|
Role::None);
|
||||||
} else if (is_decl) {
|
} else if (is_decl) {
|
||||||
entity->declarations.push_back(GetUse(db, loc, LexDC, role));
|
entity->declarations.push_back(GetUse(db, loc, LexDC, role));
|
||||||
} else {
|
} else {
|
||||||
@ -734,7 +724,8 @@ public:
|
|||||||
break;
|
break;
|
||||||
case Decl::EnumConstant:
|
case Decl::EnumConstant:
|
||||||
var->def.kind = lsSymbolKind::EnumMember;
|
var->def.kind = lsSymbolKind::EnumMember;
|
||||||
if (is_def) {
|
// TODO Pretty printer may print =
|
||||||
|
if (is_def && strchr(var->def.detailed_name, '=') == nullptr) {
|
||||||
auto *ECD = cast<EnumConstantDecl>(D);
|
auto *ECD = cast<EnumConstantDecl>(D);
|
||||||
const auto &Val = ECD->getInitVal();
|
const auto &Val = ECD->getInitVal();
|
||||||
std::string init =
|
std::string init =
|
||||||
@ -764,6 +755,26 @@ class IndexPPCallbacks : public PPCallbacks {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
IndexPPCallbacks(SourceManager& SM, IndexParam& param) : SM(SM), param(param) {}
|
IndexPPCallbacks(SourceManager& SM, IndexParam& param) : SM(SM), param(param) {}
|
||||||
|
void InclusionDirective(SourceLocation HashLoc, const Token &Tok,
|
||||||
|
StringRef Included, bool IsAngled,
|
||||||
|
CharSourceRange FilenameRange, const FileEntry *File,
|
||||||
|
StringRef SearchPath, StringRef RelativePath,
|
||||||
|
const Module *Imported,
|
||||||
|
SrcMgr::CharacteristicKind FileType) override {
|
||||||
|
if (!File)
|
||||||
|
return;
|
||||||
|
llvm::sys::fs::UniqueID UniqueID;
|
||||||
|
SourceRange R = FilenameRange.getAsRange();
|
||||||
|
auto spell = FromCharRange(SM, param.Ctx->getLangOpts(), R, &UniqueID);
|
||||||
|
const FileEntry *FE = SM.getFileEntryForID(SM.getFileID(R.getBegin()));
|
||||||
|
if (!FE)
|
||||||
|
return;
|
||||||
|
if (IndexFile *db = param.ConsumeFile(*FE)) {
|
||||||
|
std::string file_name = FileName(*File);
|
||||||
|
if (file_name.size())
|
||||||
|
db->includes.push_back({spell.start.line, std::move(file_name)});
|
||||||
|
}
|
||||||
|
}
|
||||||
void MacroDefined(const Token &Tok, const MacroDirective *MD) override {
|
void MacroDefined(const Token &Tok, const MacroDirective *MD) override {
|
||||||
llvm::sys::fs::UniqueID UniqueID;
|
llvm::sys::fs::UniqueID UniqueID;
|
||||||
SourceLocation L = MD->getLocation();
|
SourceLocation L = MD->getLocation();
|
||||||
@ -803,8 +814,10 @@ public:
|
|||||||
}
|
}
|
||||||
void MacroUndefined(const Token &Tok, const MacroDefinition &MD,
|
void MacroUndefined(const Token &Tok, const MacroDefinition &MD,
|
||||||
const MacroDirective *UD) override {
|
const MacroDirective *UD) override {
|
||||||
SourceLocation L = UD->getLocation();
|
if (UD) {
|
||||||
MacroExpands(Tok, MD, {L, L}, nullptr);
|
SourceLocation L = UD->getLocation();
|
||||||
|
MacroExpands(Tok, MD, {L, L}, nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void SourceRangeSkipped(SourceRange Range, SourceLocation EndifLoc) override {
|
void SourceRangeSkipped(SourceRange Range, SourceLocation EndifLoc) override {
|
||||||
llvm::sys::fs::UniqueID UniqueID;
|
llvm::sys::fs::UniqueID UniqueID;
|
||||||
@ -879,20 +892,27 @@ void Uniquify(std::vector<Use>& uses) {
|
|||||||
uses.resize(n);
|
uses.resize(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::unique_ptr<IndexFile>> ClangIndexer::Index(
|
|
||||||
|
namespace ccls::idx {
|
||||||
|
void IndexInit() {
|
||||||
|
// This calls llvm::InitializeAllTargets() ... for us, we would otherwise link
|
||||||
|
// all target libraries.
|
||||||
|
CXIndex CXIdx = clang_createIndex(0, 0);
|
||||||
|
clang_disposeIndex(CXIdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::unique_ptr<IndexFile>> Index(
|
||||||
VFS* vfs,
|
VFS* vfs,
|
||||||
std::string file,
|
const std::string& opt_wdir,
|
||||||
|
const std::string& file,
|
||||||
const std::vector<std::string>& args,
|
const std::vector<std::string>& args,
|
||||||
const std::vector<FileContents>& file_contents) {
|
const std::vector<FileContents>& file_contents) {
|
||||||
if (!g_config->index.enabled)
|
if (!g_config->index.enabled)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
file = NormalizePath(file);
|
|
||||||
|
|
||||||
std::vector<const char *> Args;
|
std::vector<const char *> Args;
|
||||||
for (auto& arg: args)
|
for (auto& arg: args)
|
||||||
Args.push_back(arg.c_str());
|
Args.push_back(arg.c_str());
|
||||||
Args.push_back("-fno-spell-checking");
|
|
||||||
auto PCHCO = std::make_shared<PCHContainerOperations>();
|
auto PCHCO = std::make_shared<PCHContainerOperations>();
|
||||||
IntrusiveRefCntPtr<DiagnosticsEngine>
|
IntrusiveRefCntPtr<DiagnosticsEngine>
|
||||||
Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions));
|
Diags(CompilerInstance::createDiagnostics(new DiagnosticOptions));
|
||||||
@ -900,8 +920,12 @@ std::vector<std::unique_ptr<IndexFile>> ClangIndexer::Index(
|
|||||||
createInvocationFromCommandLine(Args, Diags);
|
createInvocationFromCommandLine(Args, Diags);
|
||||||
if (!CI)
|
if (!CI)
|
||||||
return {};
|
return {};
|
||||||
CI->getLangOpts()->CommentOpts.ParseAllComments = true;
|
// -fparse-all-comments enables documentation in the indexer and in
|
||||||
|
// code completion.
|
||||||
|
CI->getLangOpts()->CommentOpts.ParseAllComments =
|
||||||
|
g_config->index.comments > 1;
|
||||||
CI->getLangOpts()->RetainCommentsFromSystemHeaders = true;
|
CI->getLangOpts()->RetainCommentsFromSystemHeaders = true;
|
||||||
|
CI->getLangOpts()->SpellChecking = false;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<llvm::MemoryBuffer>> BufOwner;
|
std::vector<std::unique_ptr<llvm::MemoryBuffer>> BufOwner;
|
||||||
for (auto &c : file_contents) {
|
for (auto &c : file_contents) {
|
||||||
@ -927,31 +951,42 @@ std::vector<std::unique_ptr<IndexFile>> ClangIndexer::Index(
|
|||||||
|
|
||||||
std::unique_ptr<FrontendAction> IndexAction = createIndexingAction(
|
std::unique_ptr<FrontendAction> IndexAction = createIndexingAction(
|
||||||
DataConsumer, IndexOpts, std::make_unique<IndexFrontendAction>(param));
|
DataConsumer, IndexOpts, std::make_unique<IndexFrontendAction>(param));
|
||||||
llvm::CrashRecoveryContextCleanupRegistrar<FrontendAction> IndexActionCleanup(
|
|
||||||
IndexAction.get());
|
|
||||||
|
|
||||||
DiagnosticErrorTrap DiagTrap(*Diags);
|
DiagnosticErrorTrap DiagTrap(*Diags);
|
||||||
bool Success = ASTUnit::LoadFromCompilerInvocationAction(
|
bool success = false;
|
||||||
std::move(CI), PCHCO, Diags, IndexAction.get(), Unit.get(),
|
llvm::CrashRecoveryContext CRC;
|
||||||
/*Persistent=*/true, "/home/maskray/Dev/llvm/release/lib/clang/7.0.0",
|
{
|
||||||
/*OnlyLocalDecls=*/true,
|
auto compile = [&]() {
|
||||||
/*CaptureDiagnostics=*/true, 0, false, false, true);
|
success = ASTUnit::LoadFromCompilerInvocationAction(
|
||||||
|
std::move(CI), PCHCO, Diags, IndexAction.get(), Unit.get(),
|
||||||
|
/*Persistent=*/true, /*ResourceDir=*/"",
|
||||||
|
/*OnlyLocalDecls=*/true,
|
||||||
|
/*CaptureDiagnostics=*/true, 0, false, false, true);
|
||||||
|
};
|
||||||
|
const char *env = getenv("CCLS_CRASH_RECOVERY");
|
||||||
|
if (env && strcmp(env, "0") == 0)
|
||||||
|
compile();
|
||||||
|
else
|
||||||
|
CRC.RunSafely(compile);
|
||||||
|
}
|
||||||
|
|
||||||
if (!Unit) {
|
if (!Unit) {
|
||||||
LOG_S(ERROR) << "failed to index " << file;
|
LOG_S(ERROR) << "failed to index " << file;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
if (!Success)
|
if (!success) {
|
||||||
|
LOG_S(ERROR) << "clang crashed for " << file;
|
||||||
return {};
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
// ClangCursor(clang_getTranslationUnitCursor(tu->cx_tu))
|
// ClangCursor(clang_getTranslationUnitCursor(tu->cx_tu))
|
||||||
// .VisitChildren(&VisitMacroDefinitionAndExpansions, ¶m);
|
// .VisitChildren(&VisitMacroDefinitionAndExpansions, ¶m);
|
||||||
const SourceManager& SM = Unit->getSourceManager();
|
const SourceManager& SM = Unit->getSourceManager();
|
||||||
const FileEntry* FE = SM.getFileEntryForID(SM.getMainFileID());
|
const FileEntry* FE = SM.getFileEntryForID(SM.getMainFileID());
|
||||||
param.primary_file = param.ConsumeFile(*FE);
|
IndexFile* main_file = param.ConsumeFile(*FE);
|
||||||
std::unordered_map<std::string, int> inc_to_line;
|
std::unordered_map<std::string, int> inc_to_line;
|
||||||
// TODO
|
if (main_file)
|
||||||
if (param.primary_file)
|
for (auto& inc : main_file->includes)
|
||||||
for (auto& inc : param.primary_file->includes)
|
|
||||||
inc_to_line[inc.resolved_path] = inc.line;
|
inc_to_line[inc.resolved_path] = inc.line;
|
||||||
|
|
||||||
auto result = param.file_consumer->TakeLocalState();
|
auto result = param.file_consumer->TakeLocalState();
|
||||||
@ -972,7 +1007,7 @@ std::vector<std::unique_ptr<IndexFile>> ClangIndexer::Index(
|
|||||||
for (auto& it : entry->usr2var)
|
for (auto& it : entry->usr2var)
|
||||||
Uniquify(it.second.uses);
|
Uniquify(it.second.uses);
|
||||||
|
|
||||||
if (param.primary_file) {
|
if (main_file) {
|
||||||
// If there are errors, show at least one at the include position.
|
// If there are errors, show at least one at the include position.
|
||||||
auto it = inc_to_line.find(entry->path);
|
auto it = inc_to_line.find(entry->path);
|
||||||
if (it != inc_to_line.end()) {
|
if (it != inc_to_line.end()) {
|
||||||
@ -982,7 +1017,7 @@ std::vector<std::unique_ptr<IndexFile>> ClangIndexer::Index(
|
|||||||
continue;
|
continue;
|
||||||
ls_diagnostic.range =
|
ls_diagnostic.range =
|
||||||
lsRange{lsPosition{line, 10}, lsPosition{line, 10}};
|
lsRange{lsPosition{line, 10}, lsPosition{line, 10}};
|
||||||
param.primary_file->diagnostics_.push_back(ls_diagnostic);
|
main_file->diagnostics_.push_back(ls_diagnostic);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1000,11 +1035,6 @@ std::vector<std::unique_ptr<IndexFile>> ClangIndexer::Index(
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IndexInit() {
|
|
||||||
// InitLLVM
|
|
||||||
CXIndex CXIdx = clang_createIndex(0, 0);
|
|
||||||
clang_disposeIndex(CXIdx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// |SymbolRef| is serialized this way.
|
// |SymbolRef| is serialized this way.
|
||||||
|
@ -285,22 +285,11 @@ struct IndexFile {
|
|||||||
std::string ToString();
|
std::string ToString();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NamespaceHelper {
|
namespace ccls::idx {
|
||||||
std::unordered_map<Usr, std::string> usr2qualified_name;
|
|
||||||
|
|
||||||
std::tuple<std::string, int16_t, int16_t> QualifiedName(
|
|
||||||
const CXIdxContainerInfo* container,
|
|
||||||
std::string_view unqualified_name);
|
|
||||||
};
|
|
||||||
|
|
||||||
bool ConcatTypeAndName(std::string& type, const std::string& name);
|
|
||||||
|
|
||||||
void IndexInit();
|
void IndexInit();
|
||||||
|
|
||||||
struct ClangIndexer {
|
std::vector<std::unique_ptr<IndexFile>>
|
||||||
std::vector<std::unique_ptr<IndexFile>> Index(
|
Index(VFS *vfs, const std::string &opt_wdir, const std::string &file,
|
||||||
VFS* vfs,
|
const std::vector<std::string> &args,
|
||||||
std::string file,
|
const std::vector<FileContents> &file_contents);
|
||||||
const std::vector<std::string>& args,
|
}
|
||||||
const std::vector<FileContents>& file_contents);
|
|
||||||
};
|
|
||||||
|
@ -59,7 +59,7 @@ int main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pipeline::Init();
|
pipeline::Init();
|
||||||
IndexInit();
|
idx::IndexInit();
|
||||||
|
|
||||||
bool language_server = true;
|
bool language_server = true;
|
||||||
|
|
||||||
|
@ -152,8 +152,7 @@ std::unique_ptr<IndexFile> RawCacheLoad(
|
|||||||
bool Indexer_Parse(DiagnosticsPublisher* diag_pub,
|
bool Indexer_Parse(DiagnosticsPublisher* diag_pub,
|
||||||
WorkingFiles* working_files,
|
WorkingFiles* working_files,
|
||||||
Project* project,
|
Project* project,
|
||||||
VFS* vfs,
|
VFS* vfs) {
|
||||||
ClangIndexer* indexer) {
|
|
||||||
std::optional<Index_Request> opt_request = index_request->TryPopFront();
|
std::optional<Index_Request> opt_request = index_request->TryPopFront();
|
||||||
if (!opt_request)
|
if (!opt_request)
|
||||||
return false;
|
return false;
|
||||||
@ -235,7 +234,7 @@ bool Indexer_Parse(DiagnosticsPublisher* diag_pub,
|
|||||||
|
|
||||||
LOG_S(INFO) << "parse " << path_to_index;
|
LOG_S(INFO) << "parse " << path_to_index;
|
||||||
|
|
||||||
auto indexes = indexer->Index(vfs, path_to_index, entry.args, {});
|
auto indexes = idx::Index(vfs, entry.directory, path_to_index, entry.args, {});
|
||||||
|
|
||||||
if (indexes.empty()) {
|
if (indexes.empty()) {
|
||||||
if (g_config->index.enabled && request.id.Valid()) {
|
if (g_config->index.enabled && request.id.Valid()) {
|
||||||
@ -309,11 +308,8 @@ void Indexer_Main(DiagnosticsPublisher* diag_pub,
|
|||||||
VFS* vfs,
|
VFS* vfs,
|
||||||
Project* project,
|
Project* project,
|
||||||
WorkingFiles* working_files) {
|
WorkingFiles* working_files) {
|
||||||
// Build one index per-indexer, as building the index acquires a global lock.
|
|
||||||
ClangIndexer indexer;
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
if (!Indexer_Parse(diag_pub, working_files, project, vfs, &indexer))
|
if (!Indexer_Parse(diag_pub, working_files, project, vfs))
|
||||||
indexer_waiter->Wait(index_request);
|
indexer_waiter->Wait(index_request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,11 +186,7 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry(
|
|||||||
// what ccls uses. Make sure we do not emit warnings for mismatched options.
|
// what ccls uses. Make sure we do not emit warnings for mismatched options.
|
||||||
args.push_back("-Wno-unknown-warning-option");
|
args.push_back("-Wno-unknown-warning-option");
|
||||||
|
|
||||||
// Using -fparse-all-comments enables documentation in the indexer and in
|
result.directory = entry.directory;
|
||||||
// code completion.
|
|
||||||
if (g_config->index.comments > 1)
|
|
||||||
args.push_back("-fparse-all-comments");
|
|
||||||
|
|
||||||
result.args = std::move(args);
|
result.args = std::move(args);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ struct WorkingFiles;
|
|||||||
|
|
||||||
struct Project {
|
struct Project {
|
||||||
struct Entry {
|
struct Entry {
|
||||||
|
std::string directory;
|
||||||
std::string filename;
|
std::string filename;
|
||||||
std::vector<std::string> args;
|
std::vector<std::string> args;
|
||||||
// If true, this entry is inferred and was not read from disk.
|
// If true, this entry is inferred and was not read from disk.
|
||||||
|
@ -246,7 +246,6 @@ bool RunIndexTests(const std::string& filter_path, bool enable_update) {
|
|||||||
bool update_all = false;
|
bool update_all = false;
|
||||||
// FIXME: show diagnostics in STL/headers when running tests. At the moment
|
// FIXME: show diagnostics in STL/headers when running tests. At the moment
|
||||||
// this can be done by constructing ClangIndex index(1, 1);
|
// this can be done by constructing ClangIndex index(1, 1);
|
||||||
ClangIndexer index;
|
|
||||||
GetFilesInFolder(
|
GetFilesInFolder(
|
||||||
"index_tests", true /*recursive*/, true /*add_folder_to_path*/,
|
"index_tests", true /*recursive*/, true /*add_folder_to_path*/,
|
||||||
[&](const std::string& path) {
|
[&](const std::string& path) {
|
||||||
@ -290,7 +289,7 @@ bool RunIndexTests(const std::string& filter_path, bool enable_update) {
|
|||||||
// Run test.
|
// Run test.
|
||||||
g_config = new Config;
|
g_config = new Config;
|
||||||
VFS vfs;
|
VFS vfs;
|
||||||
auto dbs = index.Index(&vfs, path, flags, {});
|
auto dbs = ccls::idx::Index(&vfs, "", path, flags, {});
|
||||||
|
|
||||||
for (const auto& entry : all_expected_output) {
|
for (const auto& entry : all_expected_output) {
|
||||||
const std::string& expected_path = entry.first;
|
const std::string& expected_path = entry.first;
|
||||||
|
Loading…
Reference in New Issue
Block a user