Skip to content

Commit 17ae747

Browse files
committed
C#: Switch use-use predicates to new implementation.
1 parent ed40035 commit 17ae747

File tree

1 file changed

+8
-7
lines changed
  • csharp/ql/lib/semmle/code/csharp/dataflow/internal

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -933,10 +933,8 @@ private module Cached {
933933
*/
934934
cached
935935
predicate firstReadSameVar(Definition def, ControlFlow::Node cfn) {
936-
exists(ControlFlow::BasicBlock bb1, int i1, ControlFlow::BasicBlock bb2, int i2 |
937-
def.definesAt(_, bb1, i1) and
938-
adjacentDefSkipUncertainReads(def, bb1, i1, bb2, i2) and
939-
cfn = bb2.getNode(i2)
936+
exists(ControlFlow::BasicBlock bb, int i |
937+
Impl::firstUse(def, bb, i, true) and cfn = bb.getNode(i)
940938
)
941939
}
942940

@@ -947,10 +945,13 @@ private module Cached {
947945
*/
948946
cached
949947
predicate adjacentReadPairSameVar(Definition def, ControlFlow::Node cfn1, ControlFlow::Node cfn2) {
950-
exists(ControlFlow::BasicBlock bb1, int i1, ControlFlow::BasicBlock bb2, int i2 |
948+
exists(
949+
ControlFlow::BasicBlock bb1, int i1, ControlFlow::BasicBlock bb2, int i2,
950+
Ssa::SourceVariable v
951+
|
952+
Impl::ssaDefReachesRead(v, def, bb1, i1) and
953+
Impl::adjacentUseUse(bb1, i1, bb2, i2, v, true) and
951954
cfn1 = bb1.getNode(i1) and
952-
variableReadActual(bb1, i1, def.getSourceVariable()) and
953-
adjacentDefSkipUncertainReads(def, bb1, i1, bb2, i2) and
954955
cfn2 = bb2.getNode(i2)
955956
)
956957
}

0 commit comments

Comments
 (0)