Skip to content

Commit 5327847

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

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
@@ -370,9 +370,6 @@ private predicate nonExcludedIRAndBasicBlock(IRBlock irb, BasicBlock controlled)
370370
*
371371
* Note that `&&` and `||` don't have an explicit representation in the IR,
372372
* and therefore will not appear as IRGuardConditions.
373-
*
374-
* For performance reasons conditions inside static local initializers or
375-
* global initializers are not considered `IRGuardCondition`s.
376373
*/
377374
class IRGuardCondition extends Instruction {
378375
Instruction branch;
@@ -727,16 +724,9 @@ class IRGuardCondition extends Instruction {
727724
}
728725

729726
private Instruction getBranchForCondition(Instruction guard) {
730-
// There are a lot of guards inside global or static local initializers,
731-
// and on certain databases this can make the `ensures*` predicates
732-
// blow up.
733-
// These guards are likely not super important anyway.
734-
guard.getEnclosingFunction() instanceof Function and
735-
(
736-
result.(ConditionalBranchInstruction).getCondition() = guard
737-
or
738-
result.(SwitchInstruction).getExpression() = guard
739-
)
727+
result.(ConditionalBranchInstruction).getCondition() = guard
728+
or
729+
result.(SwitchInstruction).getExpression() = guard
740730
or
741731
exists(LogicalNotInstruction cond |
742732
result = getBranchForCondition(cond) and cond.getUnary() = guard

0 commit comments

Comments
 (0)