aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/codesearch/testdata/source0.c.json
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2025-11-17 11:17:23 +0100
committerDmitry Vyukov <dvyukov@google.com>2025-11-20 10:10:05 +0000
commit280ea308c321115445df610f1a75b05bbadca5f3 (patch)
treec195c76723c4a08986d74edbfc9e15a4f07fa6c1 /pkg/codesearch/testdata/source0.c.json
parent94d1e3f8b1838e8a04074464a957e979a5c5e36b (diff)
pkg/codesearch: add skeleton for code searching tool
Add a clang tool that is used for code indexing (tools/clang/codesearch/). It follows conventions and build procedure of the declextract tool. Add pkg/codesearch package that aggregates the info exposed by the clang tools, and allows doing simple queries: - show source code of an entity (function, struct, etc) - show entity comment - show all entities defined in a source file Add tools/syz-codesearch wrapper tool that allows to create index for a kernel build, and then run code queries on it.
Diffstat (limited to 'pkg/codesearch/testdata/source0.c.json')
-rw-r--r--pkg/codesearch/testdata/source0.c.json41
1 files changed, 41 insertions, 0 deletions
diff --git a/pkg/codesearch/testdata/source0.c.json b/pkg/codesearch/testdata/source0.c.json
new file mode 100644
index 000000000..d33aa360c
--- /dev/null
+++ b/pkg/codesearch/testdata/source0.c.json
@@ -0,0 +1,41 @@
+{
+ "definitions": [
+ {
+ "kind": "function",
+ "name": "close",
+ "type": "int ()",
+ "body": {
+ "file": "source0.c",
+ "start_line": 14,
+ "end_line": 17
+ },
+ "comment": {}
+ },
+ {
+ "kind": "function",
+ "name": "function_with_comment_in_header",
+ "type": "void ()",
+ "body": {
+ "file": "source0.c",
+ "start_line": 19,
+ "end_line": 22
+ },
+ "comment": {}
+ },
+ {
+ "kind": "function",
+ "name": "open",
+ "type": "int ()",
+ "body": {
+ "file": "source0.c",
+ "start_line": 6,
+ "end_line": 12
+ },
+ "comment": {
+ "file": "source0.c",
+ "start_line": 6,
+ "end_line": 8
+ }
+ }
+ ]
+} \ No newline at end of file