@@ -270,43 +270,69 @@ module ControlFlow {
270270 b = false
271271 }
272272
273- /** Holds if this guard ensures that the result of `nd` is `b`. */
274- predicate ensures ( DataFlow:: Node nd , boolean b ) {
273+ /**
274+ * DEPRECATED: Use `Guard.controls` from `semmle.go.controlflow.Guards`
275+ * instead.
276+ *
277+ * Holds if this guard ensures that the result of `nd` is `b`.
278+ */
279+ deprecated predicate ensures ( DataFlow:: Node nd , boolean b ) {
275280 this .ensuresAux ( any ( Expr e | nd = DataFlow:: exprNode ( e ) ) , b )
276281 }
277282
278- /** Holds if this guard ensures that `lesser <= greater + bias` holds. */
279- predicate ensuresLeq ( DataFlow:: Node lesser , DataFlow:: Node greater , int bias ) {
283+ /**
284+ * DEPRECATED: Use `guardEnsuresLeq` from `semmle.go.controlflow.Guards`
285+ * instead.
286+ *
287+ * Holds if this guard ensures that `lesser <= greater + bias` holds.
288+ */
289+ deprecated predicate ensuresLeq ( DataFlow:: Node lesser , DataFlow:: Node greater , int bias ) {
280290 exists ( DataFlow:: RelationalComparisonNode rel , boolean b |
281- this .ensures ( rel , b ) and
291+ this .ensuresAux ( rel . asExpr ( ) , b ) and
282292 rel .leq ( b , lesser , greater , bias )
283293 )
284294 or
285- this .ensuresEq ( lesser , greater ) and
295+ exists ( DataFlow:: EqualityTestNode eq , boolean b |
296+ this .ensuresAux ( eq .asExpr ( ) , b ) and
297+ eq .eq ( b , lesser , greater )
298+ ) and
286299 bias = 0
287300 }
288301
289- /** Holds if this guard ensures that `i = j` holds. */
290- predicate ensuresEq ( DataFlow:: Node i , DataFlow:: Node j ) {
302+ /**
303+ * DEPRECATED: Use `guardEnsuresEq` from `semmle.go.controlflow.Guards`
304+ * instead.
305+ *
306+ * Holds if this guard ensures that `i = j` holds.
307+ */
308+ deprecated predicate ensuresEq ( DataFlow:: Node i , DataFlow:: Node j ) {
291309 exists ( DataFlow:: EqualityTestNode eq , boolean b |
292- this .ensures ( eq , b ) and
310+ this .ensuresAux ( eq . asExpr ( ) , b ) and
293311 eq .eq ( b , i , j )
294312 )
295313 }
296314
297- /** Holds if this guard ensures that `i != j` holds. */
298- predicate ensuresNeq ( DataFlow:: Node i , DataFlow:: Node j ) {
315+ /**
316+ * DEPRECATED: Use `guardEnsuresNeq` from `semmle.go.controlflow.Guards`
317+ * instead.
318+ *
319+ * Holds if this guard ensures that `i != j` holds.
320+ */
321+ deprecated predicate ensuresNeq ( DataFlow:: Node i , DataFlow:: Node j ) {
299322 exists ( DataFlow:: EqualityTestNode eq , boolean b |
300- this .ensures ( eq , b .booleanNot ( ) ) and
323+ this .ensuresAux ( eq . asExpr ( ) , b .booleanNot ( ) ) and
301324 eq .eq ( b , i , j )
302325 )
303326 }
304327
305328 /**
329+ * DEPRECATED: Use `Guard.controls` from `semmle.go.controlflow.Guards`
330+ * instead.
331+ *
306332 * Holds if this guard dominates basic block `bb`, that is, the guard
307333 * is known to hold at `bb`.
308334 */
309- predicate dominates ( ReachableBasicBlock bb ) {
335+ deprecated predicate dominates ( ReachableBasicBlock bb ) {
310336 this = bb .getANode ( ) or
311337 this .dominates ( bb .getImmediateDominator ( ) )
312338 }
0 commit comments