Skip to content

Commit 95681bf

Browse files
committed
Rust: Fix performance issue with File.fromSource.
1 parent 16683ae commit 95681bf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rust/ql/lib/codeql/files/FileSystem.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,16 @@ extensible predicate additionalExternalFile(string relativePath);
4545

4646
/** A file. */
4747
class File extends Container, Impl::File {
48+
pragma[nomagic]
49+
private string getRelativePath0() { result = this.getRelativePath() }
50+
4851
/**
4952
* Holds if this file was extracted from the source code of the target project
5053
* (rather than another location such as inside a dependency).
5154
*/
5255
predicate fromSource() {
5356
exists(ExtractorStep s | s.getAction() = "Extract" and s.getFile() = this) and
54-
not additionalExternalFile(this.getRelativePath())
57+
not additionalExternalFile(this.getRelativePath0())
5558
}
5659

5760
/**

0 commit comments

Comments
 (0)