diff --git a/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll b/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll index 0965217c595..e4d157ca389 100644 --- a/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll +++ b/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll @@ -1200,28 +1200,6 @@ module Make0 Ast> { n2.isAfterValue(boollit, any(BooleanSuccessor t | t.getValue() = boollit.getValue())) ) or - exists(ExprStmt exprstmt | - n1.isBefore(exprstmt) and - n2.isBefore(exprstmt.getExpr()) - // the `isAfter(exprstmt.getExpr())` to `isAfter(exprstmt)` case is handled by `propagatesValue` above. - ) - or - exists(BlockStmt blockstmt | - n1.isBefore(blockstmt) and - n2.isBefore(blockstmt.getStmt(0)) - or - not exists(blockstmt.getStmt(_)) and - n1.isBefore(blockstmt) and - n2.isAfter(blockstmt) and - not simpleLeafNode(blockstmt) - or - exists(int i | - n1.isAfter(blockstmt.getStmt(i)) and - n2.isBefore(blockstmt.getStmt(i + 1)) - ) - // the `isAfter(blockstmt.getLastStmt())` to `isAfter(blockstmt)` case is handled by `propagatesValue` above. - ) - or exists(IfStmt ifstmt | n1.isBefore(ifstmt) and n2.isBefore(ifstmt.getCondition()) @@ -1525,8 +1503,11 @@ module Make0 Ast> { ( n1.isBefore(ast) and not exists(getRankedChild(ast, _)) and not simpleLeafNode(ast) or - exists(int i | - n1.isAfter(getRankedChild(ast, i)) and not exists(getRankedChild(ast, i + 1)) + exists(int i, AstNode last | + last = getRankedChild(ast, i) and + not exists(getRankedChild(ast, i + 1)) and + n1.isAfter(last) and + not propagatesValue(last, ast) ) ) and (if postOrInOrder(ast) then n2.isIn(ast) else n2.isAfter(ast))