Skip to content

Commit c695388

Browse files
authored
Merge pull request #7891 from hvitved/ruby/dataflow/hide-ssa-nodes
Ruby: Hide more SSA nodes from data-flow path explanations
2 parents 336c25d + 0bd8411 commit c695388

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,13 @@ import Cached
320320
/** Holds if `n` should be hidden from path explanations. */
321321
predicate nodeIsHidden(Node n) {
322322
exists(Ssa::Definition def | def = n.(SsaDefinitionNode).getDefinition() |
323-
def instanceof Ssa::PhiNode
323+
def instanceof Ssa::PhiNode or
324+
def instanceof Ssa::CapturedEntryDefinition or
325+
def instanceof Ssa::CapturedCallDefinition
324326
)
325327
or
328+
n = LocalFlow::getParameterDefNode(_)
329+
or
326330
isDesugarNode(n.(ExprNode).getExprNode().getExpr())
327331
or
328332
n instanceof SummaryNode

ruby/ql/test/library-tests/dataflow/array-flow/array-flow.expected

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -734,14 +734,12 @@ edges
734734
| array_flow.rb:399:10:399:10 | b [array element 2] : | array_flow.rb:399:10:399:13 | ...[...] |
735735
| array_flow.rb:403:16:403:25 | call to source : | array_flow.rb:404:18:404:18 | a [array element 2] : |
736736
| array_flow.rb:403:16:403:25 | call to source : | array_flow.rb:404:18:404:18 | a [array element 2] : |
737-
| array_flow.rb:404:9:406:7 | ... = ... : | array_flow.rb:404:9:406:7 | call to each : |
738-
| array_flow.rb:404:9:406:7 | ... = ... : | array_flow.rb:404:9:406:7 | call to each : |
737+
| array_flow.rb:404:9:406:7 | ... = ... : | array_flow.rb:407:10:407:10 | x |
738+
| array_flow.rb:404:9:406:7 | ... = ... : | array_flow.rb:407:10:407:10 | x |
739739
| array_flow.rb:404:9:406:7 | __synth__0__1 : | array_flow.rb:404:9:406:7 | ... = ... : |
740740
| array_flow.rb:404:9:406:7 | __synth__0__1 : | array_flow.rb:404:9:406:7 | ... = ... : |
741741
| array_flow.rb:404:9:406:7 | __synth__0__1 : | array_flow.rb:405:14:405:14 | x |
742742
| array_flow.rb:404:9:406:7 | __synth__0__1 : | array_flow.rb:405:14:405:14 | x |
743-
| array_flow.rb:404:9:406:7 | call to each : | array_flow.rb:407:10:407:10 | x |
744-
| array_flow.rb:404:9:406:7 | call to each : | array_flow.rb:407:10:407:10 | x |
745743
| array_flow.rb:404:18:404:18 | a [array element 2] : | array_flow.rb:404:9:406:7 | __synth__0__1 : |
746744
| array_flow.rb:404:18:404:18 | a [array element 2] : | array_flow.rb:404:9:406:7 | __synth__0__1 : |
747745
| array_flow.rb:404:18:404:18 | a [array element 2] : | array_flow.rb:408:10:408:10 | b [array element 2] : |
@@ -4225,8 +4223,6 @@ nodes
42254223
| array_flow.rb:404:9:406:7 | ... = ... : | semmle.label | ... = ... : |
42264224
| array_flow.rb:404:9:406:7 | __synth__0__1 : | semmle.label | __synth__0__1 : |
42274225
| array_flow.rb:404:9:406:7 | __synth__0__1 : | semmle.label | __synth__0__1 : |
4228-
| array_flow.rb:404:9:406:7 | call to each : | semmle.label | call to each : |
4229-
| array_flow.rb:404:9:406:7 | call to each : | semmle.label | call to each : |
42304226
| array_flow.rb:404:18:404:18 | a [array element 2] : | semmle.label | a [array element 2] : |
42314227
| array_flow.rb:404:18:404:18 | a [array element 2] : | semmle.label | a [array element 2] : |
42324228
| array_flow.rb:405:14:405:14 | x | semmle.label | x |

0 commit comments

Comments
 (0)