Skip to content

Commit edec76a

Browse files
authored
Merge pull request #20370 from MathiasVP/source-bounded-fast-tc-in-typetracking
Shared: Use `sourceBoundedFastTC` in TypeTracking
2 parents d39263d + 5a9b562 commit edec76a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

shared/typetracking/codeql/typetracking/internal/TypeTrackingImpl.qll

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ module TypeTracking<LocationSig Location, TypeTrackingInput<Location> I> {
7070

7171
private class ContentOption = ContentOption::Option;
7272

73+
private predicate isLocalSourceNode(LocalSourceNode n) {
74+
not nonStandardFlowsTo(_, _) and exists(n)
75+
}
76+
7377
cached
7478
private module Cached {
7579
cached
@@ -249,21 +253,9 @@ module TypeTracking<LocationSig Location, TypeTrackingInput<Location> I> {
249253
returnStep(nodeFrom, nodeTo) and summary = ReturnStep()
250254
}
251255

252-
pragma[inline]
253-
private predicate isLocalSourceNode(LocalSourceNode n) { any() }
254-
255256
cached
256-
predicate standardFlowsTo(Node localSource, Node dst) {
257-
not nonStandardFlowsTo(_, _) and
258-
// explicit type check in base case to avoid repeated type tests in recursive case
259-
isLocalSourceNode(localSource) and
260-
dst = localSource
261-
or
262-
exists(Node mid |
263-
standardFlowsTo(localSource, mid) and
264-
simpleLocalSmallStep(mid, dst)
265-
)
266-
}
257+
predicate simpleLocalSmallStepPlus(Node localSource, Node dst) =
258+
sourceBoundedFastTC(simpleLocalSmallStep/2, isLocalSourceNode/1)(localSource, dst)
267259

268260
cached
269261
predicate stepNoCall(LocalSourceNode nodeFrom, LocalSourceNode nodeTo, StepSummary summary) {
@@ -276,6 +268,14 @@ module TypeTracking<LocationSig Location, TypeTrackingInput<Location> I> {
276268
}
277269
}
278270

271+
pragma[inline]
272+
private predicate standardFlowsTo(Node localSource, Node dst) {
273+
isLocalSourceNode(localSource) and
274+
dst = localSource
275+
or
276+
simpleLocalSmallStepPlus(localSource, dst)
277+
}
278+
279279
import Cached
280280

281281
/**

0 commit comments

Comments
 (0)