Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clang-query> match ifStmt(hasCondition(binaryOperator(hasRHS(integerLiteral(equals(0)))))
- 1:2: Error parsing argument 1 for matcher ifStmt.
- 1:9: Error parsing argument 1 for matcher hasCondition.
- 1:22: Error parsing argument 1 for matcher binaryOperator.
- 1:37: Error parsing argument 1 for matcher hasRHS.
- 1:44: Error parsing argument 1 for matcher integerLiteral.
- 1:59: Matcher not found: equals
- Matcher<IntegerLiteral> equals const ValueT Value
- Matches literals that are equal to the given value of type ValueT.
- Given
- f('false, 3.14, 42);
- characterLiteral(equals(0))
- matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
- match false
- floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
- match 3.14
- integerLiteral(equals(42))
- matches 42
- Note that you cannot directly match a negative numeric literal because the
- minus sign is not part of the literal: It is a unary operator whose operand
- is the positive numeric literal. Instead, you must use a unaryOperator()
- matcher to match the minus sign:
- unaryOperator(hasOperatorName("-"),
- hasUnaryOperand(integerLiteral(equals(13))))
- Usable as: Matcher<CharacterLiteral>, Matcher<CXXBoolLiteralExpr>,
- Matcher<FloatingLiteral>, Matcher<IntegerLiteral>
Add Comment
Please, Sign In to add comment