mirror of
https://github.com/github/codeql.git
synced 2025-12-20 02:44:30 +01:00
19 lines
567 B
Plaintext
19 lines
567 B
Plaintext
import csharp
|
|
import ControlFlow
|
|
|
|
query predicate conditionBlock(
|
|
BasicBlocks::ConditionBlock cb, BasicBlock controlled, boolean testIsTrue
|
|
) {
|
|
cb.controls(controlled, any(SuccessorTypes::ConditionalSuccessor s | testIsTrue = s.getValue()))
|
|
}
|
|
|
|
ControlFlow::Node successor(ControlFlow::Node node, boolean kind) {
|
|
kind = true and result = node.getATrueSuccessor()
|
|
or
|
|
kind = false and result = node.getAFalseSuccessor()
|
|
}
|
|
|
|
query predicate conditionFlow(ControlFlow::Node node, ControlFlow::Node successor, boolean kind) {
|
|
successor = successor(node, kind)
|
|
}
|