Rust: Weaken scopeNoFirst check

This commit is contained in:
Tom Hvitved
2024-09-26 11:09:31 +02:00
parent a3ad6f5697
commit 24f39ccae2
2 changed files with 9 additions and 5 deletions

View File

@@ -1,5 +1,7 @@
import rust
import codeql.rust.controlflow.internal.ControlFlowGraphImpl::Consistency
import codeql.rust.controlflow.internal.ControlFlowGraphImpl::Consistency as Consistency
import Consistency
import codeql.rust.controlflow.ControlFlowGraph
import codeql.rust.controlflow.internal.ControlFlowGraphImpl as CfgImpl
import codeql.rust.controlflow.internal.Completion
@@ -17,3 +19,9 @@ query predicate nonPostOrderExpr(Expr e, string cls) {
c instanceof NormalCompletion
)
}
query predicate scopeNoFirst(CfgScope scope) {
Consistency::scopeNoFirst(scope) and
not scope = any(Function f | not exists(f.getBody())) and
not scope = any(ClosureExpr c | not exists(c.getBody()))
}

View File

@@ -1,7 +1,3 @@
/**
* @id rust/controlflow/cfg
*/
import rust
import codeql.rust.controlflow.ControlFlowGraph
import TestUtils