ΒΆtemplate <typename ValueT>
internal::PolymorphicMatcher<
    clang::ast_matchers::internal::
        ValueEqualsMatcher,
    void(internal::AllNodeBaseTypes),
    ValueT>
equals(const ValueT& Value)

Description

Matches literals that are equal to the given value of type ValueT. Given characterLiteral(equals(0)) matches ' \ 0' 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 >

Declared at: clang/include/clang/ASTMatchers/ASTMatchers.h:5587

Templates

ValueT

Parameters

const ValueT& Value