mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Rust: Enable CFG consistency checks
This commit is contained in:
@@ -61,8 +61,3 @@ query predicate preBasicBlockConsistency(ControlFlowElement cfe1, ControlFlowEle
|
||||
bbIntraSuccInconsistency(cfe1, cfe2) and
|
||||
s = "intra succ inconsistency"
|
||||
}
|
||||
|
||||
query predicate multipleToString(Node n, string s) {
|
||||
s = strictconcat(n.toString(), ",") and
|
||||
strictcount(n.toString()) > 1
|
||||
}
|
||||
|
||||
@@ -19,8 +19,3 @@ query predicate nonPostOrderExpr(Expr e, string cls) {
|
||||
c instanceof NormalCompletion
|
||||
)
|
||||
}
|
||||
|
||||
query predicate multipleToString(CfgNode n, string s) {
|
||||
s = strictconcat(n.toString(), ",") and
|
||||
strictcount(n.toString()) > 1
|
||||
}
|
||||
|
||||
19
rust/ql/consistency-queries/CfgConsistency.ql
Normal file
19
rust/ql/consistency-queries/CfgConsistency.ql
Normal file
@@ -0,0 +1,19 @@
|
||||
import rust
|
||||
import codeql.rust.controlflow.internal.ControlFlowGraphImpl::Consistency
|
||||
import codeql.rust.controlflow.internal.ControlFlowGraphImpl as CfgImpl
|
||||
import codeql.rust.controlflow.internal.Completion
|
||||
|
||||
/**
|
||||
* All `Expr` nodes are `PostOrderTree`s
|
||||
*/
|
||||
query predicate nonPostOrderExpr(Expr e, string cls) {
|
||||
cls = e.getPrimaryQlClasses() and
|
||||
not e instanceof LetExpr and
|
||||
not e instanceof LogicalAndExpr and // todo
|
||||
not e instanceof LogicalOrExpr and
|
||||
exists(AstNode last, Completion c |
|
||||
CfgImpl::last(e, last, c) and
|
||||
last != e and
|
||||
c instanceof NormalCompletion
|
||||
)
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
from boolean b
|
||||
where b = true and b = false
|
||||
select b
|
||||
@@ -1386,5 +1386,10 @@ module Make<LocationSig Location, InputSig<Location> Input> {
|
||||
ord = sk.getListOrder() and
|
||||
strictcount(sk.getListOrder()) > 1
|
||||
}
|
||||
|
||||
query predicate multipleToString(Node n, string s) {
|
||||
s = strictconcat(n.toString(), ",") and
|
||||
strictcount(n.toString()) > 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user