mirror of
https://github.com/github/codeql.git
synced 2025-12-19 10:23:15 +01: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
26 lines
685 B
Plaintext
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
|