Skip to content

Commit 35843f8

Browse files
committed
temp2
1 parent 543fa8f commit 35843f8

File tree

4 files changed

+202
-56
lines changed

4 files changed

+202
-56
lines changed

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,55 @@ private module Cached {
14121412
next.getLocation().getStartLine() = 43
14131413
}
14141414

1415+
private predicate testadjacentDefReadReachesExclPhiRead(
1416+
DefinitionExtImpl def, ControlFlow::BasicBlock bb1, int i1, ControlFlow::BasicBlock bb2, int i2
1417+
) {
1418+
adjacentDefReadReachesExclPhiRead(def, bb1, i1, bb2, i2) and
1419+
def.getLocation().getStartLine() = 78
1420+
}
1421+
1422+
private predicate testphilastRefRedefExt(
1423+
DefinitionExtImpl def, ControlFlow::BasicBlock bb1, int i1, PhiReadNodeImpl phi,
1424+
ControlFlow::BasicBlock bb2, int i2
1425+
) {
1426+
philastRefRedefExt(def, bb1, i1, phi, bb2, i2)
1427+
}
1428+
1429+
private predicate testadjacentDefReadExt(
1430+
PhiReadNodeImpl def, ControlFlow::BasicBlock bb1, int i1, ControlFlow::BasicBlock bb2, int i2
1431+
) {
1432+
adjacentDefReadExt(def, bb1, i1, bb2, i2)
1433+
}
1434+
1435+
private predicate testlastRef(Ssa::Definition def, ControlFlow::BasicBlock bb, int i) {
1436+
lastRef(def, bb, i) and
1437+
def.getLocation().getStartLine() = 78
1438+
}
1439+
1440+
private predicate testvarBlockReachesExit(Ssa::Definition def, ControlFlow::BasicBlock bb) {
1441+
varBlockReachesExit(def, bb) and
1442+
def.getLocation().getStartLine() = 62
1443+
}
1444+
1445+
private predicate testvarBlockReaches(
1446+
Ssa::Definition def, ControlFlow::BasicBlock bb, ControlFlow::BasicBlock bb2
1447+
) {
1448+
varBlockReaches(def, bb, bb2) and
1449+
def.getLocation().getStartLine() = 78
1450+
// def.toString() = "SSA param(x)"
1451+
}
1452+
1453+
private predicate testvarBlockReachesExt(
1454+
Ssa::Definition def, ControlFlow::BasicBlock bb, ControlFlow::BasicBlock bb2
1455+
) {
1456+
varBlockReachesExt(def, bb, bb2) and
1457+
def.getLocation().getStartLine() = 78
1458+
// def.toString() = "SSA param(x)"
1459+
}
1460+
1461+
private predicate sdf(Ssa::Definition def) { def.toString() = "SSA param(x)" }
1462+
1463+
// private predicate testphiReadStepRev = phiReadStepRev/6;
14151464
cached
14161465
predicate lastReadSameVar(Definition def, ControlFlow::Node cfn) {
14171466
exists(ControlFlow::BasicBlock bb, int i |

csharp/ql/test/library-tests/dataflow/ssa/ReadAdjacentRead.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
| DefUse.cs:97:13:97:14 | x5 | DefUse.cs:98:16:98:17 | access to local variable x5 | DefUse.cs:104:9:104:10 | access to local variable x5 |
1919
| DefUse.cs:97:13:97:14 | x5 | DefUse.cs:100:17:100:18 | access to local variable x5 | DefUse.cs:101:18:101:19 | access to local variable x5 |
2020
| DefUse.cs:122:16:122:21 | Field2 | DefUse.cs:64:13:64:18 | access to field Field2 | DefUse.cs:80:37:80:42 | access to field Field2 |
21+
| DefUse.cs:122:16:122:21 | Field2 | DefUse.cs:80:37:80:42 | access to field Field2 | DefUse.cs:80:37:80:42 | access to field Field2 |
2122
| DefUse.cs:144:22:144:22 | x | DefUse.cs:146:17:146:17 | access to local variable x | DefUse.cs:147:17:147:17 | access to local variable x |
2223
| DefUse.cs:152:9:152:14 | Field4 | DefUse.cs:156:13:156:18 | access to field Field4 | DefUse.cs:157:13:157:18 | access to field Field4 |
2324
| DefUse.cs:152:9:152:14 | Field4 | DefUse.cs:162:13:162:18 | access to field Field4 | DefUse.cs:163:13:163:18 | access to field Field4 |

csharp/ql/test/library-tests/dataflow/ssa/SsaDefLastRead.expected

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
| DefUse.cs:59:13:59:13 | i | DefUse.cs:75:9:75:13 | SSA def(i) | DefUse.cs:76:9:76:9 | access to local variable i |
9494
| DefUse.cs:59:13:59:13 | i | DefUse.cs:76:9:76:11 | SSA def(i) | DefUse.cs:77:13:77:13 | access to local variable i |
9595
| DefUse.cs:63:9:63:14 | this.Field2 | DefUse.cs:63:9:63:18 | SSA def(this.Field2) | DefUse.cs:64:13:64:18 | access to field Field2 |
96-
| DefUse.cs:63:9:63:14 | this.Field2 | DefUse.cs:63:9:63:18 | SSA def(this.Field2) | DefUse.cs:80:37:80:42 | access to field Field2 |
9796
| DefUse.cs:66:9:66:14 | this.Field3 | DefUse.cs:66:9:66:18 | SSA def(this.Field3) | DefUse.cs:69:13:69:18 | access to field Field3 |
9897
| DefUse.cs:67:19:67:20 | tc | DefUse.cs:67:19:67:27 | SSA def(tc) | DefUse.cs:68:9:68:10 | access to local variable tc |
9998
| DefUse.cs:79:13:79:14 | x1 | DefUse.cs:80:30:80:31 | SSA def(x1) | DefUse.cs:81:13:81:14 | access to local variable x1 |
@@ -150,7 +149,6 @@
150149
| Fields.cs:33:19:33:22 | Fields.stat | Fields.cs:34:9:34:16 | SSA call def(Fields.stat) | Fields.cs:37:13:37:16 | access to field stat |
151150
| Fields.cs:33:19:33:22 | Fields.stat | Fields.cs:38:9:38:13 | SSA call def(Fields.stat) | Fields.cs:41:13:41:16 | access to field stat |
152151
| Fields.cs:33:19:33:22 | Fields.stat | Fields.cs:51:9:51:20 | SSA call def(Fields.stat) | Fields.cs:54:13:54:16 | access to field stat |
153-
| Fields.cs:65:24:65:32 | this.LoopField | Fields.cs:61:17:61:17 | SSA entry def(this.LoopField) | Fields.cs:65:24:65:32 | access to field LoopField |
154152
| Fields.cs:71:17:71:35 | this.SingleAccessedField | Fields.cs:61:17:61:17 | SSA entry def(this.SingleAccessedField) | Fields.cs:71:17:71:35 | access to field SingleAccessedField |
155153
| Fields.cs:76:20:76:38 | this.SingleAccessedField | Fields.cs:74:17:74:17 | SSA entry def(this.SingleAccessedField) | Fields.cs:76:20:76:38 | access to field SingleAccessedField |
156154
| Fields.cs:77:13:77:13 | f | Fields.cs:77:13:77:45 | SSA def(f) | Fields.cs:90:19:90:19 | access to local variable f |
@@ -220,7 +218,6 @@
220218
| Properties.cs:33:19:33:22 | Properties.stat | Properties.cs:38:9:38:13 | SSA call def(Properties.stat) | Properties.cs:41:13:41:16 | access to property stat |
221219
| Properties.cs:33:19:33:22 | Properties.stat | Properties.cs:51:9:51:24 | SSA call def(Properties.stat) | Properties.cs:54:13:54:16 | access to property stat |
222220
| Properties.cs:61:23:61:23 | i | Properties.cs:63:16:63:16 | SSA phi(i) | Properties.cs:63:16:63:16 | access to parameter i |
223-
| Properties.cs:65:24:65:31 | this.LoopProp | Properties.cs:61:17:61:17 | SSA entry def(this.LoopProp) | Properties.cs:65:24:65:31 | access to property LoopProp |
224221
| Properties.cs:67:21:67:38 | this.SingleAccessedProp | Properties.cs:61:17:61:17 | SSA entry def(this.SingleAccessedProp) | Properties.cs:67:21:67:38 | access to property SingleAccessedProp |
225222
| Properties.cs:72:20:72:37 | this.SingleAccessedProp | Properties.cs:70:17:70:17 | SSA entry def(this.SingleAccessedProp) | Properties.cs:72:20:72:37 | access to property SingleAccessedProp |
226223
| Properties.cs:73:13:73:13 | f | Properties.cs:73:13:73:32 | SSA def(f) | Properties.cs:86:19:86:19 | access to local variable f |
@@ -277,8 +274,6 @@
277274
| Test.cs:76:51:76:52 | b4 | Test.cs:76:51:76:52 | SSA param(b4) | Test.cs:94:18:94:19 | access to parameter b4 |
278275
| Test.cs:76:60:76:61 | b5 | Test.cs:76:60:76:61 | SSA param(b5) | Test.cs:102:13:102:14 | access to parameter b5 |
279276
| Test.cs:76:69:76:70 | b6 | Test.cs:76:69:76:70 | SSA param(b6) | Test.cs:113:13:113:14 | access to parameter b6 |
280-
| Test.cs:78:13:78:13 | x | Test.cs:78:13:78:17 | SSA def(x) | Test.cs:99:13:99:13 | access to local variable x |
281-
| Test.cs:78:13:78:13 | x | Test.cs:78:13:78:17 | SSA def(x) | Test.cs:104:17:104:17 | access to local variable x |
282277
| Test.cs:78:13:78:13 | x | Test.cs:108:13:108:17 | SSA def(x) | Test.cs:109:17:109:17 | access to local variable x |
283278
| Test.cs:78:13:78:13 | x | Test.cs:113:9:116:9 | SSA phi(x) | Test.cs:115:17:115:17 | access to local variable x |
284279
| Tuples.cs:10:14:10:14 | x | Tuples.cs:10:9:10:54 | SSA def(x) | Tuples.cs:11:13:11:13 | access to local variable x |

0 commit comments

Comments
 (0)