utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SHARED_PKG = "!#shared_pkg"
	SHARED_FUN = "!#shared_fun"
)

Variables

This section is empty.

Functions

func Atoi

func Atoi(s string) int

Atoi function that fatals instead of returing a tuple with an error

func CanColorize

func CanColorize(col func(...interface{}) string) func(...interface{}) string

func FindSSAInstruction

func FindSSAInstruction(fun *ssa.Function, pred func(ssa.Instruction) bool) (ssa.Instruction, bool)

Returns the first instruction in block-instruction order that matches the predicate.

func HashCombine

func HashCombine(hs ...uint32) (seed uint32)

Use the C++ boost algorithm for combining multiple hash values.

func IsModelledConcurrentAPIType

func IsModelledConcurrentAPIType(typ types.Type) bool

func IsNamedType

func IsNamedType(typ types.Type, pkg string, name string) bool

func MakePath

func MakePath() (path string)

MakePath returns a string based on whether a project name was provided or not

func Opts

func Opts() optInterface

func ParseArgs

func ParseArgs()

func PrintSSAFun

func PrintSSAFun(fun *ssa.Function)

func PrintSSAFunWithPos

func PrintSSAFunWithPos(fset *token.FileSet, fun *ssa.Function)

func Prompt

func Prompt()

func SSABlockString

func SSABlockString(blk *ssa.BasicBlock) string

func SSAFunString

func SSAFunString(fun *ssa.Function) string

func SSAPkgString

func SSAPkgString(pkg *ssa.Package) (str string)

func SSAValString

func SSAValString(v ssa.Value) string

func TimeTrack

func TimeTrack(start time.Time, name string)

func TypeCompat

func TypeCompat(declType, allocType T.Type) (res bool)

TypeCompat checks whether a value allocated with `allocType` may appear in value with declared type `declType`. For instance, a pointer to an int allocated with `new(int)` may appear in a value with declared type pointer to `myint`, where `type myint int`, if the pointer is appropriately casted on the way.

func TypeHasConcurrencyPrimitives

func TypeHasConcurrencyPrimitives(typ types.Type, visited map[types.Type]struct{}) bool

func TypeHasPointerLikes

func TypeHasPointerLikes(typ types.Type) bool

func ValHasConcurrencyPrimitives

func ValHasConcurrencyPrimitives(v ssa.Value, pt *pointer.Result) bool

func ValHasPointerLikes

func ValHasPointerLikes(v ssa.Value) bool

func ValIsInPkg

func ValIsInPkg(val ssa.Value, pkg string) bool

func VerbosePrint

func VerbosePrint(format string, a ...interface{}) (n int, err error)

Types

type Hashable

type Hashable interface {
	Hash() uint32
}

type Hasher

type Hasher[T any] interface {
	Hash(a T) uint32
	Equal(a, b T) bool
}
var SSAValueSetHasher Hasher[SSAValueSet] = ssaValueSetHasher{}

type PointerHasher

type PointerHasher struct{}

func (PointerHasher) Equal

func (PointerHasher) Equal(a, b interface{}) bool

func (PointerHasher) Hash

func (PointerHasher) Hash(v interface{}) uint32

type SSAValueSet

type SSAValueSet struct {
	*immutable.Map
}

func MakeSSASet

func MakeSSASet(vs ...ssa.Value) SSAValueSet

func (SSAValueSet) Add

func (s SSAValueSet) Add(v ssa.Value) SSAValueSet

func (SSAValueSet) Contains

func (s SSAValueSet) Contains(v ssa.Value) bool

func (SSAValueSet) Empty

func (s SSAValueSet) Empty() bool

func (SSAValueSet) Entries

func (s SSAValueSet) Entries() []ssa.Value

func (SSAValueSet) ForEach

func (s SSAValueSet) ForEach(do func(ssa.Value))

func (SSAValueSet) Join

func (s1 SSAValueSet) Join(s2 SSAValueSet) SSAValueSet

func (SSAValueSet) Meet

func (s1 SSAValueSet) Meet(s2 SSAValueSet) SSAValueSet

func (SSAValueSet) Size

func (s SSAValueSet) Size() int

func (SSAValueSet) String

func (s SSAValueSet) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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