Files
codeql/cpp/ql/test/library-tests/default_parameters/variables.ql
Jonas Jensen 4ef5c9af62 C++: Autoformat everything
Some files that will change in #1736 have been spared.

    ./build -j4 target/jars/qlformat
    find ql/cpp/ql -name "*.ql"  -print0 | xargs -0 target/jars/qlformat --input
    find ql/cpp/ql -name "*.qll" -print0 | xargs -0 target/jars/qlformat --input
    (cd ql && git checkout 'cpp/ql/src/semmle/code/cpp/ir/implementation/**/*SSA*.qll')
    buildutils-internal/scripts/pr-checks/sync-identical-files.py --latest
2019-09-09 11:25:53 +02:00

43 lines
996 B
Plaintext

import cpp
string istr(Initializer i) {
if exists(i.toString()) then result = i.toString() else result = "<no str>"
}
string iloc(Initializer i) {
if exists(i.getLocation().toString())
then result = i.getLocation().toString()
else result = "<no location>"
}
string init(Variable v) {
if v.hasInitializer()
then
exists(Initializer i |
i = v.getInitializer() and
result = iloc(i) + " " + istr(i)
)
else result = "<no init>"
}
string estr(Expr e) { if exists(e.toString()) then result = e.toString() else result = "<no str>" }
string eloc(Expr e) {
if exists(e.getLocation().toString())
then result = e.getLocation().toString()
else result = "<no location>"
}
string assigned(Variable v) {
if exists(v.getAnAssignedValue())
then
exists(Expr e |
e = v.getAnAssignedValue() and
result = eloc(e) + " " + estr(e)
)
else result = "<no assigned>"
}
from Variable v
select v, count(init(v)), init(v), count(assigned(v)), assigned(v)