mirror of
https://github.com/github/codeql.git
synced 2026-05-14 11:19:27 +02:00
C#/Java: Adjust Guards instantiations.
This commit is contained in:
@@ -85,12 +85,12 @@ private module GuardsInput implements SharedGuards::InputSig<Location, ControlFl
|
||||
|
||||
predicate matchEdge(BasicBlock bb1, BasicBlock bb2) {
|
||||
bb1.getASuccessor(any(MatchingSuccessor s | s.getValue() = true)) = bb2 and
|
||||
bb1.getLastNode() = AstNode.super.getControlFlowNode()
|
||||
bb1.getLastNode() = super.getPattern().getControlFlowNode()
|
||||
}
|
||||
|
||||
predicate nonMatchEdge(BasicBlock bb1, BasicBlock bb2) {
|
||||
bb1.getASuccessor(any(MatchingSuccessor s | s.getValue() = false)) = bb2 and
|
||||
bb1.getLastNode() = AstNode.super.getControlFlowNode()
|
||||
bb1.getLastNode() = super.getPattern().getControlFlowNode()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -168,14 +168,20 @@ private module GuardsInput implements SharedGuards::InputSig<Location, ControlFl
|
||||
)
|
||||
}
|
||||
|
||||
private ControlFlowNode getPatternNode() {
|
||||
result = this.(J::PatternCase).getUniquePattern().getControlFlowNode()
|
||||
or
|
||||
result = unique(Expr e | this.(J::ConstCase).getValue(_) = e).getControlFlowNode()
|
||||
}
|
||||
|
||||
predicate matchEdge(BasicBlock bb1, BasicBlock bb2) {
|
||||
bb1.getASuccessor(any(MatchingSuccessor s | s.getValue() = true)) = bb2 and
|
||||
bb1.getLastNode() = super.getControlFlowNode()
|
||||
bb1.getLastNode() = this.getPatternNode()
|
||||
}
|
||||
|
||||
predicate nonMatchEdge(BasicBlock bb1, BasicBlock bb2) {
|
||||
bb1.getASuccessor(any(MatchingSuccessor s | s.getValue() = false)) = bb2 and
|
||||
bb1.getLastNode() = super.getControlFlowNode()
|
||||
bb1.getLastNode() = this.getPatternNode()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user