Skip to content

Commit 98289b5

Browse files
committed
Shared: Explain SsaPhiNode a bit more.
1 parent 8151f30 commit 98289b5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

shared/rangeanalysis/codeql/rangeanalysis/RangeAnalysis.qll

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,18 @@ signature module Semantic {
257257
/**
258258
* A phi node in the SSA form. A phi node is a kind of node in the SSA form
259259
* that represents a merge point where multiple control flow paths converge
260-
* and the value of a variable needs to be selected.
260+
* and the value of a variable needs to be selected according to which
261+
* control flow path was taken. For example, in the following Ruby code:
262+
* ```rb
263+
* if b
264+
* x = 0
265+
* else
266+
* x = 1
267+
* end
268+
* puts x
269+
* ```
270+
* A phi node for `x` is inserted just before the call `puts x`, since the
271+
* value of `x` may come from either `x = 0` or `x = 1`.
261272
*/
262273
class SsaPhiNode extends SsaVariable {
263274
/** Holds if `inp` is an input to the phi node along the edge originating in `bb`. */

0 commit comments

Comments
 (0)