analysisutil

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package analysisutil contains utility functions for the analyses in argot. These functions are in an internal package because they are not important enough to be included in the main library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldAddrFieldInfo

func FieldAddrFieldInfo(fieldAddr *ssa.FieldAddr) (string, bool)

FieldAddrFieldInfo finds the name of a field access in ssa.FieldAddr if it cannot find a proper field name, returns "?". The boolean indicates whether this field is embedded or not.

func FieldFieldInfo

func FieldFieldInfo(fieldAddr *ssa.Field) (string, bool)

FieldFieldInfo finds the name of a field access in ssa.Field if it cannot find a proper field name, returns "?". The boolean indicates whether this field is embedded or not.

func FindEltTypePackage

func FindEltTypePackage(t types.Type, preform string) (string, string, error)

FindEltTypePackage finds the package declaring the elements of t or returns an error Returns a package name and the name of the type declared in that package. preform is the formatting of the type of the element; usually %s

func FindSafeCalleePkg

func FindSafeCalleePkg(n *ssa.CallCommon) fn.Optional[string]

FindSafeCalleePkg finds the packages of the callee in the ssa.CallCommon without panicking

func FindValuePackage

func FindValuePackage(n ssa.Value) fn.Optional[string]

FindValuePackage finds the package of n. Returns None if no package was found.

func GetFieldInfoFromType

func GetFieldInfoFromType(t types.Type, i int) (string, bool)

GetFieldInfoFromType returns the name of field i if t is a struct or pointer to a struct. The boolean indicates whether this field is embedded or not.

func IsEntrypointNode

func IsEntrypointNode(pointer *pointer.Result, n ssa.Node, f func(config.CodeIdentifier) bool) bool

IsEntrypointNode returns true if n is an entrypoint to the analysis according to f.

func IsExcluded

func IsExcluded(program *ssa.Program, f *ssa.Function, exclude []string) bool

IsExcluded scans the exclude slices to find out whether f is excluded

func MakeAbsolute

func MakeAbsolute(excludeRelative []string) []string

MakeAbsolute takes a slice of relative file paths and converts them to absolute paths. It prepends the current working directory to any non-absolute file paths.

excludeRelative is a slice of relative or absolute file paths to convert.

It returns a new slice containing the absolute paths. Any paths that were already absolute are passed through unchanged.

It returns an error if it cannot determine the current working directory. The result slice may have a different capacity and length than the input.

func ReceiverStr

func ReceiverStr(t types.Type) string

ReceiverStr returns the string receiver name of t. e.g. *repo/package.Method -> Method TODO refactor to avoid string operations

Types

This section is empty.

Jump to

Keyboard shortcuts

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