Skip to content

Commit c6f89aa

Browse files
authored
Merge pull request #10141 from aschackmull/ruby/perf-apigraph
Ruby: Perf fix for trackUseNode.
2 parents d9c0780 + b83e851 commit c6f89aa

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

ruby/ql/lib/codeql/ruby/ApiGraphs.qll

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -606,11 +606,20 @@ module API {
606606
result = useCandRev() and
607607
t.start()
608608
or
609-
exists(TypeTracker t2, DataFlow::LocalSourceNode mid, TypeBackTracker tb |
609+
exists(TypeTracker t2, DataFlow::LocalSourceNode mid |
610610
mid = trackUseNode(src, t2) and
611-
result = mid.track(t2, t) and
612-
pragma[only_bind_out](result) = useCandRev(tb) and
613-
pragma[only_bind_out](t) = pragma[only_bind_out](tb).getACompatibleTypeTracker()
611+
result = useNodeStep(mid, t2, t)
612+
)
613+
}
614+
615+
pragma[nomagic]
616+
private DataFlow::Node useNodeStep(
617+
DataFlow::LocalSourceNode mid, TypeTracker tmid, TypeTracker t
618+
) {
619+
exists(TypeBackTracker tb |
620+
result = mid.track(tmid, t) and
621+
pragma[only_bind_into](result) = useCandRev(pragma[only_bind_into](tb)) and
622+
pragma[only_bind_out](t) = pragma[only_bind_into](tb).getACompatibleTypeTracker()
614623
)
615624
}
616625

0 commit comments

Comments
 (0)