qtil
advanced-security/qtil-swift 0.0.3
Search

Predicate TwoOperands::set

Holds if operandA and operandB are operands of operation, and that they are not the same operand.

Example usage:

predicate myBinaryTest(BinaryExpr e) {
  exists(Expr a, Expr b |
    TwoOperands<BinaryExpr>::set(e, a, b) and
    a.isInteger() and
    b.isConstant()
  )
}

Note: this predicate is less fluent than the class API, but it is simpler for CodeQL to understand and optimize. It is also not possible to mistakenly match the same operand twice using this API.

For an alternative API, see the Set class.

Import path

import qtil.ast.TwoOperands
predicate set(HasOperands operation, Operand operandA, Operand operandB)