Draft the KAST expression
The nodes you identified in the previous step are: IfStmt, Cond, and BinaryExpr. Put this together into the KAST expression to produce:
//IfStmt / Cond::BinaryExpr [ @Op = KTC_OPCODE_ASSIGN ]
Note that KAST provides a built-in function that returns the value of the Op attribute for an expression node: getOperationCode(). We will use this function in this tutorial in place of explicitly querying a particular attribute, leading us to the following KAST statement:
//IfStmt / Cond::BinaryExpr [ getOperationCode() = KTC_OPCODE_ASSIGN ]
This KAST expression will search the AST for if statements that contain an assignment in the condition statement. (For detailed information about the elements of KAST expressions, see C/C++ KAST syntax reference.)
Now that we have a KAST expression, our next step is testing the expression.