Skip to content

Commit 49600c1

Browse files
committed
C++: Add comments.
1 parent ff0f892 commit 49600c1

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

  • cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaImpl.qll

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,15 +1446,31 @@ module Public {
14461446
not def instanceof PhiNode
14471447
}
14481448

1449+
/**
1450+
* The `getAnUltimateDefinition` predicate uses an optimized step relation
1451+
* which is pruned to only those uncertain steps which lead back to a
1452+
* definition which satisfies `relevantUltimateDefinition`. This predicate
1453+
* computes the subset of `Definition`s which can lead back to definitions
1454+
* which satisfy `relevantUltimateDefinition`.
1455+
*/
14491456
private predicate fwd(Definition def) {
1457+
// Base case: This definition is a relevant definition
14501458
relevantUltimateDefinition(def)
14511459
or
14521460
exists(Definition def0 |
1461+
// Recursive case: `def0` is a relevant definition, and
1462+
// `def` is an uncertain step which takes us back to `def0`.
14531463
fwd(def0) and
14541464
def0 = getAPhiInputOrPriorDefinition(def)
14551465
)
14561466
}
14571467

1468+
/**
1469+
* Holds if `def1 = getAPhiInputOrPriorDefinition(def2)`, and
1470+
* both `def1` and `def2` are part of a sequence of uncertain
1471+
* steps which lead back to a `Definition` which
1472+
* satisfies `relevantUltimateDefinition`.
1473+
*/
14581474
private predicate step(Definition def1, Definition def2) {
14591475
fwd(def1) and
14601476
fwd(def2) and

0 commit comments

Comments
 (0)