Files
codeql/cpp/ql/test/library-tests/controlflow/assume/interesting.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

26 lines
685 B
Plaintext

import cpp
predicate interesting(ControlFlowNode n) {
n instanceof AssumeExpr or
n instanceof FunctionCall
}
predicate ptrUnassigned(ControlFlowNode n) {
// declaration of `ptr`
n.(DeclStmt).getADeclaration().getName() = "ptr"
or
// flow
exists(ControlFlowNode pred |
ptrUnassigned(pred) and
pred.getASuccessor() = n and
not pred.(AssignExpr).getLValue().(Access).getTarget().getName() = "ptr"
)
}
from ControlFlowNode n, string r, string p
where
interesting(n) and
(if reachable(n) then r = "reachable" else r = "") and
if ptrUnassigned(n) then p = "unassigned ptr" else p = ""
select n, count(n.getAPredecessor()), count(n.getASuccessor()), r, p