Skip to content

Commit bc08e47

Browse files
authored
Merge pull request github#4664 from hvitved/csharp/cfg/refactor
C#: Refactor CFG implementation
2 parents ad4b2be + cb91dc1 commit bc08e47

24 files changed

+2313
-2161
lines changed

csharp/ql/src/semmle/code/csharp/commons/Assertions.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/** Provides classes for assertions. */
22

3+
private import semmle.code.csharp.controlflow.internal.ControlFlowGraphImpl
34
private import semmle.code.csharp.frameworks.system.Diagnostics
45
private import semmle.code.csharp.frameworks.system.diagnostics.Contracts
56
private import semmle.code.csharp.frameworks.test.VisualStudio
@@ -189,7 +190,7 @@ class Assertion extends MethodCall {
189190
deprecated private predicate immediatelyDominatesBlockSplit(BasicBlock succ) {
190191
// Only calculate dominance by explicit recursion for split nodes;
191192
// all other nodes can use regular CFG dominance
192-
this instanceof ControlFlow::Internal::SplitControlFlowElement and
193+
this instanceof SplitControlFlowElement and
193194
exists(BasicBlock bb | bb.getANode() = this.getAControlFlowNode() |
194195
succ = bb.getASuccessor() and
195196
forall(BasicBlock pred | pred = succ.getAPredecessor() and pred != bb |

csharp/ql/src/semmle/code/csharp/controlflow/ControlFlowElement.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ private import ControlFlow
66
private import ControlFlow::BasicBlocks
77
private import SuccessorTypes
88
private import semmle.code.csharp.Caching
9+
private import internal.ControlFlowGraphImpl
910

1011
/**
1112
* A program element that can possess control flow. That is, either a statement or
@@ -38,14 +39,14 @@ class ControlFlowElement extends ExprOrStmtParent, @control_flow_element {
3839
* Gets a first control flow node executed within this element.
3940
*/
4041
Nodes::ElementNode getAControlFlowEntryNode() {
41-
result = Internal::getAControlFlowEntryNode(this).getAControlFlowNode()
42+
result = getAControlFlowEntryNode(this).getAControlFlowNode()
4243
}
4344

4445
/**
4546
* Gets a potential last control flow node executed within this element.
4647
*/
4748
Nodes::ElementNode getAControlFlowExitNode() {
48-
result = Internal::getAControlFlowExitNode(this).getAControlFlowNode()
49+
result = getAControlFlowExitNode(this).getAControlFlowNode()
4950
}
5051

5152
/**
@@ -80,7 +81,7 @@ class ControlFlowElement extends ExprOrStmtParent, @control_flow_element {
8081
) {
8182
// Only calculate dominance by explicit recursion for split nodes;
8283
// all other nodes can use regular CFG dominance
83-
this instanceof ControlFlow::Internal::SplitControlFlowElement and
84+
this instanceof SplitControlFlowElement and
8485
cb.getLastNode() = this.getAControlFlowNode() and
8586
succ = cb.getASuccessorByType(s)
8687
}

0 commit comments

Comments
 (0)