Skip to content

Commit 3ba8799

Browse files
committed
PS: Unhide some dataflow nodes to make paths more explicit.
1 parent 95926cb commit 3ba8799

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

powershell/ql/lib/semmle/code/powershell/dataflow/internal/DataFlowPrivate.qll

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,11 @@ predicate nodeIsHidden(Node n) { n.(NodeImpl).nodeIsHidden() }
428428
* Holds if `n` should never be skipped over in the `PathGraph` and in path
429429
* explanations.
430430
*/
431-
predicate neverSkipInPathGraph(Node n) { isReturned(n.(AstNode).getCfgNode()) }
431+
predicate neverSkipInPathGraph(Node n) {
432+
isReturned(n.(AstNode).getCfgNode())
433+
or
434+
n = any(SsaDefinitionNodeImpl def | not def.nodeIsHidden())
435+
}
432436

433437
/** An SSA node. */
434438
class SsaNode extends NodeImpl, TSsaNode {
@@ -439,9 +443,6 @@ class SsaNode extends NodeImpl, TSsaNode {
439443
/** Gets the underlying variable. */
440444
Variable getVariable() { result = node.getSourceVariable() }
441445

442-
/** Holds if this node should be hidden from path explanations. */
443-
predicate isHidden() { any() }
444-
445446
override CfgScope getCfgScope() { result = node.getBasicBlock().getScope() }
446447

447448
override Location getLocationImpl() { result = node.getLocation() }
@@ -454,7 +455,7 @@ class SsaDefinitionNodeImpl extends SsaNode {
454455

455456
Ssa::Definition getDefinition() { result = node.getDefinition() }
456457

457-
override predicate isHidden() {
458+
override predicate nodeIsHidden() {
458459
exists(SsaImpl::Definition def | def = this.getDefinition() |
459460
not def instanceof Ssa::WriteDefinition
460461
or

0 commit comments

Comments
 (0)