Skip to content

Commit cade3a3

Browse files
committed
C++: Use the hasBranchEdge helper predicate
This tidies up the code, removing unnecessary repetition.
1 parent 398678a commit cade3a3

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,7 @@ class IRGuardCondition extends Instruction {
407407
not isUnreachedBlock(controlled) and
408408
exists(IRBlock branchBlock | branchBlock.getAnInstruction() = branch |
409409
exists(IRBlock succ |
410-
testIsTrue = true and succ.getFirstInstruction() = branch.getTrueSuccessor()
411-
or
412-
testIsTrue = false and succ.getFirstInstruction() = branch.getFalseSuccessor()
413-
|
414-
branch.getCondition() = this and
410+
this.hasBranchEdge(succ, testIsTrue) and
415411
succ.dominates(controlled) and
416412
forall(IRBlock pred | pred.getASuccessor() = succ |
417413
pred = branchBlock or succ.dominates(pred) or not pred.isReachableFromFunctionEntry()

0 commit comments

Comments
 (0)