Skip to content

Commit 1f89b49

Browse files
committed
C++: Rename 'valueFlow' to 'conversionFlow' and add a QLDoc that explains its purpose.
1 parent dfbfbe4 commit 1f89b49

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,13 @@ private module Cached {
361361
bb.getInstruction(i1) = write and
362362
bb.getInstruction(i2) = op.getUse() and
363363
// Flow to an instruction that occurs later in the block.
364-
valueFlow*(nodeFrom.getInstruction(), op.getDef()) and
364+
conversionFlow*(nodeFrom.getInstruction(), op.getDef()) and
365365
nodeTo.asOperand() = op and
366366
i2 > i1 and
367367
// There is no previous instruction that also occurs after `nodeFrom`.
368368
not exists(Instruction instr, int i |
369369
bb.getInstruction(i) = instr and
370-
valueFlow(instr, op.getDef()) and
370+
conversionFlow(instr, op.getDef()) and
371371
i1 < i and
372372
i < i2
373373
)
@@ -450,7 +450,14 @@ private module Cached {
450450
)
451451
}
452452

453-
private predicate valueFlow(Instruction iFrom, Instruction iTo) {
453+
/**
454+
* Holds if `iTo` is a conversion-like instruction that copies
455+
* the value computed by `iFrom`.
456+
*
457+
* This predicate is used by `fromStoreNode` to find the next use of a pointer that
458+
* points to freshly allocated memory.
459+
*/
460+
private predicate conversionFlow(Instruction iFrom, Instruction iTo) {
454461
iTo.(CopyValueInstruction).getSourceValue() = iFrom
455462
or
456463
iTo.(ConvertInstruction).getUnary() = iFrom

0 commit comments

Comments
 (0)