location

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressableLocation

type AddressableLocation interface {
	Location
	// contains filtered or unexported methods
}

Tagging interface used to tag pointers that can be used to look up directly in the abstract memory. Used to exclude field addresses and the nil pointer from such lookups. Using a tagging interface like this lets the type system help us avoid mistakes.

type AllocationSiteLocation

type AllocationSiteLocation struct {
	Goro    utils.Hashable
	Context Context
	Site    ssa.Value
	// contains filtered or unexported fields
}

An allocation site location

func (AllocationSiteLocation) Equal

func (l AllocationSiteLocation) Equal(ol Location) bool

func (AllocationSiteLocation) GetSite

func (l AllocationSiteLocation) GetSite() (ssa.Value, bool)

func (AllocationSiteLocation) Hash

func (l AllocationSiteLocation) Hash() uint32

func (AllocationSiteLocation) Position

func (l AllocationSiteLocation) Position() string

func (AllocationSiteLocation) String

func (l AllocationSiteLocation) String() string

func (AllocationSiteLocation) Type

type Context

type Context = *ssa.Function

TODO: This type should be defined somewhere else with a suitable implementation TODO: We probably want more context

type FieldLocation

type FieldLocation struct {
	Base  Location
	Index int
}

Location of a field of a struct

func (FieldLocation) Equal

func (l FieldLocation) Equal(ol Location) bool

func (FieldLocation) GetSite

func (l FieldLocation) GetSite() (ssa.Value, bool)

func (FieldLocation) Hash

func (l FieldLocation) Hash() uint32

func (FieldLocation) NestingLevel

func (l FieldLocation) NestingLevel() (res int)

Returns the nesting level of a field location

func (FieldLocation) Position

func (l FieldLocation) Position() string

func (FieldLocation) String

func (l FieldLocation) String() string

func (FieldLocation) Type

func (l FieldLocation) Type() types.Type

type FunctionPointer

type FunctionPointer struct {
	Fun *ssa.Function
}

Function pointer contains an *ssa.Function. Used for function values that do not need closures. See absint.evaluateSSA comment.

func (FunctionPointer) Equal

func (fp FunctionPointer) Equal(ol Location) bool

func (FunctionPointer) GetSite

func (l FunctionPointer) GetSite() (ssa.Value, bool)

func (FunctionPointer) Hash

func (fp FunctionPointer) Hash() uint32

func (FunctionPointer) Position

func (fp FunctionPointer) Position() string

func (FunctionPointer) String

func (fp FunctionPointer) String() string

func (FunctionPointer) Type

func (l FunctionPointer) Type() types.Type

type GlobalLocation

type GlobalLocation struct {
	Site *ssa.Global
	// contains filtered or unexported fields
}

A location of a global variable

func (GlobalLocation) Equal

func (l GlobalLocation) Equal(ol Location) bool

func (GlobalLocation) GetSite

func (l GlobalLocation) GetSite() (ssa.Value, bool)

func (GlobalLocation) Hash

func (l GlobalLocation) Hash() uint32

func (GlobalLocation) Position

func (l GlobalLocation) Position() string

func (GlobalLocation) String

func (l GlobalLocation) String() string

func (GlobalLocation) Type

func (l GlobalLocation) Type() types.Type

type IndexLocation

type IndexLocation struct {
	Base Location
}

Location of an element in an array. The analysis does not discern between different elements of the array, so we don't need an index.

func (IndexLocation) Equal

func (l IndexLocation) Equal(ol Location) bool

func (IndexLocation) GetSite

func (l IndexLocation) GetSite() (ssa.Value, bool)

func (IndexLocation) Hash

func (l IndexLocation) Hash() uint32

func (IndexLocation) Position

func (l IndexLocation) Position() string

func (IndexLocation) String

func (l IndexLocation) String() string

func (IndexLocation) Type

func (l IndexLocation) Type() types.Type

type LocalLocation

type LocalLocation struct {
	Goro     utils.Hashable
	Context  Context
	Name     string // The name of the variable
	DeclLine int64  // The source line the variable was declared on (used to disambiguate multiple variables with the same name)
	// TODO: The debugger frontend can (currently) not supply the correct ssa.Value as the Site.
	// This messes up the Equal function when the abstract interpreter _can_ supply the correct Site
	// when reconstructing the LocalLocation.
	// If we need the Site member we can either: extend the debugger frontend, or, exclude the
	// Site field from the Equal-check.
	Site ssa.Value
	// contains filtered or unexported fields
}

A location of a local variable

func LocationFromSSAValue

func LocationFromSSAValue(g utils.Hashable, val ssa.Value) LocalLocation

func ReturnLocation

func ReturnLocation(g utils.Hashable, fun *ssa.Function) LocalLocation

func (LocalLocation) Equal

func (l LocalLocation) Equal(ol Location) bool

func (LocalLocation) GetSite

func (l LocalLocation) GetSite() (ssa.Value, bool)

func (LocalLocation) Hash

func (l LocalLocation) Hash() uint32

func (LocalLocation) Position

func (l LocalLocation) Position() string

func (LocalLocation) String

func (l LocalLocation) String() string

func (LocalLocation) Type

func (l LocalLocation) Type() types.Type

type Location

type Location interface {
	Hash() uint32
	Equal(Location) bool
	String() string
	GetSite() (site ssa.Value, ok bool)
	Type() types.Type
	Position() string
}

A location points to something (or nothing) in the abstract memory. It can be a concrete memory location, an allocation site, a global variable, or a field of a struct. TODO: Consider renaming to Pointer

type LocationHasher

type LocationHasher struct{}

LocationHasher needed for immutable.Map

func (LocationHasher) Equal

func (LocationHasher) Equal(a, b Location) bool

func (LocationHasher) Hash

func (LocationHasher) Hash(key Location) uint32

type NilLocation

type NilLocation struct{}

Represents the nil pointer.

func (NilLocation) Equal

func (n NilLocation) Equal(o Location) bool

func (NilLocation) GetSite

func (l NilLocation) GetSite() (ssa.Value, bool)

func (NilLocation) Hash

func (n NilLocation) Hash() uint32

func (NilLocation) Position

func (n NilLocation) Position() string

func (NilLocation) String

func (n NilLocation) String() string

func (NilLocation) Type

func (l NilLocation) Type() types.Type

Jump to

Keyboard shortcuts

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