@@ -60,7 +60,7 @@ private cached module Cached {
60
60
private predicate non_primitive_basic_block_entry_node ( ControlFlowNode node ) {
61
61
not primitive_basic_block_entry_node ( node ) and
62
62
not exists ( node .getAPredecessor ( ) ) and
63
- successors_extended ( unresolveElement ( node ) , _)
63
+ successors_extended ( node , _)
64
64
}
65
65
66
66
/**
@@ -80,7 +80,7 @@ private cached module Cached {
80
80
* reuse predicates already computed for `PrimitiveBasicBlocks`.
81
81
*/
82
82
private predicate equalsPrimitiveBasicBlock ( BasicBlock bb ) {
83
- primitive_basic_block_entry_node ( mkElement ( bb ) )
83
+ primitive_basic_block_entry_node ( bb )
84
84
and
85
85
not exists ( int i |
86
86
i > 0 and
@@ -96,11 +96,11 @@ private cached module Cached {
96
96
}
97
97
98
98
private predicate non_primitive_basic_block_member ( ControlFlowNode node , BasicBlock bb , int pos ) {
99
- ( not equalsPrimitiveBasicBlock ( bb ) and node = mkElement ( bb ) and pos = 0 )
99
+ ( not equalsPrimitiveBasicBlock ( bb ) and node = bb and pos = 0 )
100
100
or
101
- ( not ( unresolveElement ( node ) instanceof BasicBlock ) and
101
+ ( not ( node instanceof BasicBlock ) and
102
102
exists ( ControlFlowNode pred
103
- | successors_extended ( unresolveElement ( pred ) , unresolveElement ( node ) )
103
+ | successors_extended ( pred , node )
104
104
| non_primitive_basic_block_member ( pred , bb , pos - 1 ) ) )
105
105
}
106
106
@@ -117,7 +117,7 @@ private cached module Cached {
117
117
predicate bb_successor_cached ( BasicBlock pred , BasicBlock succ ) {
118
118
exists ( ControlFlowNode last |
119
119
basic_block_member ( last , pred , bb_length ( pred ) - 1 ) and
120
- last .getASuccessor ( ) = mkElement ( succ )
120
+ last .getASuccessor ( ) = succ
121
121
)
122
122
}
123
123
}
@@ -143,15 +143,10 @@ predicate bb_successor = bb_successor_cached/2;
143
143
* A - B < C - D AB is a basic block and CD is a basic block (B has two outgoing edges)
144
144
* ```
145
145
*/
146
- class BasicBlock extends @cfgnode {
146
+ class BasicBlock extends ControlFlowNodeBase {
147
147
148
148
BasicBlock ( ) {
149
- basic_block_entry_node ( mkElement ( this ) )
150
- }
151
-
152
- /** Gets a textual representation of this element. */
153
- string toString ( ) {
154
- result = "BasicBlock"
149
+ basic_block_entry_node ( this )
155
150
}
156
151
157
152
predicate contains ( ControlFlowNode node ) {
@@ -187,7 +182,7 @@ class BasicBlock extends @cfgnode {
187
182
}
188
183
189
184
ControlFlowNode getStart ( ) {
190
- result = mkElement ( this )
185
+ result = this
191
186
}
192
187
193
188
/** Gets the number of `ControlFlowNode`s in this basic block. */
@@ -248,9 +243,9 @@ class BasicBlock extends @cfgnode {
248
243
* point or a `catch` clause of a reachable `try` statement.
249
244
*/
250
245
predicate isReachable ( ) {
251
- exists ( Function f | f .getBlock ( ) = mkElement ( this ) )
246
+ exists ( Function f | f .getBlock ( ) = this )
252
247
or
253
- exists ( TryStmt t , BasicBlock tryblock | mkElement ( this ) = t .getACatchClause ( ) and tryblock .isReachable ( ) and tryblock .contains ( t ) )
248
+ exists ( TryStmt t , BasicBlock tryblock | this = t .getACatchClause ( ) and tryblock .isReachable ( ) and tryblock .contains ( t ) )
254
249
or
255
250
exists ( BasicBlock pred | pred .getASuccessor ( ) = this and pred .isReachable ( ) )
256
251
}
@@ -272,7 +267,7 @@ predicate unreachable(ControlFlowNode n) {
272
267
*/
273
268
class EntryBasicBlock extends BasicBlock {
274
269
EntryBasicBlock ( ) {
275
- exists ( Function f | mkElement ( this ) = f .getEntryPoint ( ) )
270
+ exists ( Function f | this = f .getEntryPoint ( ) )
276
271
}
277
272
}
278
273
0 commit comments