@@ -258,10 +258,12 @@ module ControlFlow {
258258 }
259259
260260 /**
261+ * DEPRECATED: Use `Guard` from `semmle.go.controlflow.Guards` instead.
262+ *
261263 * A control-flow node recording the fact that a certain expression has a known
262264 * Boolean value at this point in the program.
263265 */
264- class ConditionGuardNode extends IR:: Instruction {
266+ deprecated class ConditionGuardNode extends IR:: Instruction {
265267 Expr cond ;
266268 boolean outcome ;
267269
@@ -292,43 +294,69 @@ module ControlFlow {
292294 b = false
293295 }
294296
295- /** Holds if this guard ensures that the result of `nd` is `b`. */
296- predicate ensures ( DataFlow:: Node nd , boolean b ) {
297+ /**
298+ * DEPRECATED: Use `Guard.controls` from `semmle.go.controlflow.Guards`
299+ * instead.
300+ *
301+ * Holds if this guard ensures that the result of `nd` is `b`.
302+ */
303+ deprecated predicate ensures ( DataFlow:: Node nd , boolean b ) {
297304 this .ensuresAux ( any ( Expr e | nd = DataFlow:: exprNode ( e ) ) , b )
298305 }
299306
300- /** Holds if this guard ensures that `lesser <= greater + bias` holds. */
301- predicate ensuresLeq ( DataFlow:: Node lesser , DataFlow:: Node greater , int bias ) {
307+ /**
308+ * DEPRECATED: Use `guardEnsuresLeq` from `semmle.go.controlflow.Guards`
309+ * instead.
310+ *
311+ * Holds if this guard ensures that `lesser <= greater + bias` holds.
312+ */
313+ deprecated predicate ensuresLeq ( DataFlow:: Node lesser , DataFlow:: Node greater , int bias ) {
302314 exists ( DataFlow:: RelationalComparisonNode rel , boolean b |
303- this .ensures ( rel , b ) and
315+ this .ensuresAux ( rel . asExpr ( ) , b ) and
304316 rel .leq ( b , lesser , greater , bias )
305317 )
306318 or
307- this .ensuresEq ( lesser , greater ) and
319+ exists ( DataFlow:: EqualityTestNode eq , boolean b |
320+ this .ensuresAux ( eq .asExpr ( ) , b ) and
321+ eq .eq ( b , lesser , greater )
322+ ) and
308323 bias = 0
309324 }
310325
311- /** Holds if this guard ensures that `i = j` holds. */
312- predicate ensuresEq ( DataFlow:: Node i , DataFlow:: Node j ) {
326+ /**
327+ * DEPRECATED: Use `guardEnsuresEq` from `semmle.go.controlflow.Guards`
328+ * instead.
329+ *
330+ * Holds if this guard ensures that `i = j` holds.
331+ */
332+ deprecated predicate ensuresEq ( DataFlow:: Node i , DataFlow:: Node j ) {
313333 exists ( DataFlow:: EqualityTestNode eq , boolean b |
314- this .ensures ( eq , b ) and
334+ this .ensuresAux ( eq . asExpr ( ) , b ) and
315335 eq .eq ( b , i , j )
316336 )
317337 }
318338
319- /** Holds if this guard ensures that `i != j` holds. */
320- predicate ensuresNeq ( DataFlow:: Node i , DataFlow:: Node j ) {
339+ /**
340+ * DEPRECATED: Use `guardEnsuresNeq` from `semmle.go.controlflow.Guards`
341+ * instead.
342+ *
343+ * Holds if this guard ensures that `i != j` holds.
344+ */
345+ deprecated predicate ensuresNeq ( DataFlow:: Node i , DataFlow:: Node j ) {
321346 exists ( DataFlow:: EqualityTestNode eq , boolean b |
322- this .ensures ( eq , b .booleanNot ( ) ) and
347+ this .ensuresAux ( eq . asExpr ( ) , b .booleanNot ( ) ) and
323348 eq .eq ( b , i , j )
324349 )
325350 }
326351
327352 /**
353+ * DEPRECATED: Use `Guard.controls` from `semmle.go.controlflow.Guards`
354+ * instead.
355+ *
328356 * Holds if this guard dominates basic block `bb`, that is, the guard
329357 * is known to hold at `bb`.
330358 */
331- predicate dominates ( ReachableBasicBlock bb ) {
359+ deprecated predicate dominates ( ReachableBasicBlock bb ) {
332360 this = bb .getANode ( ) or
333361 this .dominates ( bb .getImmediateDominator ( ) )
334362 }
0 commit comments