@@ -249,10 +249,10 @@ private predicate nonExcludedIRAndBasicBlock(IRBlock irb, BasicBlock controlled)
249
249
*/
250
250
cached
251
251
class IRGuardCondition extends Instruction {
252
- ConditionalBranchInstruction branch ;
252
+ Instruction branch ;
253
253
254
254
cached
255
- IRGuardCondition ( ) { branch = get_branch_for_condition ( this ) }
255
+ IRGuardCondition ( ) { branch = getBranchForCondition ( this ) }
256
256
257
257
/**
258
258
* Holds if this condition controls `controlled`, meaning that `controlled` is only
@@ -302,7 +302,7 @@ class IRGuardCondition extends Instruction {
302
302
this .controls ( pred , testIsTrue )
303
303
or
304
304
succ = this .getBranchSuccessor ( testIsTrue ) and
305
- branch .getCondition ( ) = this and
305
+ branch .( ConditionalBranchInstruction ) . getCondition ( ) = this and
306
306
branch .getBlock ( ) = pred
307
307
}
308
308
@@ -322,13 +322,13 @@ class IRGuardCondition extends Instruction {
322
322
* ```
323
323
*/
324
324
private IRBlock getBranchSuccessor ( boolean testIsTrue ) {
325
- branch .getCondition ( ) = this and
325
+ branch .( ConditionalBranchInstruction ) . getCondition ( ) = this and
326
326
(
327
327
testIsTrue = true and
328
- result .getFirstInstruction ( ) = branch .getTrueSuccessor ( )
328
+ result .getFirstInstruction ( ) = branch .( ConditionalBranchInstruction ) . getTrueSuccessor ( )
329
329
or
330
330
testIsTrue = false and
331
- result .getFirstInstruction ( ) = branch .getFalseSuccessor ( )
331
+ result .getFirstInstruction ( ) = branch .( ConditionalBranchInstruction ) . getFalseSuccessor ( )
332
332
)
333
333
}
334
334
@@ -476,12 +476,14 @@ class IRGuardCondition extends Instruction {
476
476
private IRBlock getBranchBlock ( ) { result = branch .getBlock ( ) }
477
477
}
478
478
479
- private ConditionalBranchInstruction get_branch_for_condition ( Instruction guard ) {
480
- result .getCondition ( ) = guard
479
+ private Instruction getBranchForCondition ( Instruction guard ) {
480
+ result .( ConditionalBranchInstruction ) . getCondition ( ) = guard
481
481
or
482
482
exists ( LogicalNotInstruction cond |
483
- result = get_branch_for_condition ( cond ) and cond .getUnary ( ) = guard
483
+ result = getBranchForCondition ( cond ) and cond .getUnary ( ) = guard
484
484
)
485
+ or
486
+ result .( SwitchInstruction ) .getExpression ( ) = guard
485
487
}
486
488
487
489
/**
0 commit comments