Skip to content

Commit f8a076e

Browse files
committed
C#: Rename ControlFlow::BasicBlock to BasicBlock.
1 parent 15459d3 commit f8a076e

File tree

17 files changed

+72
-99
lines changed

17 files changed

+72
-99
lines changed

csharp/ql/lib/semmle/code/csharp/Assignable.qll

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,7 @@ class AssignableDefinition extends TAssignableDefinition {
402402
* the definitions of `x` and `y` in `M(out x, out y)` and `(x, y) = (0, 1)`
403403
* relate to the same call to `M` and assignment node, respectively.
404404
*/
405-
deprecated ControlFlowNode getAControlFlowNode() {
406-
result = this.getExpr().getAControlFlowNode()
407-
}
405+
deprecated ControlFlowNode getAControlFlowNode() { result = this.getExpr().getAControlFlowNode() }
408406

409407
/**
410408
* Gets the underlying expression that updates the targeted assignable when
@@ -555,9 +553,7 @@ module AssignableDefinitions {
555553
}
556554

557555
/** Holds if a node in basic block `bb` assigns to `ref` parameter `p` via definition `def`. */
558-
private predicate basicBlockRefParamDef(
559-
ControlFlow::BasicBlock bb, Parameter p, AssignableDefinition def
560-
) {
556+
private predicate basicBlockRefParamDef(BasicBlock bb, Parameter p, AssignableDefinition def) {
561557
def = any(RefArg arg).getAnAnalyzableRefDef(p) and
562558
bb.getANode() = def.getExpr().getAControlFlowNode()
563559
}
@@ -568,17 +564,15 @@ module AssignableDefinitions {
568564
* any assignments to `p`.
569565
*/
570566
pragma[nomagic]
571-
private predicate parameterReachesWithoutDef(Parameter p, ControlFlow::BasicBlock bb) {
567+
private predicate parameterReachesWithoutDef(Parameter p, BasicBlock bb) {
572568
forall(AssignableDefinition def | basicBlockRefParamDef(bb, p, def) |
573569
isUncertainRefCall(def.getTargetAccess())
574570
) and
575571
(
576572
any(RefArg arg).isAnalyzable(p) and
577573
p.getCallable().getEntryPoint() = bb.getFirstNode()
578574
or
579-
exists(ControlFlow::BasicBlock mid | parameterReachesWithoutDef(p, mid) |
580-
bb = mid.getASuccessor()
581-
)
575+
exists(BasicBlock mid | parameterReachesWithoutDef(p, mid) | bb = mid.getASuccessor())
582576
)
583577
}
584578

@@ -590,7 +584,7 @@ module AssignableDefinitions {
590584
cached
591585
predicate isUncertainRefCall(RefArg arg) {
592586
arg.isPotentialAssignment() and
593-
exists(ControlFlow::BasicBlock bb, Parameter p | arg.isAnalyzable(p) |
587+
exists(BasicBlock bb, Parameter p | arg.isAnalyzable(p) |
594588
parameterReachesWithoutDef(p, bb) and
595589
bb.getLastNode() = p.getCallable().getExitPoint()
596590
)

csharp/ql/lib/semmle/code/csharp/controlflow/ControlFlowGraph.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import csharp
22

33
class ControlFlowNode = ControlFlow::Node;
44

5+
class BasicBlock = ControlFlow::BasicBlock;
6+
57
/**
68
* Provides classes representing the control flow graph within callables.
79
*/

csharp/ql/lib/semmle/code/csharp/controlflow/ControlFlowReachability.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ private import semmle.code.csharp.controlflow.BasicBlocks
88
private import semmle.code.csharp.controlflow.Guards as Guards
99
private import semmle.code.csharp.ExprOrStmtParent
1010

11-
private module ControlFlowInput implements
12-
InputSig<Location, ControlFlowNode, ControlFlow::BasicBlock>
13-
{
11+
private module ControlFlowInput implements InputSig<Location, ControlFlowNode, BasicBlock> {
1412
private import csharp as CS
1513

1614
AstNode getEnclosingAstNode(ControlFlowNode node) {

csharp/ql/lib/semmle/code/csharp/controlflow/Guards.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ private import semmle.code.csharp.frameworks.system.collections.Generic
1616
private import codeql.controlflow.Guards as SharedGuards
1717

1818
private module GuardsInput implements
19-
SharedGuards::InputSig<Location, ControlFlowNode, ControlFlow::BasicBlock>
19+
SharedGuards::InputSig<Location, ControlFlowNode, BasicBlock>
2020
{
2121
private import csharp as CS
2222

csharp/ql/lib/semmle/code/csharp/dataflow/SSA.qll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ module Ssa {
165165
class Definition extends SsaImpl::Definition {
166166
/** Gets the control flow node of this SSA definition. */
167167
final ControlFlowNode getControlFlowNode() {
168-
exists(ControlFlow::BasicBlock bb, int i | this.definesAt(_, bb, i) |
168+
exists(BasicBlock bb, int i | this.definesAt(_, bb, i) |
169169
result = bb.getNode(0.maximum(i))
170170
)
171171
}
@@ -176,7 +176,7 @@ module Ssa {
176176
* point it is still live, without crossing another SSA definition of the
177177
* same source variable.
178178
*/
179-
final predicate isLiveAtEndOfBlock(ControlFlow::BasicBlock bb) {
179+
final predicate isLiveAtEndOfBlock(BasicBlock bb) {
180180
SsaImpl::isLiveAtEndOfBlock(this, bb)
181181
}
182182

@@ -538,7 +538,7 @@ module Ssa {
538538
*/
539539
class ImplicitDefinition extends Definition, SsaImpl::WriteDefinition {
540540
ImplicitDefinition() {
541-
exists(ControlFlow::BasicBlock bb, SourceVariable v, int i | this.definesAt(v, bb, i) |
541+
exists(BasicBlock bb, SourceVariable v, int i | this.definesAt(v, bb, i) |
542542
SsaImpl::implicitEntryDefinition(bb, v) and
543543
i = -1
544544
or
@@ -556,7 +556,7 @@ module Ssa {
556556
*/
557557
class ImplicitEntryDefinition extends ImplicitDefinition {
558558
ImplicitEntryDefinition() {
559-
exists(ControlFlow::BasicBlock bb, SourceVariable v |
559+
exists(BasicBlock bb, SourceVariable v |
560560
this.definesAt(v, bb, -1) and
561561
SsaImpl::implicitEntryDefinition(bb, v)
562562
)
@@ -636,7 +636,7 @@ module Ssa {
636636
private Call c;
637637

638638
ImplicitCallDefinition() {
639-
exists(ControlFlow::BasicBlock bb, SourceVariable v, int i |
639+
exists(BasicBlock bb, SourceVariable v, int i |
640640
this.definesAt(v, bb, i) and
641641
SsaImpl::updatesNamedFieldOrProp(bb, i, c, v, _)
642642
)
@@ -674,7 +674,7 @@ module Ssa {
674674

675675
ImplicitQualifierDefinition() {
676676
exists(
677-
ControlFlow::BasicBlock bb, int i, SourceVariables::QualifiedFieldOrPropSourceVariable v
677+
BasicBlock bb, int i, SourceVariables::QualifiedFieldOrPropSourceVariable v
678678
|
679679
this.definesAt(v, bb, i)
680680
|
@@ -725,7 +725,7 @@ module Ssa {
725725
final Definition getAnInput() { this.hasInputFromBlock(result, _) }
726726

727727
/** Holds if `inp` is an input to this phi node along the edge originating in `bb`. */
728-
predicate hasInputFromBlock(Definition inp, ControlFlow::BasicBlock bb) {
728+
predicate hasInputFromBlock(Definition inp, BasicBlock bb) {
729729
inp = SsaImpl::phiHasInputFromBlock(this, bb)
730730
}
731731

csharp/ql/lib/semmle/code/csharp/dataflow/internal/BaseSSA.qll

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module BaseSsa {
1313
* targeting local scope variable `v`.
1414
*/
1515
private predicate definitionAt(
16-
AssignableDefinition def, ControlFlow::BasicBlock bb, int i, SsaInput::SourceVariable v
16+
AssignableDefinition def, BasicBlock bb, int i, SsaInput::SourceVariable v
1717
) {
1818
bb.getNode(i) = def.getExpr().getAControlFlowNode() and
1919
v = def.getTarget() and
@@ -82,10 +82,10 @@ module BaseSsa {
8282
}
8383
}
8484

85-
private module SsaInput implements SsaImplCommon::InputSig<Location, ControlFlow::BasicBlock> {
85+
private module SsaInput implements SsaImplCommon::InputSig<Location, BasicBlock> {
8686
class SourceVariable = SimpleLocalScopeVariable;
8787

88-
predicate variableWrite(ControlFlow::BasicBlock bb, int i, SourceVariable v, boolean certain) {
88+
predicate variableWrite(BasicBlock bb, int i, SourceVariable v, boolean certain) {
8989
exists(AssignableDefinition def |
9090
definitionAt(def, bb, i, v) and
9191
if def.isCertain() then certain = true else certain = false
@@ -96,7 +96,7 @@ module BaseSsa {
9696
certain = true
9797
}
9898

99-
predicate variableRead(ControlFlow::BasicBlock bb, int i, SourceVariable v, boolean certain) {
99+
predicate variableRead(BasicBlock bb, int i, SourceVariable v, boolean certain) {
100100
exists(AssignableRead read |
101101
read.getAControlFlowNode() = bb.getNode(i) and
102102
read.getTarget() = v and
@@ -109,21 +109,21 @@ module BaseSsa {
109109

110110
class Definition extends SsaImpl::Definition {
111111
final AssignableRead getARead() {
112-
exists(ControlFlow::BasicBlock bb, int i |
112+
exists(BasicBlock bb, int i |
113113
SsaImpl::ssaDefReachesRead(_, this, bb, i) and
114114
result.getAControlFlowNode() = bb.getNode(i)
115115
)
116116
}
117117

118118
final AssignableDefinition getDefinition() {
119-
exists(ControlFlow::BasicBlock bb, int i, SsaInput::SourceVariable v |
119+
exists(BasicBlock bb, int i, SsaInput::SourceVariable v |
120120
this.definesAt(v, bb, i) and
121121
definitionAt(result, bb, i, v)
122122
)
123123
}
124124

125125
final predicate isImplicitEntryDefinition(SsaInput::SourceVariable v) {
126-
exists(ControlFlow::BasicBlock bb |
126+
exists(BasicBlock bb |
127127
this.definesAt(v, bb, -1) and
128128
implicitEntryDef(_, bb, v)
129129
)
@@ -142,7 +142,7 @@ module BaseSsa {
142142
override Location getLocation() {
143143
result = this.getDefinition().getLocation()
144144
or
145-
exists(Callable c, ControlFlow::BasicBlock bb, SsaInput::SourceVariable v |
145+
exists(Callable c, BasicBlock bb, SsaInput::SourceVariable v |
146146
this.definesAt(v, bb, -1) and
147147
implicitEntryDef(c, bb, v) and
148148
result = c.getLocation()

csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowDispatch.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ class DataFlowCallable extends TDataFlowCallable {
210210
}
211211

212212
pragma[nomagic]
213-
private ControlFlowNodes::ElementNode getAMultiBodyEntryNode(ControlFlow::BasicBlock bb, int i) {
213+
private ControlFlowNodes::ElementNode getAMultiBodyEntryNode(BasicBlock bb, int i) {
214214
this.isMultiBodied() and
215215
exists(ControlFlowElement body, Location l |
216216
body = this.asCallable(l).getBody() or
@@ -231,15 +231,15 @@ class DataFlowCallable extends TDataFlowCallable {
231231

232232
pragma[nomagic]
233233
private ControlFlowNodes::ElementNode getAMultiBodyControlFlowNodeSuccSameBasicBlock() {
234-
exists(ControlFlow::BasicBlock bb, int i, int j |
234+
exists(BasicBlock bb, int i, int j |
235235
exists(this.getAMultiBodyEntryNode(bb, i)) and
236236
result = bb.getNode(j) and
237237
j > i
238238
)
239239
}
240240

241241
pragma[nomagic]
242-
private ControlFlow::BasicBlock getAMultiBodyBasicBlockSucc() {
242+
private BasicBlock getAMultiBodyBasicBlockSucc() {
243243
result = this.getAMultiBodyEntryNode(_, _).getBasicBlock().getASuccessor()
244244
or
245245
result = this.getAMultiBodyBasicBlockSucc().getASuccessor()

csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ private class LocalFunctionCreationPreNode extends LocalFunctionCreationNode {
166166

167167
/** Calculation of the relative order in which `this` references are read. */
168168
private module ThisFlow {
169-
private class BasicBlock = ControlFlow::BasicBlock;
170-
171169
/** Holds if `e` is a `this` access. */
172170
predicate thisAccessExpr(Expr e) { e instanceof ThisAccess or e instanceof BaseAccess }
173171

@@ -2362,7 +2360,7 @@ predicate expectsContent(Node n, ContentSet c) {
23622360
n.asExpr() instanceof SpreadElementExpr and c.isElement()
23632361
}
23642362

2365-
class NodeRegion instanceof ControlFlow::BasicBlock {
2363+
class NodeRegion instanceof BasicBlock {
23662364
string toString() { result = "NodeRegion" }
23672365

23682366
predicate contains(Node n) { this = n.getControlFlowNode().getBasicBlock() }

0 commit comments

Comments
 (0)