@@ -249,10 +249,10 @@ private predicate nonExcludedIRAndBasicBlock(IRBlock irb, BasicBlock controlled)
249249 */
250250cached
251251class IRGuardCondition extends Instruction {
252- ConditionalBranchInstruction branch ;
252+ Instruction branch ;
253253
254254 cached
255- IRGuardCondition ( ) { branch = get_branch_for_condition ( this ) }
255+ IRGuardCondition ( ) { branch = getBranchForCondition ( this ) }
256256
257257 /**
258258 * Holds if this condition controls `controlled`, meaning that `controlled` is only
@@ -302,7 +302,7 @@ class IRGuardCondition extends Instruction {
302302 this .controls ( pred , testIsTrue )
303303 or
304304 succ = this .getBranchSuccessor ( testIsTrue ) and
305- branch .getCondition ( ) = this and
305+ branch .( ConditionalBranchInstruction ) . getCondition ( ) = this and
306306 branch .getBlock ( ) = pred
307307 }
308308
@@ -322,13 +322,13 @@ class IRGuardCondition extends Instruction {
322322 * ```
323323 */
324324 private IRBlock getBranchSuccessor ( boolean testIsTrue ) {
325- branch .getCondition ( ) = this and
325+ branch .( ConditionalBranchInstruction ) . getCondition ( ) = this and
326326 (
327327 testIsTrue = true and
328- result .getFirstInstruction ( ) = branch .getTrueSuccessor ( )
328+ result .getFirstInstruction ( ) = branch .( ConditionalBranchInstruction ) . getTrueSuccessor ( )
329329 or
330330 testIsTrue = false and
331- result .getFirstInstruction ( ) = branch .getFalseSuccessor ( )
331+ result .getFirstInstruction ( ) = branch .( ConditionalBranchInstruction ) . getFalseSuccessor ( )
332332 )
333333 }
334334
@@ -476,12 +476,14 @@ class IRGuardCondition extends Instruction {
476476 private IRBlock getBranchBlock ( ) { result = branch .getBlock ( ) }
477477}
478478
479- private ConditionalBranchInstruction get_branch_for_condition ( Instruction guard ) {
480- result .getCondition ( ) = guard
479+ private Instruction getBranchForCondition ( Instruction guard ) {
480+ result .( ConditionalBranchInstruction ) . getCondition ( ) = guard
481481 or
482482 exists ( LogicalNotInstruction cond |
483- result = get_branch_for_condition ( cond ) and cond .getUnary ( ) = guard
483+ result = getBranchForCondition ( cond ) and cond .getUnary ( ) = guard
484484 )
485+ or
486+ result .( SwitchInstruction ) .getExpression ( ) = guard
485487}
486488
487489/**
0 commit comments