aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/codesearch/testdata/refs.c
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
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')
-rw-r--r--pkg/codesearch/testdata/refs.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/pkg/codesearch/testdata/refs.c b/pkg/codesearch/testdata/refs.c
new file mode 100644
index 000000000..9b6b2633f
--- /dev/null
+++ b/pkg/codesearch/testdata/refs.c
@@ -0,0 +1,34 @@
+// Copyright 2025 syzkaller project authors. All rights reserved.
+// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
+
+int refs0()
+{
+ return 0;
+}
+
+void refs1()
+{
+}
+
+void refs2(void (*)(), int)
+{
+}
+
+void refs3()
+{
+ refs2(refs1, refs0());
+ (void)refs2;
+}
+
+void long_func_with_ref()
+{
+ refs0();
+ refs1();
+ refs0();
+ refs1();
+ refs2(refs1, refs0());
+ refs0();
+ refs1();
+ refs0();
+ refs1();
+}