diff --git a/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll b/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll index 514a68cba474..b7eda481103f 100644 --- a/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll +++ b/shared/controlflow/codeql/controlflow/ControlFlowGraph.qll @@ -519,13 +519,14 @@ module Make0 Ast> { or n instanceof GotoStmt or + n instanceof LogicalNotExpr + or n instanceof Expr and exists(getChild(n, _)) and not Input1::preOrderExpr(n) and not n instanceof LogicalAndExpr and not n instanceof LogicalOrExpr and not n instanceof NullCoalescingExpr and - not n instanceof LogicalNotExpr and not n instanceof ConditionalExpr and not n instanceof Switch and not n instanceof Case @@ -633,6 +634,10 @@ module Make0 Ast> { private string patternMatchTrueTag() { result = "[MatchTrue]" } + private string logicalNotTag(Boolean value) { + if value = true then result = "[LogicalNotTrue]" else result = "[LogicalNotFalse]" + } + /** * Holds if an additional node tagged with `tag` should be created for * `n`. Edges targeting such nodes are labeled with `t` and therefore `t` @@ -648,6 +653,12 @@ module Make0 Ast> { n instanceof PatternMatchExpr and tag = patternMatchTrueTag() and t.(BooleanSuccessor).getValue() = true + or + n instanceof LogicalNotExpr and + exists(Boolean b | + tag = logicalNotTag(b) and + t.(BooleanSuccessor).getValue() = b + ) } /** @@ -1456,6 +1467,9 @@ module Make0 Ast> { or exists(BooleanSuccessor t | n1.isAfterValue(notexpr.getOperand(), t) and + n2.isAdditional(notexpr, logicalNotTag(t.getValue())) + or + n1.isAdditional(notexpr, logicalNotTag(t.getValue())) and n2.isAfterValue(notexpr, t.getDual()) ) )