mirror of
https://github.com/github/codeql.git
synced 2026-03-23 07:56:54 +01:00
Follow a naming structure similar to the data flow library: - `ControlFlowNode` -> `ControlFlow::Node`. - `CallableEntryNode` -> `ControlFlow::Nodes::EntryNode`. - `CallableExitNode` -> `ControlFlow::Nodes::ExitNode`. - `ControlFlowEdgeType` -> `ControlFlow::SuccessorType`. - `ControlFlowEdgeSuccessor` -> `ControlFlow::SuccessorTypes::NormalSuccessor`. - `ControlFlowEdgeConditional -> ControlFlow::SuccessorTypes::ConditionalSuccessor`. - `ControlFlowEdgeBoolean` -> `ControlFlow::SuccessorTypes::BooleanSuccessor`. - `ControlFlowEdgeNullness` -> `ControlFlow::SuccessorTypes::NullnessSuccessor`. - `ControlFlowEdgeMatching` -> `ControlFlow::SuccessorTypes::MatchingSuccessor`. - `ControlFlowEdgeEmptiness` -> `ControlFlow::SuccessorTypes::EmptinessSuccessor`. - `ControlFlowEdgeReturn` -> `ControlFlow::SuccessorTypes::ReturnSuccessor`. - `ControlFlowEdgeBreak` -> `ControlFlow::SuccessorTypes::BreakSuccessor`. - `ControlFlowEdgeContinue` -> `ControlFlow::SuccessorTypes::ContinueSuccessor`. - `ControlFlowEdgeGotoLabel` -> `ControlFlow::SuccessorTypes::GotoLabelSuccessor`. - `ControlFlowEdgeGotoCase` -> `ControlFlow::SuccessorTypes::GotoCaseSuccessor`. - `ControlFlowEdgeGotoDefault` -> `ControlFlow::SuccessorTypes::GotoDefaultSuccessor`. - `ControlFlowEdgeException` -> `ControlFlow::SuccessorTypes::ExceptionSuccessor`
15 lines
514 B
Plaintext
15 lines
514 B
Plaintext
import csharp
|
|
|
|
ControlFlow::Node successor(ControlFlow::Node node, boolean kind) {
|
|
(kind = true and result = node.getATrueSuccessor()) or
|
|
(kind = false and result = node.getAFalseSuccessor())
|
|
}
|
|
|
|
from ControlFlow::Node node, ControlFlow::Node successor, Location nl, Location sl, boolean kind
|
|
where successor = successor(node, kind)
|
|
and nl = node.getLocation()
|
|
and sl = successor.getLocation()
|
|
select
|
|
nl.getStartLine(), nl.getStartColumn(), node, kind,
|
|
sl.getStartLine(), sl.getStartColumn(), successor
|