Package it.unive.lisa.analysis.symbols
Class SymbolAliasing
- java.lang.Object
-
- it.unive.lisa.analysis.lattices.FunctionalLattice<SymbolAliasing,Symbol,Aliases>
-
- it.unive.lisa.analysis.symbols.SymbolAliasing
-
- All Implemented Interfaces:
BaseLattice<SymbolAliasing>
,Lattice<SymbolAliasing>
,StructuredObject
,java.lang.Iterable<java.util.Map.Entry<Symbol,Aliases>>
public class SymbolAliasing extends FunctionalLattice<SymbolAliasing,Symbol,Aliases>
AFunctionalLattice
mappingSymbol
s toAliases
, that is, sets of symbols. Instances of this domain can be used to resolve targets of calls when the names used in the call are different from the ones in the target's signature. This lattice is designed to be stored within the analysis'FixpointInfo
instance, using key "sym-aliasing" (from fieldINFO_KEY
).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class it.unive.lisa.analysis.lattices.FunctionalLattice
FunctionalLattice.FunctionalLift<V extends Lattice<V>>, FunctionalLattice.KeyFunctionalLift<K>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
INFO_KEY
The key to use for accessing instances of this class within aFixpointInfo
instance.-
Fields inherited from class it.unive.lisa.analysis.lattices.FunctionalLattice
function, lattice
-
Fields inherited from interface it.unive.lisa.analysis.Lattice
BOTTOM_STRING, TOP_STRING
-
-
Constructor Summary
Constructors Constructor Description SymbolAliasing()
Builds an empty map of aliases.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SymbolAliasing
alias(Symbol toAlias, Symbol alias)
Registers an alias for the given symbol.SymbolAliasing
bottom()
Yields the bottom element of this lattice.SymbolAliasing
mk(Aliases lattice, java.util.Map<Symbol,Aliases> function)
Builds a instance of this class from the given lattice instance and the given mapping.SymbolAliasing
putState(Symbol toAlias, Symbol alias)
Registers an alias for the given symbol.Aliases
stateOfUnknown(Symbol key)
Yields the value that should be returned byFunctionalLattice.getState(Object)
whenever the given key is not present in this map.SymbolAliasing
top()
Yields the top element of this lattice.-
Methods inherited from class it.unive.lisa.analysis.lattices.FunctionalLattice
equals, functionalLift, getKeys, getMap, getOtDefault, getState, getValues, glbAux, glbKeys, hashCode, isBottom, isTop, iterator, lessOrEqualAux, lubAux, lubKeys, mkNewFunction, narrowingAux, putState, representation, toString, wideningAux
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface it.unive.lisa.analysis.BaseLattice
glb, lessOrEqual, lub, narrowing, widening
-
-
-
-
Field Detail
-
INFO_KEY
public static final java.lang.String INFO_KEY
The key to use for accessing instances of this class within aFixpointInfo
instance.- See Also:
- Constant Field Values
-
-
Method Detail
-
putState
public SymbolAliasing putState(Symbol toAlias, Symbol alias)
Registers an alias for the given symbol. Any previous aliases will be deleted.- Parameters:
toAlias
- the symbol being aliasedalias
- the alias fortoAlias
- Returns:
- a copy of this domain, with the new alias
-
top
public SymbolAliasing top()
Description copied from interface:Lattice
Yields the top element of this lattice. The returned element should be unique across different calls to this method, sinceLattice.isTop()
uses reference equality by default. If the value returned by this method is not a singleton, overrideLattice.isTop()
accordingly to provide a coherent test.- Returns:
- the top element
-
bottom
public SymbolAliasing bottom()
Description copied from interface:Lattice
Yields the bottom element of this lattice. The returned element should be unique across different calls to this method, sinceLattice.isBottom()
uses reference equality by default. If the value returned by this method is not a singleton, overrideLattice.isBottom()
accordingly to provide a coherent test.- Returns:
- the bottom element
-
mk
public SymbolAliasing mk(Aliases lattice, java.util.Map<Symbol,Aliases> function)
Description copied from class:FunctionalLattice
Builds a instance of this class from the given lattice instance and the given mapping.- Specified by:
mk
in classFunctionalLattice<SymbolAliasing,Symbol,Aliases>
- Parameters:
lattice
- an instance of lattice to be used during semantic operations to retrieve top and bottom valuesfunction
- the function representing the mapping contained in the new environment; can benull
- Returns:
- a new instance of this class
-
stateOfUnknown
public Aliases stateOfUnknown(Symbol key)
Description copied from class:FunctionalLattice
Yields the value that should be returned byFunctionalLattice.getState(Object)
whenever the given key is not present in this map.- Specified by:
stateOfUnknown
in classFunctionalLattice<SymbolAliasing,Symbol,Aliases>
- Parameters:
key
- the key that is missing- Returns:
- the lattice element for keys not in the mapping
-
alias
public SymbolAliasing alias(Symbol toAlias, Symbol alias)
Registers an alias for the given symbol. Any previous aliases will be deleted.- Parameters:
toAlias
- the symbol being aliasedalias
- the alias fortoAlias
- Returns:
- a copy of this analysis state, with the new alias
-
-