View definition

(*Program).NewFunction

Defined in github.com/golang/tools/go/ssa/func.go

Description

NewFunction returns a new synthetic Function instance belonging to prog, with its name and signature fields set as specified.

The caller is responsible for initializing the remaining fields of the function object, e.g. Pkg, Params, Blocks.

It is practically impossible for clients to construct well-formed SSA functions/packages/programs directly, so we assume this is the job of the Builder alone. NewFunction exists to provide clients a little flexibility. For example, analysis tools may wish to construct fake Functions for the root of the callgraph, a fake "reflect" package, etc.

TODO(adonovan): think harder about the API here.