Package daikon.suppress
Class NISuppressor
- Object
-
- NISuppressor
-
public class NISuppressor extends Object
Class that defines a suppressor invariant for use in non-instantiating suppressions. In non-instantiating suppressions, suppressor invariants are defined independent of specific variables. Instead, arguments are identified by their variable index in the suppressee.
-
-
Constructor Summary
Constructors Constructor Description NISuppressor(int v1_index, int v2_index, Class<? extends Invariant> cls)
Defines a binary suppressor.NISuppressor(int v1_index, Class<? extends Invariant> cls)
Defines a unary suppressor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NIS.SuppressState
check(PptTopLevel ppt, VarInfo[] vis, @Nullable Invariant inv)
Sets the status of this suppressor with regards to the specified vis and falsified invariant.void
clear_state()
clears the state of this suppressor to NIS.noneClass<? extends Invariant>
get_inv_class()
Returns the invariant class of this suppressor.boolean
instantiate_ok(VarInfo[] vis)
Returns whether or not this suppressor invariant could be instantiated over the specified variables.boolean
is_enabled()
Returns whether or not this suppressor is enabled.boolean
match(Invariant inv)
Returns true if inv matches this suppressor.boolean
match(NISuppressee sse)
Returns true if the suppressee matches this suppressor.boolean
match_true(Invariant inv)
Returns true if inv matches this suppressor and the invariant is not falsified.NISuppressor
swap()
Returns a new suppressor that is the same as this one except with its variables swapped.String
toString()
Returns a string representation of the suppressor.NISuppressor
translate(NISuppressor sor)
Returns a copy of this suppressor translated to match the variable order in sor.
-
-
-
Constructor Detail
-
NISuppressor
public NISuppressor(int v1_index, Class<? extends Invariant> cls)
Defines a unary suppressor.
-
NISuppressor
public NISuppressor(int v1_index, int v2_index, Class<? extends Invariant> cls)
Defines a binary suppressor.
-
-
Method Detail
-
swap
public NISuppressor swap()
Returns a new suppressor that is the same as this one except with its variables swapped. Unary suppressors have their variable index swapped from 0 to 1 or 1 to 0.
-
is_enabled
@Pure public boolean is_enabled()
Returns whether or not this suppressor is enabled. A suppressor is enabled if the invariant on which it depends is enabled.
-
instantiate_ok
public boolean instantiate_ok(VarInfo[] vis)
Returns whether or not this suppressor invariant could be instantiated over the specified variables. A suppressor that canot be instantiated over the variables cannot possibly suppress. Consider the NonZero invariant. It is suppressed by EqualsOne. But while NonZero is valid over all variables, EqualsOne is only valid over non-pointer variables. Thus the suppression is only valid over non-pointer variables.
-
check
public NIS.SuppressState check(PptTopLevel ppt, VarInfo[] vis, @Nullable Invariant inv)
Sets the status of this suppressor with regards to the specified vis and falsified invariant. The status consists of whether or not the suppressor is valid (true) and whether or not it matches the falsified invariant.Matching a suppressor is more complex than is apparent at first glance. The invariant AND its variables must match. Since suppressors are specified without variables, the variables are taken from the specified vis. The variable indices specify which variables to consider.
For example consider the suppressor {1, 2, IntLessEqual} and a vis of {x, y, z}. The suppressor is true if the IntLessEqual invariant exists in the slice {y, z}. This allows ternary invariants to specify exactly the suppressor required for their particular permutation ofarguments. Invariants that have an internal permute variable must match that as well.
- Parameters:
ppt
- the top level program pointvis
- the slice of the suppressee. Thus, if the suppressee is ternary, vis, should specify three variables.inv
- the falsified invariant. inv_match indicates whether or not inv matches this suppressor.- Returns:
- the state of this suppressor which is one of (NIS.SuppressState.MATCH, NIS.SuppressState.VALID, NIS.SuppressState.INVALID, NIS.SuppressState.NONSENSICAL)
-
match_true
public boolean match_true(Invariant inv)
Returns true if inv matches this suppressor and the invariant is not falsified.- See Also:
match(Invariant)
-
match
public boolean match(Invariant inv)
Returns true if inv matches this suppressor. It is assumed that inv's variables already match (i.e., that it was looked up in compatible slice).
-
match
public boolean match(NISuppressee sse)
Returns true if the suppressee matches this suppressor. Currently only checks that the class matches but this will need to be expanded to check for a permutation match as well.
-
translate
public NISuppressor translate(NISuppressor sor)
Returns a copy of this suppressor translated to match the variable order in sor.
-
get_inv_class
public Class<? extends Invariant> get_inv_class()
Returns the invariant class of this suppressor.
-
clear_state
public void clear_state()
clears the state of this suppressor to NIS.none
-
-