Skip to content

Commit 1a40ae6

Browse files
committed
C++: No need to exclude static and global initializers now that we inline the predicates.
1 parent 9cf1443 commit 1a40ae6

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

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

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,6 @@ private predicate nonExcludedIRAndBasicBlock(IRBlock irb, BasicBlock controlled)
362362
*
363363
* Note that `&&` and `||` don't have an explicit representation in the IR,
364364
* and therefore will not appear as IRGuardConditions.
365-
*
366-
* For performance reasons conditions inside static local initializers or
367-
* global initializers are not considered `IRGuardCondition`s.
368365
*/
369366
class IRGuardCondition extends Instruction {
370367
Instruction branch;
@@ -715,16 +712,9 @@ class IRGuardCondition extends Instruction {
715712
}
716713

717714
private Instruction getBranchForCondition(Instruction guard) {
718-
// There are a lot of guards inside global or static local initializers,
719-
// and on certain databases this can make the `ensures*` predicates
720-
// blow up.
721-
// These guards are likely not super important anyway.
722-
guard.getEnclosingFunction() instanceof Function and
723-
(
724-
result.(ConditionalBranchInstruction).getCondition() = guard
725-
or
726-
result.(SwitchInstruction).getExpression() = guard
727-
)
715+
result.(ConditionalBranchInstruction).getCondition() = guard
716+
or
717+
result.(SwitchInstruction).getExpression() = guard
728718
or
729719
exists(LogicalNotInstruction cond |
730720
result = getBranchForCondition(cond) and cond.getUnary() = guard

0 commit comments

Comments
 (0)