Skip to content

Commit 446e1c3

Browse files
committed
pkg/codesearch: do indexing of struct/union/enum
Update #6469
1 parent 4f23b01 commit 446e1c3

20 files changed

+312
-47
lines changed

pkg/codesearch/database.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type LineRange struct {
4444
var DatabaseFormatHash = func() string {
4545
// Semantic version should be bumped when the schema does not change,
4646
// but stored values changes.
47-
const semanticVersion = "1"
47+
const semanticVersion = "2"
4848
schema, err := jsonschema.For[Database](nil)
4949
if err != nil {
5050
panic(err)

pkg/codesearch/testdata/query-def-source-header

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ def-source source0.c function_with_comment_in_header yes
22

33
function function_with_comment_in_header is defined in source0.c:
44

5-
19: void function_with_comment_in_header()
6-
20: {
7-
21: same_name_in_several_files();
8-
22: }
5+
24: void function_with_comment_in_header()
6+
25: {
7+
26: same_name_in_several_files();
8+
27: }

pkg/codesearch/testdata/query-def-source-open

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ def-source source0.c open yes
22

33
function open is defined in source0.c:
44

5-
6: /*
6-
7: * Comment about open.
7-
8: */
8-
9: int open()
9-
10: {
10-
11: return 0;
11-
12: }
5+
11: /*
6+
12: * Comment about open.
7+
13: */
8+
14: int open()
9+
15: {
10+
16: return 0;
11+
17: }
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def-source source0.c struct_in_c_file yes
2+
3+
struct struct_in_c_file is defined in source0.c:
4+
5+
6: struct struct_in_c_file {
6+
7: int X;
7+
8: struct some_struct by_value;
8+
9: };
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def-source source0.c some_struct yes
2+
3+
struct some_struct is defined in source0.h:
4+
5+
17: struct some_struct {
6+
18: int x;
7+
19: int y;
8+
20: };
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def-source source0.c some_struct_t yes
2+
3+
typedef some_struct_t is defined in source0.h:
4+
5+
22: typedef struct some_struct some_struct_t;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def-source source0.c some_struct_with_a_comment yes
2+
3+
struct some_struct_with_a_comment is defined in source0.h:
4+
5+
24: /*
6+
25: * This should not require an explanation.
7+
26: */
8+
27: struct some_struct_with_a_comment {
9+
28: int x;
10+
29: struct some_struct* other_struct;
11+
30: };
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def-source source0.c typedefed_struct_t yes
2+
3+
typedef typedefed_struct_t is defined in source0.h:
4+
5+
32: typedef struct {
6+
33: int x;
7+
34: } typedefed_struct_t;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def-source source0.c another_struct yes
2+
3+
struct another_struct is defined in source0.h:
4+
5+
36: typedef struct another_struct {
6+
37: int x;
7+
38: } another_struct_t;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def-source source0.c another_struct_t yes
2+
3+
typedef another_struct_t is defined in source0.h:
4+
5+
36: typedef struct another_struct {
6+
37: int x;
7+
38: } another_struct_t;

0 commit comments

Comments
 (0)