@@ -62,45 +62,6 @@ class BasicBlock extends TBasicBlockStart {
6262 */
6363 BasicBlock getAFalseSuccessor ( ) { result .getFirstNode ( ) = getLastNode ( ) .getAFalseSuccessor ( ) }
6464
65- /**
66- * Gets an immediate `null` successor, if any.
67- *
68- * An immediate `null` successor is a successor that is reached when
69- * the expression that ends this basic block evaluates to `null`.
70- *
71- * Example:
72- *
73- * ```
74- * x?.M();
75- * return;
76- * ```
77- *
78- * The node on line 2 is an immediate `null` successor of the node
79- * `x` on line 1.
80- */
81- deprecated BasicBlock getANullSuccessor ( ) {
82- result .getFirstNode ( ) = getLastNode ( ) .getANullSuccessor ( )
83- }
84-
85- /**
86- * Gets an immediate non-`null` successor, if any.
87- *
88- * An immediate non-`null` successor is a successor that is reached when
89- * the expression that ends this basic block evaluates to a non-`null` value.
90- *
91- * Example:
92- *
93- * ```
94- * x?.M();
95- * ```
96- *
97- * The node `x?.M()`, representing the call to `M`, is a non-`null` successor
98- * of the node `x`.
99- */
100- deprecated BasicBlock getANonNullSuccessor ( ) {
101- result .getFirstNode ( ) = getLastNode ( ) .getANonNullSuccessor ( )
102- }
103-
10465 /** Gets the control flow node at a specific (zero-indexed) position in this basic block. */
10566 ControlFlow:: Node getNode ( int pos ) { bbIndex ( getFirstNode ( ) , result , pos ) }
10667
@@ -511,81 +472,4 @@ class ConditionBlock extends BasicBlock {
511472
512473 exists ( BasicBlock succ | this .immediatelyControls ( succ , s ) | succ .dominates ( controlled ) )
513474 }
514-
515- /**
516- * Holds if basic block `controlled` is controlled by this basic block with
517- * nullness check `isNull`. That is, `controlled` can only be reached from
518- * the callable entry point by going via the `null` edge (`isNull = true`)
519- * or non-`null` edge (`isNull = false`) out of this basic block.
520- */
521- deprecated predicate controlsNullness ( BasicBlock controlled , boolean isNull ) {
522- this .controls ( controlled , any ( NullnessSuccessor s | s .getValue ( ) = isNull ) )
523- }
524-
525- /**
526- * Holds if basic block `controlled` is controlled by this basic block with
527- * Boolean value `testIsTrue`. That is, `controlled` can only be reached from
528- * the callable entry point by going via the true edge (`testIsTrue = true`)
529- * or false edge (`testIsTrue = false`) out of this basic block.
530- *
531- * Moreover, `cond` is a sub expression of the expression ending this basic
532- * block that must have evaluated to `condIsTrue`. For example, in
533- *
534- * ```
535- * if (x & !y)
536- * f(x, y);
537- * ```
538- *
539- * `f(x, y)` is controlled by `x & !y` evaluating to `true`, but also by sub
540- * conditions `x` and `y` evaluating to `true` and `false`, respectively.
541- */
542- // Note that this is only needed when using non-short-circuit logic. When using
543- // short-circuit logic, the control flow graph will have appropriate true/false
544- // edges for the sub conditions:
545- //
546- // Short-circuit logic CFG -- `if (x && y) A B`:
547- // x && y --> x --true--> y --true--> A
548- // | |
549- // | false
550- // | |
551- // | V
552- // \--false--> B
553- //
554- // Non-short-circuit logic CFG -- `if (x & y) A B`:
555- // x --> y --> x & y --true--> A
556- // \--false--> B
557- //
558- // In the former case, `x` and `y` control `A`, in the latter case
559- // only `x & y` controls `A` if we do not take sub conditions into account.
560- deprecated predicate controlsSubCond (
561- BasicBlock controlled , boolean testIsTrue , Expr cond , boolean condIsTrue
562- ) {
563- impliesSub ( getLastNode ( ) .getElement ( ) , cond , testIsTrue , condIsTrue ) and
564- controls ( controlled , any ( BooleanSuccessor s | s .getValue ( ) = testIsTrue ) )
565- }
566- }
567-
568- /**
569- * Holds if `e2` is a sub expression of (Boolean) expression `e1`, and
570- * if `e1` has value `b1` then `e2` must have value `b2`.
571- */
572- deprecated private predicate impliesSub ( Expr e1 , Expr e2 , boolean b1 , boolean b2 ) {
573- if e1 instanceof LogicalNotExpr
574- then impliesSub ( e1 .( LogicalNotExpr ) .getOperand ( ) , e2 , b1 .booleanNot ( ) , b2 )
575- else
576- if e1 instanceof BitwiseAndExpr or e1 instanceof LogicalAndExpr
577- then
578- impliesSub ( e1 .( BinaryOperation ) .getAnOperand ( ) , e2 , b1 , b2 ) and
579- b1 = true
580- else
581- if e1 instanceof BitwiseOrExpr or e1 instanceof LogicalOrExpr
582- then (
583- impliesSub ( e1 .( BinaryOperation ) .getAnOperand ( ) , e2 , b1 , b2 ) and
584- b1 = false
585- ) else (
586- e1 .getType ( ) instanceof BoolType and
587- e1 = e2 and
588- b1 = b2 and
589- ( b1 = true or b1 = false )
590- )
591475}
0 commit comments