class Matcher

Declaration

template <typename T>
class Matcher { /* full declaration omitted */ };

Description

Wrapper of a MatcherInterface <T > *that allows copying. A Matcher <Base > can be used anywhere a Matcher <Derived > is required. This establishes an is-a relationship which is reverse to the AST hierarchy. In other words, Matcher <T > is contravariant with respect to T. The relationship is built via a type conversion operator rather than a type hierarchy to be able to templatize the type hierarchy instead of spelling it out.

Declared at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:570

Templates

T

Member Variables

private clang::ast_matchers::internal::DynTypedMatcher Implementation

Method Overview

  • public Matcher<type-parameter-0-0>(MatcherInterface<T> * Implementation)
  • private Matcher<type-parameter-0-0>(const clang::ast_matchers::internal::DynTypedMatcher & Implementation)
  • public template <typename From> Matcher<type-parameter-0-0>(const Matcher<From> & Other, std::enable_if_t<std::is_base_of<From, T>::value && !std::is_same<From, T>::value> * = nullptr)
  • public template <typename TypeT> Matcher<type-parameter-0-0>(const Matcher<TypeT> & Other, std::enable_if_t<std::is_same<T, QualType>::value && std::is_same<TypeT, Type>::value> * = nullptr)
  • public template <typename To>Matcher<To> dynCastTo() const &
  • public template <typename To>Matcher<To> dynCastTo() &&
  • public DynTypedMatcher::MatcherIDType getID() const
  • public bool matches(const T & Node, clang::ast_matchers::internal::ASTMatchFinder * Finder, clang::ast_matchers::internal::BoundNodesTreeBuilder * Builder) const
  • public clang::ast_matchers::internal::DynTypedMatcher operator DynTypedMatcher() const &
  • public clang::ast_matchers::internal::DynTypedMatcher operator DynTypedMatcher() &&
  • private static clang::ast_matchers::internal::DynTypedMatcher restrictMatcher(const clang::ast_matchers::internal::DynTypedMatcher & Other)

Methods

Matcher<type - parameter - 0 - 0>(
    MatcherInterface<T>* Implementation)

Description

Takes ownership of the provided implementation pointer.

Declared at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:573

Parameters

MatcherInterface<T>* Implementation

Matcher<type - parameter - 0 - 0>(
    const clang::ast_matchers::internal::
        DynTypedMatcher& Implementation)

Declared at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:668

Parameters

const clang::ast_matchers::internal:: DynTypedMatcher& Implementation

template <typename From>
Matcher<type - parameter - 0 - 0>(
    const Matcher<From>& Other,
    std::enable_if_t<
        std::is_base_of<From, T>::value &&
        !std::is_same<From, T>::value>* = nullptr)

Description

Implicitly converts \c Other to a Matcher <T >. Requires \c T to be derived from \c From.

Declared at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:580

Templates

From

Parameters

const Matcher<From>& Other
std::enable_if_t< std::is_base_of<From, T>::value && !std::is_same<From, T>::value>* = nullptr

template <typename TypeT>
Matcher<type - parameter - 0 - 0>(
    const Matcher<TypeT>& Other,
    std::enable_if_t<
        std::is_same<T, QualType>::value &&
        std::is_same<TypeT, Type>::value>* =
        nullptr)

Description

Implicitly converts \c Matcher<Type> to \c Matcher<QualType>. The resulting matcher is not strict, i.e. ignores qualifiers.

Declared at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:592

Templates

TypeT

Parameters

const Matcher<TypeT>& Other
std::enable_if_t< std::is_same<T, QualType>::value && std::is_same<TypeT, Type>::value>* = nullptr

template <typename To>
Matcher<To> dynCastTo() const&

Description

Convert \c this into a \c Matcher<T> by applying dyn_cast < > to the argument.\c To must be a base class of \c T.

Declared at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:600

Templates

To

template <typename To>
Matcher<To> dynCastTo() &&

Declared at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:605

Templates

To

DynTypedMatcher::MatcherIDType getID() const

Description

Returns an ID that uniquely identifies the matcher.

Declared at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:618

bool matches(
    const T& Node,
    clang::ast_matchers::internal::ASTMatchFinder*
        Finder,
    clang::ast_matchers::internal::
        BoundNodesTreeBuilder* Builder) const

Description

Forwards the call to the underlying MatcherInterface <T > pointer.

Declared at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:611

Parameters

const T& Node
clang::ast_matchers::internal::ASTMatchFinder* Finder
clang::ast_matchers::internal:: BoundNodesTreeBuilder* Builder

clang::ast_matchers::internal::DynTypedMatcher
operator DynTypedMatcher() const&

Description

Extract the dynamic matcher. The returned matcher keeps the same restrictions as \c this and remembers that it is meant to support nodes of type \c T.

Declared at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:626

clang::ast_matchers::internal::DynTypedMatcher
operator DynTypedMatcher() &&

Declared at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:628

static clang::ast_matchers::internal::
    DynTypedMatcher
    restrictMatcher(
        const clang::ast_matchers::internal::
            DynTypedMatcher& Other)

Declared at: clang/include/clang/ASTMatchers/ASTMatchersInternal.h:664

Parameters

const clang::ast_matchers::internal:: DynTypedMatcher& Other