@@ -145,6 +145,17 @@ private Condition getADirectCondition(BasicBlock b) {
145
145
result .( LogicalCondition ) .getCondition ( ) .controls ( b , result .( LogicalCondition ) .getTruthValue ( ) )
146
146
}
147
147
148
+ /**
149
+ * Like the shared dataflow library, the reachability analysis is split into two stages:
150
+ * In the first stage, we compute an overapproximation of the possible control-flow paths where we don't
151
+ * reason about path conditions. This stage is split into phases: A forward phase (computed by the
152
+ * predicates prefixes with `fwd`), and a reverse phase (computed by the predicates prefixed with `rev`).
153
+ *
154
+ * The forward phease computes the set of control-flow nodes reachable from a given `source` and `v` such
155
+ * that `config.isSource(source, v)` holds.
156
+ *
157
+ * See the QLDoc on `revBbSuccessorEntryReaches0` for a description of what the reverse phase computes.
158
+ */
148
159
private predicate fwdBbSuccessorEntryReaches0 (
149
160
ControlFlowNode source , BasicBlock bb , SemanticStackVariable v ,
150
161
boolean skipsFirstLoopAlwaysTrueUponEntry , StackVariableReachability config
@@ -162,6 +173,10 @@ private predicate fwdBbSuccessorEntryReaches0(
162
173
)
163
174
}
164
175
176
+ /**
177
+ * The second phase of the first stages computes, for each `source` and `v` pair such
178
+ * that `config.isSource(source, v)`, which sinks are reachable from that `(source, v)` pair.
179
+ */
165
180
private predicate revBbSuccessorEntryReaches0 (
166
181
ControlFlowNode source , BasicBlock bb , SemanticStackVariable v ,
167
182
boolean skipsFirstLoopAlwaysTrueUponEntry , StackVariableReachability config
@@ -368,7 +383,9 @@ abstract class StackVariableReachability extends string {
368
383
}
369
384
370
385
/**
371
- * Holds if `cond` is a condition with a known truth value in `bb`.
386
+ * Gets a condition with a known truth value in `bb` when the control-flow starts at the source
387
+ * node `source` and we're tracking reachability using variable `v` (that is,
388
+ * `this.isSource(source, v)` holds).
372
389
*
373
390
* This predicate is `pragma[noopt]` as it seems difficult to get the correct join order for the
374
391
* recursive case otherwise:
0 commit comments