Module SuccSplits
Provides a predicate for the successor relation with split information,
as well as logic used to construct the type TSplits representing sets
of splits. Only sets of splits that can be reached are constructed, hence
the predicates are mutually recursive.
For the successor relation
succSplits(ControlFlowElement pred, Splits predSplits, ControlFlowElement succ, Splits succSplits, Completion c)
the following invariants are maintained:
predis reachable with split setpredSplits.- For all
splitinpredSplits:- If
split.hasSuccessor(pred, succ, c)thensplitinsuccSplits.
- If
- For all
splitinpredSplits:- If
split.hasExit(pred, succ, c)and notsplit.hasEntry(pred, succ, c)thensplitnot insuccSplits.
- If
- For all
splitwith kind not inpredSplits:- If
split.hasEntry(pred, succ, c)thensplitinsuccSplits.
- If
- For all
splitinsuccSplits:split.hasSuccessor(pred, succ, c)andsplitinpredSplits, orsplit.hasEntry(pred, succ, c).
The algorithm divides into four cases:
- The set of splits for the successor is the same as the set of splits
for the predecessor:
a) The successor is in the same
SameSplitsBlockas the predecessor. b) The successor is not in the sameSameSplitsBlockas the predecessor. - The set of splits for the successor is different from the set of splits for the predecessor: a) The set of splits for the successor is maybe non-empty. b) The set of splits for the successor is always empty.
Only case 2a may introduce new sets of splits, so only predicates from
this case are used in the definition of TSplits.
The predicates in this module are named after the cases above.
Import path
import codeql.ruby.controlflow.internal.ControlFlowGraphImplSharedPredicates
| case2aFromRank | Case 2a. |
| case2aSomeAtRank | Gets a split that should be in |
| succSplits | Holds if |