Skip to content

Commit 224efd6

Browse files
Performance experiment - add getFunctionFIle for better join order
1 parent 4fc7d84 commit 224efd6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

python/ql/src/Functions/SignatureOverriddenMethod.ql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ predicate callMatchesSignature(Function func, Call call) {
192192
)
193193
}
194194

195+
pragma[nomagic]
196+
private File getFunctionFile(Function f) { result = f.getLocation().getFile() }
197+
195198
/** Gets a call which matches the signature of `base`, but not of overridden `sub`. */
196199
Call getASignatureMismatchWitness(Function base, Function sub) {
197200
callViableForEitherOverride(base, sub, result) and
@@ -214,17 +217,17 @@ Call chooseASignatureMismatchWitnessInFile(Function base, Function sub, File fil
214217
Call chooseASignatureMismatchWitness(Function base, Function sub) {
215218
exists(getASignatureMismatchWitness(base, sub)) and
216219
(
217-
result = chooseASignatureMismatchWitnessInFile(base, sub, base.getLocation().getFile())
220+
result = chooseASignatureMismatchWitnessInFile(base, sub, getFunctionFile(base))
218221
or
219222
not exists(Call c |
220223
c = getASignatureMismatchWitness(base, sub) and
221224
c.getLocation().getFile() = base.getLocation().getFile()
222225
) and
223-
result = chooseASignatureMismatchWitnessInFile(base, sub, sub.getLocation().getFile())
226+
result = chooseASignatureMismatchWitnessInFile(base, sub, getFunctionFile(sub))
224227
or
225228
not exists(Call c |
226229
c = getASignatureMismatchWitness(base, sub) and
227-
c.getLocation().getFile() = [base, sub].getLocation().getFile()
230+
c.getLocation().getFile() = getFunctionFile([base, sub])
228231
) and
229232
result =
230233
min(Call c |

0 commit comments

Comments
 (0)