mulint

package
v0.0.0-...-4573f11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Mulint = &analysis.Analyzer{
	Name: "mulint",
	Doc:  "reports reentrant mutex locks",
	Run:  run,
}

Functions

func CallExpr

func CallExpr(node ast.Node) *ast.CallExpr

func RootSelector

func RootSelector(sel *ast.SelectorExpr) *ast.Ident

func SelectorExpr

func SelectorExpr(call *ast.CallExpr) *ast.SelectorExpr

func StrExpr

func StrExpr(e ast.Expr) string

func SubjectForCall

func SubjectForCall(node ast.Node, names []string) ast.Expr

Types

type Analyzer

type Analyzer struct {
	// contains filtered or unexported fields
}

func NewAnalyzer

func NewAnalyzer(pass *analysis.Pass, scopes map[FQN]*Scopes, calls map[FQN][]FQN) *Analyzer

func (*Analyzer) Analyze

func (a *Analyzer) Analyze()

func (*Analyzer) ContainsLock

func (a *Analyzer) ContainsLock(n ast.Node, seq *MutexScope)

func (*Analyzer) Errors

func (a *Analyzer) Errors() []LintError

type FQN

type FQN string

func FromCallInfo

func FromCallInfo(pkg, fnName string) FQN

type LintError

type LintError struct {
	// contains filtered or unexported fields
}

func NewLintError

func NewLintError(origin Location, secondLock Location) LintError

func (LintError) GetLine

func (le LintError) GetLine(pass *analysis.Pass, position token.Position) string

func (LintError) Origin

func (le LintError) Origin() Location

func (LintError) Report

func (le LintError) Report(pass *analysis.Pass)

func (LintError) SecondLock

func (le LintError) SecondLock() Location

type Location

type Location struct {
	// contains filtered or unexported fields
}

func NewLocation

func NewLocation(pos token.Pos) Location

func (Location) Pos

func (l Location) Pos() token.Pos

type MutexScope

type MutexScope struct {
	// contains filtered or unexported fields
}

func NewMutexScope

func NewMutexScope(mutexSelector string, pos token.Pos) *MutexScope

func (*MutexScope) Add

func (s *MutexScope) Add(node ast.Node)

func (*MutexScope) IsEqual

func (s *MutexScope) IsEqual(right *MutexScope) bool

func (*MutexScope) Nodes

func (s *MutexScope) Nodes() []ast.Node

func (*MutexScope) Pos

func (s *MutexScope) Pos() token.Pos

func (*MutexScope) Selector

func (s *MutexScope) Selector() string

type Scopes

type Scopes struct {
	// contains filtered or unexported fields
}

func NewScopes

func NewScopes(prog *loader.Program) *Scopes

func (*Scopes) EndBlock

func (s *Scopes) EndBlock()

func (*Scopes) HasAnyScope

func (s *Scopes) HasAnyScope() bool

func (*Scopes) Scopes

func (s *Scopes) Scopes() []*MutexScope

func (*Scopes) Track

func (s *Scopes) Track(stmt ast.Stmt)

type Visitor

type Visitor struct {
	// contains filtered or unexported fields
}

func NewVisitor

func NewVisitor(prog *loader.Program, pkg *types.Package, info *types.Info) *Visitor

func (*Visitor) Calls

func (v *Visitor) Calls() map[FQN][]FQN

func (*Visitor) Scopes

func (v *Visitor) Scopes() map[FQN]*Scopes

func (*Visitor) Visit

func (v *Visitor) Visit(node ast.Node) ast.Visitor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL