Skip to content

Commit cfbfe92

Browse files
committed
C++: Replace cached with more efficient QL.
1 parent 41a540e commit cfbfe92

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

cpp/ql/src/semmle/code/cpp/File.qll

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -272,20 +272,16 @@ class File extends Container, @file {
272272
* are compiled by a Microsoft compiler are detected by this predicate.
273273
*/
274274
predicate compiledAsMicrosoft() {
275-
exists(Compilation c |
276-
c.getAFileCompiled() = this and
275+
exists(File f, Compilation c |
276+
c.getAFileCompiled() = f and
277277
(
278278
c.getAnArgument() = "--microsoft" or
279279
c.getAnArgument()
280280
.toLowerCase()
281281
.replaceAll("\\", "/")
282282
.matches(["%/cl.exe", "%/clang-cl.exe"])
283-
)
284-
)
285-
or
286-
exists(File parent |
287-
parent.compiledAsMicrosoft() and
288-
parent.getAnIncludedFile() = this
283+
) and
284+
f.getAnIncludedFile*() = this
289285
)
290286
}
291287

@@ -361,7 +357,7 @@ class File extends Container, @file {
361357
/**
362358
* Holds if any file was compiled by a Microsoft compiler.
363359
*/
364-
cached predicate anyFileCompiledAsMicrosoft() { any(File f).compiledAsMicrosoft() }
360+
predicate anyFileCompiledAsMicrosoft() { any(File f).compiledAsMicrosoft() }
365361

366362
/**
367363
* A C/C++ header file, as determined (mainly) by file extension.

0 commit comments

Comments
 (0)