-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposalToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.
Milestone
Description
Background: The precision of analyses that use the golang.org/x/tools/go/ssa representation of Go programs is improved by exploiting information about which function calls can never return, such as log.Fatal or (*testing.T).Fatalf. This information is already computed interprocedurally by the ctrlflow analyzer, which uses the x/tools/go/cfg package, and is plumbed through to x/tools/go/ssa by using three backdoors. This is implemented in https://go.dev/cl/716920. We would like to add public API to obviate the need for such hacks.
Proposal: We propose to expose these three accessor methods:
package cfg // x/tools/go/cfg
// NoReturn reports whether the control flow graph cannot return normally.
func (*CFG) NoReturn() boolpackage ctrlflow // x/tools/go/analysis/passes/ctrlflow
// NoReturn reports whether the specified control-flow graph cannot return normally.
func (*CFGs) NoReturn(*types.Func) boolpackage ssa // x/tools/go/ssa
// SetNoReturn sets the predicate used by the SSA builder to decide whether a
// call to the specified named function cannot return normally.
// This allows the builder to prune infeasible control flow edges,
// improving the precision of downstream analyses.
func (*Program) SetNoReturn(func (*types.Func) bool)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
AnalysisIssues related to static analysis (vet, x/tools/go/analysis)Issues related to static analysis (vet, x/tools/go/analysis)LibraryProposalIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolIssues describing a requested change to the Go standard library or x/ libraries, but not to a toolProposalToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.
Type
Projects
Status
Active