C++: Exclude tests (by matching paths) in model generation.

This commit is contained in:
Mathias Vorreiter Pedersen
2025-05-15 13:24:32 +01:00
parent 51229a6b48
commit e80c3b5c0b

View File

@@ -45,6 +45,13 @@ private predicate isUninterestingForModels(Callable api) {
api = any(Cpp::LambdaExpression lambda).getLambdaFunction()
or
api.isFromUninstantiatedTemplate(_)
or
// Exclude functions in test directories (but not the ones in the CodeQL test directory)
exists(Cpp::File f |
f = api.getFile() and
f.getAbsolutePath().matches("%test%") and
not f.getAbsolutePath().matches("%test/library-tests/dataflow/modelgenerator/dataflow/%")
)
}
private predicate relevant(Callable api) {