mirror of
https://github.com/github/codeql.git
synced 2025-12-21 03:06:31 +01:00
CPP: Improved solution (mostly performance).
This commit is contained in:
@@ -139,16 +139,17 @@ private predicate bbLoopEntryConditionAlwaysTrueAt(BasicBlock bb, int i, Control
|
|||||||
* within a complex loop condition are not matched by this predicate.
|
* within a complex loop condition are not matched by this predicate.
|
||||||
*/
|
*/
|
||||||
private predicate bbLoopConditionAlwaysTrueUponEntrySuccessor(BasicBlock pred, BasicBlock succ, boolean skipsLoop) {
|
private predicate bbLoopConditionAlwaysTrueUponEntrySuccessor(BasicBlock pred, BasicBlock succ, boolean skipsLoop) {
|
||||||
exists(ControlFlowNode loop |
|
exists(Expr cond |
|
||||||
loopConditionAlwaysTrueUponEntry(loop, _) and
|
loopConditionAlwaysTrueUponEntry(_, cond) and
|
||||||
|
cond.getAChild*() = pred.getEnd() and
|
||||||
|
succ = pred.getASuccessor() and
|
||||||
|
not cond.getAChild*() = succ.getStart() and
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
not succ = loop.(Loop).getStmt() and
|
succ = pred.getAFalseSuccessor() and
|
||||||
pred.getAFalseSuccessor() = succ and
|
|
||||||
skipsLoop = true
|
skipsLoop = true
|
||||||
) or (
|
) or (
|
||||||
succ = loop.(Loop).getStmt() and
|
succ = pred.getATrueSuccessor() and
|
||||||
pred.getATrueSuccessor() = succ and
|
|
||||||
skipsLoop = false
|
skipsLoop = false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user