mirror of
https://github.com/github/codeql.git
synced 2026-05-04 13:15:21 +02:00
QL code and tests for C#/C++/JavaScript.
This commit is contained in:
25
cpp/ql/test/library-tests/blocks/cpp/code_blocks.ql
Normal file
25
cpp/ql/test/library-tests/blocks/cpp/code_blocks.ql
Normal file
@@ -0,0 +1,25 @@
|
||||
import cpp
|
||||
|
||||
predicate paramsString(Function f, int n, string res) {
|
||||
if n = -1 then res = ""
|
||||
else exists(string sep |
|
||||
if n = 0 then sep = "" else sep = ", "
|
||||
and
|
||||
exists(string prefixRes |
|
||||
paramsString(f, n - 1, prefixRes)
|
||||
and
|
||||
res = prefixRes + sep + f.getParameter(n)
|
||||
+ "(" + f.getParameter(n).getType() + ")"))
|
||||
}
|
||||
|
||||
from BlockExpr e, Function f, string params
|
||||
where f = e.getFunction()
|
||||
and paramsString(f, f.getNumberOfParameters() - 1, params)
|
||||
select e,
|
||||
e.getType() as te,
|
||||
te.explain(),
|
||||
e.getFunction(),
|
||||
f.getType() as tf,
|
||||
tf.explain(),
|
||||
params
|
||||
|
||||
Reference in New Issue
Block a user