From 98289b52d6fbbcb84864e5b5896738cffe57a19b Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 29 Feb 2024 15:45:43 +0000 Subject: [PATCH] Shared: Explain SsaPhiNode a bit more. --- .../codeql/rangeanalysis/RangeAnalysis.qll | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/shared/rangeanalysis/codeql/rangeanalysis/RangeAnalysis.qll b/shared/rangeanalysis/codeql/rangeanalysis/RangeAnalysis.qll index feff3010864..97c4d2ac2f7 100644 --- a/shared/rangeanalysis/codeql/rangeanalysis/RangeAnalysis.qll +++ b/shared/rangeanalysis/codeql/rangeanalysis/RangeAnalysis.qll @@ -257,7 +257,18 @@ signature module Semantic { /** * A phi node in the SSA form. A phi node is a kind of node in the SSA form * that represents a merge point where multiple control flow paths converge - * and the value of a variable needs to be selected. + * and the value of a variable needs to be selected according to which + * control flow path was taken. For example, in the following Ruby code: + * ```rb + * if b + * x = 0 + * else + * x = 1 + * end + * puts x + * ``` + * A phi node for `x` is inserted just before the call `puts x`, since the + * value of `x` may come from either `x = 0` or `x = 1`. */ class SsaPhiNode extends SsaVariable { /** Holds if `inp` is an input to the phi node along the edge originating in `bb`. */