Skip to content

Commit 9f7eef0

Browse files
committed
C#: Address review comments
1 parent 21887d7 commit 9f7eef0

File tree

1 file changed

+11
-11
lines changed
  • csharp/ql/src/semmle/code/csharp/dataflow

1 file changed

+11
-11
lines changed

csharp/ql/src/semmle/code/csharp/dataflow/SSA.qll

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,10 @@ module Ssa {
319319
}
320320

321321
/**
322-
* Holds if source varible `v` is likely to be live at any node inside basic
323-
* block `bb`.
322+
* Holds if source variable `v` is likely to be live at any node inside basic
323+
* block `bb`. This is an overestimate.
324324
*/
325-
predicate likelyLive(BasicBlock bb, SourceVariable v) {
325+
predicate possiblyLiveAtAllNodes(BasicBlock bb, SourceVariable v) {
326326
liveAtExit(bb, v, _)
327327
or
328328
ref(bb, _, v, Read(_))
@@ -1203,7 +1203,7 @@ module Ssa {
12031203
* `i`.
12041204
*/
12051205
private predicate updateCandidate(BasicBlock bb, int i, TrackedFieldOrProp fp, Call call) {
1206-
likelyLive(bb, fp) and
1206+
possiblyLiveAtAllNodes(bb, fp) and
12071207
callAt(bb, i, call) and
12081208
relevantDefinition(_, fp.getAssignable(), _) and
12091209
not ref(bb, i, fp, _)
@@ -1296,7 +1296,7 @@ module Ssa {
12961296
setsOwnFieldOrPropTransitive(getARuntimeTarget(call), tfp.getAssignable(), setter)
12971297
}
12981298

1299-
private predicate updatesNamedFieldOrPropLikelyLive(BasicBlock bb, int i, TrackedFieldOrProp fp, Call call, Callable setter) {
1299+
private predicate updatesNamedFieldOrPropPossiblyLive(BasicBlock bb, int i, TrackedFieldOrProp fp, Call call, Callable setter) {
13001300
updateCandidate(bb, i, fp, call) and
13011301
(
13021302
updatesNamedFieldOrPropPart1(call, fp, setter)
@@ -1306,7 +1306,7 @@ module Ssa {
13061306
}
13071307

13081308
private int firstRefAfterCall(BasicBlock bb, int i, TrackedFieldOrProp fp) {
1309-
updatesNamedFieldOrPropLikelyLive(bb, i, fp, _, _) and
1309+
updatesNamedFieldOrPropPossiblyLive(bb, i, fp, _, _) and
13101310
result = min(int k | k > i and ref(bb, k, fp, _))
13111311
}
13121312

@@ -1318,7 +1318,7 @@ module Ssa {
13181318
predicate updatesNamedFieldOrProp(Call c, TrackedFieldOrProp fp, Callable setter) {
13191319
forceCachingInSameStage() and
13201320
exists(BasicBlock bb, int i |
1321-
updatesNamedFieldOrPropLikelyLive(bb, i, fp, c, setter) |
1321+
updatesNamedFieldOrPropPossiblyLive(bb, i, fp, c, setter) |
13221322
not exists(firstRefAfterCall(bb, i, fp)) and
13231323
liveAtExit(bb, fp, _)
13241324
or
@@ -1439,7 +1439,7 @@ module Ssa {
14391439
* `i`.
14401440
*/
14411441
private predicate updateCandidate(BasicBlock bb, int i, CapturedWrittenLocalScopeSourceVariable v, Call call) {
1442-
likelyLive(bb, v) and
1442+
possiblyLiveAtAllNodes(bb, v) and
14431443
callAt(bb, i, call) and
14441444
relevantDefinition(_, v.getAssignable(), _)
14451445
}
@@ -1522,7 +1522,7 @@ module Ssa {
15221522
* Holds if `call` may change the value of captured variable `v`. The actual
15231523
* update occurs in `def`.
15241524
*/
1525-
private predicate updatesCapturedVariableLikelyLive(BasicBlock bb, int i, Call call, LocalScopeSourceVariable v, AssignableDefinition def) {
1525+
private predicate updatesCapturedVariablePossiblyLive(BasicBlock bb, int i, Call call, LocalScopeSourceVariable v, AssignableDefinition def) {
15261526
updateCandidate(bb, i, v, call) and
15271527
exists(Callable writer |
15281528
relevantDefinition(writer, v.getAssignable(), def) |
@@ -1531,7 +1531,7 @@ module Ssa {
15311531
}
15321532

15331533
private int firstRefAfter(BasicBlock bb, int i, CapturedWrittenLocalScopeSourceVariable v) {
1534-
updatesCapturedVariableLikelyLive(bb, i, _, v, _) and
1534+
updatesCapturedVariablePossiblyLive(bb, i, _, v, _) and
15351535
result = min(int k | k > i and ref(bb, k, v, _))
15361536
}
15371537

@@ -1543,7 +1543,7 @@ module Ssa {
15431543
predicate updatesCapturedVariable(Call call, LocalScopeSourceVariable v, AssignableDefinition def) {
15441544
forceCachingInSameStage() and
15451545
exists(BasicBlock bb, int i |
1546-
updatesCapturedVariableLikelyLive(bb, i, call, v, def) |
1546+
updatesCapturedVariablePossiblyLive(bb, i, call, v, def) |
15471547
not exists(firstRefAfter(bb, i, v)) and
15481548
liveAtExit(bb, v, _)
15491549
or

0 commit comments

Comments
 (0)