mirror of
https://github.com/github/codeql.git
synced 2026-03-29 19:58:17 +02:00
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
27 lines
729 B
Plaintext
27 lines
729 B
Plaintext
/**
|
|
* @name SSA dominance property test
|
|
* @description SSA dominance property test. SSA definitions *must* dominate all uses
|
|
* @kind test
|
|
*/
|
|
|
|
import cpp
|
|
import semmle.code.cpp.rangeanalysis.RangeSSA
|
|
|
|
/*
|
|
* Count of number of SSA def-use pairs where the defn does not dominate the use.
|
|
* Should always be zero *regardless* of the input
|
|
*/
|
|
|
|
select count(RangeSsaDefinition d, LocalScopeVariable v, Expr u |
|
|
d.getAUse(v) = u and
|
|
not exists(BasicBlock bd, BasicBlock bu |
|
|
bd.contains(mkElement(d).(ControlFlowNode)) and bu.contains(u)
|
|
|
|
|
bbStrictlyDominates(bd, bu)
|
|
or
|
|
exists(int i, int j |
|
|
bd = bu and bd.getNode(i) = mkElement(d) and bu.getNode(j) = u and i <= j
|
|
)
|
|
)
|
|
)
|