C++: Move 'InlineMadTest.qll' out of 'lib/utils/test' and into 'test' since C++ has no external packs depending on MaD testing.

This commit is contained in:
Mathias Vorreiter Pedersen
2025-04-18 16:42:01 +01:00
parent 6fcf56e6e1
commit 3fd760c632
3 changed files with 2 additions and 2 deletions

View File

@@ -1,34 +0,0 @@
private import cpp
private import codeql.mad.test.InlineMadTest
class MadRelevantFunction extends Function {
MadRelevantFunction() { not this.isFromUninstantiatedTemplate(_) }
}
private module InlineMadTestLang implements InlineMadTestLangSig {
class Callable = MadRelevantFunction;
/**
* Holds if `c` is the closest `Callable` that succeeds `comment` in the file.
*/
private predicate hasClosestCallable(CppStyleComment comment, Callable c) {
c =
min(Callable cand, int dist |
// This has no good join order, but should hopefully be good enough for tests.
cand.getFile() = comment.getFile() and
dist = cand.getLocation().getStartLine() - comment.getLocation().getStartLine() and
dist > 0
|
cand order by dist
)
}
string getComment(Callable c) {
exists(CppStyleComment comment |
hasClosestCallable(comment, c) and
result = comment.getContents().suffix(2)
)
}
}
import InlineMadTestImpl<InlineMadTestLang>