@@ -440,6 +440,9 @@ class ConditionalLoop extends Loop, TConditionalLoop {
440440 or
441441 pred = "getCondition" and result = this .getCondition ( )
442442 }
443+
444+ /** Holds if the loop body is entered when the condition is `condValue`. */
445+ predicate entersLoopWhenConditionIs ( boolean condValue ) { none ( ) }
443446}
444447
445448/**
@@ -463,6 +466,12 @@ class WhileExpr extends ConditionalLoop, TWhileExpr {
463466
464467 final override Expr getCondition ( ) { toGenerated ( result ) = g .getCondition ( ) }
465468
469+ /**
470+ * Holds if the loop body is entered when the condition is `condValue`. For
471+ * `while` loops, this holds when `condValue` is true.
472+ */
473+ final override predicate entersLoopWhenConditionIs ( boolean condValue ) { condValue = true }
474+
466475 final override string toString ( ) { result = "while ..." }
467476}
468477
@@ -487,6 +496,12 @@ class UntilExpr extends ConditionalLoop, TUntilExpr {
487496
488497 final override Expr getCondition ( ) { toGenerated ( result ) = g .getCondition ( ) }
489498
499+ /**
500+ * Holds if the loop body is entered when the condition is `condValue`. For
501+ * `until` loops, this holds when `condValue` is false.
502+ */
503+ final override predicate entersLoopWhenConditionIs ( boolean condValue ) { condValue = false }
504+
490505 final override string toString ( ) { result = "until ..." }
491506}
492507
@@ -505,6 +520,12 @@ class WhileModifierExpr extends ConditionalLoop, TWhileModifierExpr {
505520
506521 final override Expr getCondition ( ) { toGenerated ( result ) = g .getCondition ( ) }
507522
523+ /**
524+ * Holds if the loop body is entered when the condition is `condValue`. For
525+ * `while`-modifier loops, this holds when `condValue` is true.
526+ */
527+ final override predicate entersLoopWhenConditionIs ( boolean condValue ) { condValue = true }
528+
508529 final override string getAPrimaryQlClass ( ) { result = "WhileModifierExpr" }
509530
510531 final override string toString ( ) { result = "... while ..." }
@@ -525,6 +546,12 @@ class UntilModifierExpr extends ConditionalLoop, TUntilModifierExpr {
525546
526547 final override Expr getCondition ( ) { toGenerated ( result ) = g .getCondition ( ) }
527548
549+ /**
550+ * Holds if the loop body is entered when the condition is `condValue`. For
551+ * `until`-modifier loops, this holds when `condValue` is false.
552+ */
553+ final override predicate entersLoopWhenConditionIs ( boolean condValue ) { condValue = false }
554+
528555 final override string getAPrimaryQlClass ( ) { result = "UntilModifierExpr" }
529556
530557 final override string toString ( ) { result = "... until ..." }
0 commit comments