We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent edc5e5f commit a7d9715Copy full SHA for a7d9715
cpp/ql/src/semmle/code/cpp/exprs/Expr.qll
@@ -539,6 +539,17 @@ class BinaryOperation extends Operation, @bin_op_expr {
539
/** Gets the right operand of this binary operation. */
540
Expr getRightOperand() { this.hasChild(result, 1) }
541
542
+ /**
543
+ * Holds if `e1` and `e2` (in either order) are the two operands of this
544
+ * binary operation.
545
+ */
546
+ predicate hasOperands(Expr e1, Expr e2) {
547
+ exists(int i | i in [0 .. 1] |
548
+ this.hasChild(e1, i) and
549
+ this.hasChild(e2, 1 - i)
550
+ )
551
+ }
552
+
553
override string toString() { result = "... " + this.getOperator() + " ..." }
554
555
override predicate mayBeImpure() {
0 commit comments