@@ -261,10 +261,12 @@ module ControlFlow {
261261 }
262262
263263 /**
264+ * DEPRECATED: Use `Guard` from `semmle.go.controlflow.Guards` instead.
265+ *
264266 * A control-flow node recording the fact that a certain expression has a known
265267 * Boolean value at this point in the program.
266268 */
267- class ConditionGuardNode extends IR:: Instruction {
269+ deprecated class ConditionGuardNode extends IR:: Instruction {
268270 Expr cond ;
269271 boolean outcome ;
270272
@@ -297,43 +299,69 @@ module ControlFlow {
297299 b = false
298300 }
299301
300- /** Holds if this guard ensures that the result of `nd` is `b`. */
301- predicate ensures ( DataFlow:: Node nd , boolean b ) {
302+ /**
303+ * DEPRECATED: Use `Guard.controls` from `semmle.go.controlflow.Guards`
304+ * instead.
305+ *
306+ * Holds if this guard ensures that the result of `nd` is `b`.
307+ */
308+ deprecated predicate ensures ( DataFlow:: Node nd , boolean b ) {
302309 this .ensuresAux ( any ( Expr e | nd = DataFlow:: exprNode ( e ) ) , b )
303310 }
304311
305- /** Holds if this guard ensures that `lesser <= greater + bias` holds. */
306- predicate ensuresLeq ( DataFlow:: Node lesser , DataFlow:: Node greater , int bias ) {
312+ /**
313+ * DEPRECATED: Use `guardEnsuresLeq` from `semmle.go.controlflow.Guards`
314+ * instead.
315+ *
316+ * Holds if this guard ensures that `lesser <= greater + bias` holds.
317+ */
318+ deprecated predicate ensuresLeq ( DataFlow:: Node lesser , DataFlow:: Node greater , int bias ) {
307319 exists ( DataFlow:: RelationalComparisonNode rel , boolean b |
308- this .ensures ( rel , b ) and
320+ this .ensuresAux ( rel . asExpr ( ) , b ) and
309321 rel .leq ( b , lesser , greater , bias )
310322 )
311323 or
312- this .ensuresEq ( lesser , greater ) and
324+ exists ( DataFlow:: EqualityTestNode eq , boolean b |
325+ this .ensuresAux ( eq .asExpr ( ) , b ) and
326+ eq .eq ( b , lesser , greater )
327+ ) and
313328 bias = 0
314329 }
315330
316- /** Holds if this guard ensures that `i = j` holds. */
317- predicate ensuresEq ( DataFlow:: Node i , DataFlow:: Node j ) {
331+ /**
332+ * DEPRECATED: Use `guardEnsuresEq` from `semmle.go.controlflow.Guards`
333+ * instead.
334+ *
335+ * Holds if this guard ensures that `i = j` holds.
336+ */
337+ deprecated predicate ensuresEq ( DataFlow:: Node i , DataFlow:: Node j ) {
318338 exists ( DataFlow:: EqualityTestNode eq , boolean b |
319- this .ensures ( eq , b ) and
339+ this .ensuresAux ( eq . asExpr ( ) , b ) and
320340 eq .eq ( b , i , j )
321341 )
322342 }
323343
324- /** Holds if this guard ensures that `i != j` holds. */
325- predicate ensuresNeq ( DataFlow:: Node i , DataFlow:: Node j ) {
344+ /**
345+ * DEPRECATED: Use `guardEnsuresNeq` from `semmle.go.controlflow.Guards`
346+ * instead.
347+ *
348+ * Holds if this guard ensures that `i != j` holds.
349+ */
350+ deprecated predicate ensuresNeq ( DataFlow:: Node i , DataFlow:: Node j ) {
326351 exists ( DataFlow:: EqualityTestNode eq , boolean b |
327- this .ensures ( eq , b .booleanNot ( ) ) and
352+ this .ensuresAux ( eq . asExpr ( ) , b .booleanNot ( ) ) and
328353 eq .eq ( b , i , j )
329354 )
330355 }
331356
332357 /**
358+ * DEPRECATED: Use `Guard.controls` from `semmle.go.controlflow.Guards`
359+ * instead.
360+ *
333361 * Holds if this guard dominates basic block `bb`, that is, the guard
334362 * is known to hold at `bb`.
335363 */
336- predicate dominates ( ReachableBasicBlock bb ) {
364+ deprecated predicate dominates ( ReachableBasicBlock bb ) {
337365 this = bb .getANode ( ) or
338366 this .dominates ( bb .getImmediateDominator ( ) )
339367 }
0 commit comments