4 "honnef.co/go/tools/ir"
7 // IsStub reports whether a function is a stub. A function is
8 // considered a stub if it has no instructions or if all it does is
9 // return a constant value.
10 func IsStub(fn *ir.Function) bool {
11 for _, b := range fn.Blocks {
12 for _, instr := range b.Instrs {
15 // const naturally has no side-effects
17 // panic is a stub if it only uses constants
19 // return is a stub if it only uses constants
22 // if there are no disallowed instructions, then we're
23 // only jumping to the exit block (or possibly
24 // somewhere else that's stubby?)
26 // all other instructions are assumed to do actual work