Skip to content

Commit 165dc0b

Browse files
committed
C#: Filter away phi (read) input steps from a node into itself
1 parent 75dd4c8 commit 165dc0b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ module LocalFlow {
335335
exists(ControlFlow::BasicBlock bb, int i |
336336
SsaImpl::lastRefBeforeRedefExt(def, bb, i, next.getDefinitionExt()) and
337337
def.definesAt(_, bb, i, _) and
338-
def = getSsaDefinitionExt(nodeFrom)
338+
def = getSsaDefinitionExt(nodeFrom) and
339+
nodeFrom != next
339340
)
340341
}
341342

@@ -414,7 +415,8 @@ module LocalFlow {
414415
) {
415416
exists(CIL::BasicBlock bb, int i | CilSsaImpl::lastRefBeforeRedefExt(def, bb, i, next) |
416417
def.definesAt(_, bb, i, _) and
417-
def = nodeFrom.(CilSsaDefinitionExtNode).getDefinition()
418+
def = nodeFrom.(CilSsaDefinitionExtNode).getDefinition() and
419+
def != next
418420
or
419421
nodeFrom = TCilExprNode(bb.getNode(i).(CIL::ReadAccess))
420422
)

0 commit comments

Comments
 (0)