Skip to content

Commit ffc1c62

Browse files
authored
Merge pull request #19498 from MathiasVP/exclude-test-directories
C++: Exclude tests in model generation
2 parents 5e72b8b + e80c3b5 commit ffc1c62

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cpp/ql/src/utils/modelgenerator/internal/CaptureModels.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ private predicate isUninterestingForModels(Callable api) {
4545
api = any(Cpp::LambdaExpression lambda).getLambdaFunction()
4646
or
4747
api.isFromUninstantiatedTemplate(_)
48+
or
49+
// Exclude functions in test directories (but not the ones in the CodeQL test directory)
50+
exists(Cpp::File f |
51+
f = api.getFile() and
52+
f.getAbsolutePath().matches("%test%") and
53+
not f.getAbsolutePath().matches("%test/library-tests/dataflow/modelgenerator/dataflow/%")
54+
)
4855
}
4956

5057
private predicate relevant(Callable api) {

0 commit comments

Comments
 (0)