From c7e92da6cb06679b04062786481f50e42c585bfc Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 14 Apr 2025 08:03:22 +0200 Subject: tools/syz-declextract: extract function references more precisely Currently we misparse some function references, e.g. for: .write = (foo) ? bar : baz, we extract "foo". Extract first function reference from such expressions. --- pkg/declextract/interface.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'pkg/declextract/interface.go') diff --git a/pkg/declextract/interface.go b/pkg/declextract/interface.go index e8ace450b..a1ba9c137 100644 --- a/pkg/declextract/interface.go +++ b/pkg/declextract/interface.go @@ -4,6 +4,7 @@ package declextract import ( + "fmt" "slices" "strings" @@ -173,12 +174,12 @@ func (ctx *context) findFunc(name, file string) *Function { return ctx.funcs[name] } -func (ctx *context) funcDefinitionFile(name, calledFrom string) string { - fn := ctx.findFunc(name, calledFrom) +func (ctx *context) mustFindFunc(name, file string) *Function { + fn := ctx.findFunc(name, file) if fn == nil { - return "" + panic(fmt.Sprintf("no func %q in %q", name, file)) } - return fn.File + return fn } func fileNameSuffix(file string) string { -- cgit mrf-deployment