-
Binop (BinaryOp op, ExpressionPattern &a, ExpressionPattern &b)— Match a binary operator, for examplea + b. Typically you do not need to explicitly create a Binop, because there are overloaded operators on ExpressionPatterns that will do so automatically. However, there are occasions where direct use is convenient. The possible values foropare listed in ><install_dir>/sdk/headers/ast/cc_flags.hpp -
SymBinop(BinaryOp op, ExpressionPattern &a, ExpressionPattern &b— Match an operator that is symmetric, for examplea + b. Any of theBinopoperators can be used, but only the symmetric ones make sense. This is useful when theaandbpatterns are different, asSymBinopmatches both(a,b)and(b,a)orderings. -
ASymBinop(BinaryOp op, ExpressionPattern &, ExpressionPattern &b)— Match an anti-symmetric operator or its dual. For example,a < borb > a. Only anti-symmetric binops (inequalities) can be used. -
Unop(UnaryOp op, ExpressionPattern &)— Match a unary operator, for example-a. As withBinOp, direct use ofUnopis only occasionally useful, since overloaded operators are provided that cover most of the common uses. The possible values foropare listed in ><install_dir>/sdk/headers/ast/cc_flags.hpp -
MapAccess(ExpressionPattern &map, ExpressionPattern &key)This expression pattern applies only to JavaScript.
Properties of other expressions will be represented by this. Also, global variables are represented by a
MapAccessoff aGlobalVarmap. For example, the following will match all global variable expressions:GlobalVar global; MapAccess access(global, _); if (MATCH(access)) { ... } -
Star— Match a dereference, for example*p. This will not match ifpis an array (see below). -
ArrayIndex— Match an array element reference, i.e.a[i]whereais an array. This will not match ifais a pointer. -
Assign— Match an assignment or compound assignment, for examplea = bora *= 2. -
Effect— Match an increment or decrement, for example++aorb--. -
CondPattern— Match a use of the?:operator. -
Const_int— Match an integer literal. -
Const_float— Match a floating point literal. -
Const_string— Match a string literal. -
Component— Match a use of a field of an object, for examplea.b. -
Cast— Match a cast. The flags control whether automatic (implicit) casts, manual (explicit) casts, or both are matched. This includes C++-style casts such asreinterpret_castbut notdynamic_cast. -
StmtExpr— Match a GNU statement expression, for example({ x; y; z; }). -
This— Match a use, either explicit or implicit, of thethisexpression. -
Addr— Match an address-of expression, for example&e. -
Throw— Matches athrowexpression. -
NewPattern— Matches anewexpression. -
DeletePattern— Matches adeleteexpression. -
DynamicCast— Matches adynamic_castexpression.
The two remaining primitive constructs are variable reference and function call, which are addressed in subsequent sections.