mirror of
https://github.com/github/codeql.git
synced 2026-04-29 02:35:15 +02:00
C#: Avoid recomputing ControlFlowTree::Range outside the CFG construction stage
This commit is contained in:
@@ -403,7 +403,7 @@ private module JoinBlockPredecessors {
|
||||
private import semmle.code.csharp.controlflow.internal.ControlFlowGraphImpl
|
||||
|
||||
int getId(JoinBlockPredecessor jbp) {
|
||||
exists(ControlFlowTree::Range t | ControlFlowTree::idOf(t, result) |
|
||||
exists(ControlFlowTree::Range_ t | ControlFlowTree::idOf(t, result) |
|
||||
t = jbp.getFirstNode().getElement()
|
||||
or
|
||||
t = jbp.(EntryBasicBlock).getCallable()
|
||||
|
||||
@@ -77,7 +77,7 @@ class CfgScope extends Element, @top_level_exprorstmt_parent {
|
||||
}
|
||||
|
||||
module ControlFlowTree {
|
||||
private class Range_ = @callable or @control_flow_element;
|
||||
class Range_ = @callable or @control_flow_element;
|
||||
|
||||
class Range extends Element, Range_ {
|
||||
Range() { this = getAChild*(any(CfgScope scope)) }
|
||||
@@ -88,9 +88,9 @@ module ControlFlowTree {
|
||||
result = p.(AssignOperation).getExpandedAssignment()
|
||||
}
|
||||
|
||||
private predicate id(Range x, Range y) { x = y }
|
||||
private predicate id(Range_ x, Range_ y) { x = y }
|
||||
|
||||
predicate idOf(Range x, int y) = equivalenceRelation(id/2)(x, y)
|
||||
predicate idOf(Range_ x, int y) = equivalenceRelation(id/2)(x, y)
|
||||
}
|
||||
|
||||
abstract private class ControlFlowTree extends ControlFlowTree::Range {
|
||||
|
||||
@@ -49,7 +49,7 @@ module Private {
|
||||
}
|
||||
|
||||
int getId(PhiInputEdgeBlock bb) {
|
||||
exists(CfgImpl::ControlFlowTree::Range t | CfgImpl::ControlFlowTree::idOf(t, result) |
|
||||
exists(CfgImpl::ControlFlowTree::Range_ t | CfgImpl::ControlFlowTree::idOf(t, result) |
|
||||
t = bb.getFirstNode().getElement()
|
||||
or
|
||||
t = bb.(CS::ControlFlow::BasicBlocks::EntryBlock).getCallable()
|
||||
|
||||
Reference in New Issue
Block a user