Skip to content

Commit c5d0e2f

Browse files
committed
C#/Ruby: Replace cached with nomagic for deprecated predicates.
1 parent 0b52709 commit c5d0e2f

File tree

2 files changed

+23
-23
lines changed
  • csharp/ql/lib/semmle/code/csharp/dataflow/internal
  • ruby/ql/lib/codeql/ruby/dataflow/internal

2 files changed

+23
-23
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,15 @@ deprecated private predicate lastRefSkipUncertainReads(
794794
)
795795
}
796796

797+
pragma[nomagic]
798+
deprecated predicate lastReadSameVar(Definition def, ControlFlow::Node cfn) {
799+
exists(ControlFlow::BasicBlock bb, int i |
800+
lastRefSkipUncertainReads(def, bb, i) and
801+
variableReadActual(bb, i, _) and
802+
cfn = bb.getNode(i)
803+
)
804+
}
805+
797806
cached
798807
private module Cached {
799808
cached
@@ -957,15 +966,6 @@ private module Cached {
957966
)
958967
}
959968

960-
cached
961-
deprecated predicate lastReadSameVar(Definition def, ControlFlow::Node cfn) {
962-
exists(ControlFlow::BasicBlock bb, int i |
963-
lastRefSkipUncertainReads(def, bb, i) and
964-
variableReadActual(bb, i, _) and
965-
cfn = bb.getNode(i)
966-
)
967-
}
968-
969969
cached
970970
Definition uncertainWriteDefinitionInput(UncertainWriteDefinition def) {
971971
Impl::uncertainWriteDefinitionInput(def, result)

ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImpl.qll

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,20 @@ deprecated private predicate lastRefSkipUncertainReadsExt(
302302
)
303303
}
304304

305+
/**
306+
* Holds if the read of `def` at `read` may be a last read. That is, `read`
307+
* can either reach another definition of the underlying source variable or
308+
* the end of the CFG scope, without passing through another non-pseudo read.
309+
*/
310+
pragma[nomagic]
311+
deprecated predicate lastRead(Definition def, VariableReadAccessCfgNode read) {
312+
exists(Cfg::BasicBlock bb, int i |
313+
lastRefSkipUncertainReadsExt(def, bb, i) and
314+
variableReadActual(bb, i, _) and
315+
read = bb.getNode(i)
316+
)
317+
}
318+
305319
cached
306320
private module Cached {
307321
/**
@@ -401,20 +415,6 @@ private module Cached {
401415
)
402416
}
403417

404-
/**
405-
* Holds if the read of `def` at `read` may be a last read. That is, `read`
406-
* can either reach another definition of the underlying source variable or
407-
* the end of the CFG scope, without passing through another non-pseudo read.
408-
*/
409-
cached
410-
deprecated predicate lastRead(Definition def, VariableReadAccessCfgNode read) {
411-
exists(Cfg::BasicBlock bb, int i |
412-
lastRefSkipUncertainReadsExt(def, bb, i) and
413-
variableReadActual(bb, i, _) and
414-
read = bb.getNode(i)
415-
)
416-
}
417-
418418
cached
419419
Definition uncertainWriteDefinitionInput(UncertainWriteDefinition def) {
420420
Impl::uncertainWriteDefinitionInput(def, result)

0 commit comments

Comments
 (0)