Skip to content

Commit 3cebf8b

Browse files
committed
PS: Also include parameter reads and writes as SSA reads and writes.
1 parent ec6422c commit 3cebf8b

File tree

1 file changed

+5
-5
lines changed
  • powershell/ql/lib/semmle/code/powershell/dataflow/internal

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module SsaInput implements SsaImplCommon::InputSig<Location> {
1919

2020
class ExitBasicBlock extends BasicBlock, BasicBlocks::ExitBasicBlock { }
2121

22-
class SourceVariable = LocalVariable;
22+
class SourceVariable = LocalScopeVariable;
2323

2424
/**
2525
* Holds if the statement at index `i` of basic block `bb` contains a write to variable `v`.
@@ -34,7 +34,7 @@ module SsaInput implements SsaImplCommon::InputSig<Location> {
3434
certain = true
3535
}
3636

37-
predicate variableRead(BasicBlock bb, int i, LocalVariable v, boolean certain) {
37+
predicate variableRead(BasicBlock bb, int i, SourceVariable v, boolean certain) {
3838
variableReadActual(bb, i, v) and
3939
certain = true
4040
}
@@ -59,7 +59,7 @@ predicate uninitializedWrite(Cfg::EntryBasicBlock bb, int i, LocalVariable v) {
5959
}
6060

6161
/** Holds if `v` is read at index `i` in basic block `bb`. */
62-
private predicate variableReadActual(Cfg::BasicBlock bb, int i, LocalVariable v) {
62+
private predicate variableReadActual(Cfg::BasicBlock bb, int i, LocalScopeVariable v) {
6363
exists(VarReadAccess read |
6464
read.getVariable() = v and
6565
read = bb.getNode(i).getAstNode()
@@ -152,7 +152,7 @@ private module Cached {
152152
*/
153153
cached
154154
predicate variableWriteActual(
155-
Cfg::BasicBlock bb, int i, LocalVariable v, VariableWriteAccessCfgNode write
155+
Cfg::BasicBlock bb, int i, LocalScopeVariable v, VarWriteAccessCfgNode write
156156
) {
157157
exists(Cfg::CfgNode n |
158158
write.getVariable() = v and
@@ -164,7 +164,7 @@ private module Cached {
164164

165165
cached
166166
VarReadAccessCfgNode getARead(Definition def) {
167-
exists(LocalVariable v, Cfg::BasicBlock bb, int i |
167+
exists(SsaInput::SourceVariable v, Cfg::BasicBlock bb, int i |
168168
Impl::ssaDefReachesRead(v, def, bb, i) and
169169
variableReadActual(bb, i, v) and
170170
result = bb.getNode(i)

0 commit comments

Comments
 (0)