Files
codeql/cpp/ql/src/PointsTo/Stats.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

19 lines
627 B
Plaintext

/**
* @name Flow Statistics
* @description Count the number points-to sets with 0 or 1 incoming flow edges, and the total number of points-to sets
* @kind table
* @id cpp/points-to/stats
* @deprecated This query is not suitable for production use and has been deprecated.
*/
import cpp
import semmle.code.cpp.pointsto.PointsTo
predicate inc(int set, int cnt) {
(setflow(set, _) or setflow(_, set)) and
cnt = count(int i | setflow(i, set) and i != set)
}
select count(int set | inc(set, _)) as total, count(int set | inc(set, 0)) as nullary,
count(int set | inc(set, 1)) as unary, total - nullary - unary as rest