aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/codesearch/testdata/refs.c.json
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2026-01-19 15:31:50 +0100
committerDmitry Vyukov <dvyukov@google.com>2026-01-21 13:38:45 +0000
commitd720635adb8965149cd75a3da692d3a0480c36c9 (patch)
treed9896eabd70abd266028624702bc74609ba1c9e4 /pkg/codesearch/testdata/refs.c.json
parent6984f21fcb77bdd034a489c0e552aa1d910e852f (diff)
pkg/codesearch: support searching for references
Extend codesearch clang tool to export info about function references (calls, takes-address-of). Add pkg/codesearch command find-references. Export find-references in pkg/aflow/tools/codesearcher to LLMs. Update #6469
Diffstat (limited to 'pkg/codesearch/testdata/refs.c.json')
-rw-r--r--pkg/codesearch/testdata/refs.c.json157
1 files changed, 157 insertions, 0 deletions
diff --git a/pkg/codesearch/testdata/refs.c.json b/pkg/codesearch/testdata/refs.c.json
new file mode 100644
index 000000000..289ce7c30
--- /dev/null
+++ b/pkg/codesearch/testdata/refs.c.json
@@ -0,0 +1,157 @@
+{
+ "definitions": [
+ {
+ "kind": "function",
+ "name": "long_func_with_ref",
+ "type": "void ()",
+ "body": {
+ "file": "refs.c",
+ "start_line": 23,
+ "end_line": 34
+ },
+ "comment": {},
+ "refs": [
+ {
+ "kind": "calls",
+ "entity_kind": "function",
+ "name": "refs0",
+ "line": 25
+ },
+ {
+ "kind": "calls",
+ "entity_kind": "function",
+ "name": "refs1",
+ "line": 26
+ },
+ {
+ "kind": "calls",
+ "entity_kind": "function",
+ "name": "refs0",
+ "line": 27
+ },
+ {
+ "kind": "calls",
+ "entity_kind": "function",
+ "name": "refs1",
+ "line": 28
+ },
+ {
+ "kind": "calls",
+ "entity_kind": "function",
+ "name": "refs2",
+ "line": 29
+ },
+ {
+ "kind": "takes-address-of",
+ "entity_kind": "function",
+ "name": "refs1",
+ "line": 29
+ },
+ {
+ "kind": "calls",
+ "entity_kind": "function",
+ "name": "refs0",
+ "line": 29
+ },
+ {
+ "kind": "calls",
+ "entity_kind": "function",
+ "name": "refs0",
+ "line": 30
+ },
+ {
+ "kind": "calls",
+ "entity_kind": "function",
+ "name": "refs1",
+ "line": 31
+ },
+ {
+ "kind": "calls",
+ "entity_kind": "function",
+ "name": "refs0",
+ "line": 32
+ },
+ {
+ "kind": "calls",
+ "entity_kind": "function",
+ "name": "refs1",
+ "line": 33
+ }
+ ]
+ },
+ {
+ "kind": "function",
+ "name": "refs0",
+ "type": "int ()",
+ "body": {
+ "file": "refs.c",
+ "start_line": 4,
+ "end_line": 7
+ },
+ "comment": {
+ "file": "refs.c",
+ "start_line": 1,
+ "end_line": 2
+ }
+ },
+ {
+ "kind": "function",
+ "name": "refs1",
+ "type": "void ()",
+ "body": {
+ "file": "refs.c",
+ "start_line": 9,
+ "end_line": 11
+ },
+ "comment": {}
+ },
+ {
+ "kind": "function",
+ "name": "refs2",
+ "type": "void (void (*)(), int)",
+ "body": {
+ "file": "refs.c",
+ "start_line": 13,
+ "end_line": 15
+ },
+ "comment": {}
+ },
+ {
+ "kind": "function",
+ "name": "refs3",
+ "type": "void ()",
+ "body": {
+ "file": "refs.c",
+ "start_line": 17,
+ "end_line": 21
+ },
+ "comment": {},
+ "refs": [
+ {
+ "kind": "calls",
+ "entity_kind": "function",
+ "name": "refs2",
+ "line": 19
+ },
+ {
+ "kind": "takes-address-of",
+ "entity_kind": "function",
+ "name": "refs1",
+ "line": 19
+ },
+ {
+ "kind": "calls",
+ "entity_kind": "function",
+ "name": "refs0",
+ "line": 19
+ },
+ {
+ "kind": "takes-address-of",
+ "entity_kind": "function",
+ "name": "refs2",
+ "line": 20
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file