clang API Documentation

Classes | Namespaces | Defines | Functions
Marshallers.h File Reference

Functions templates and classes to wrap matcher construct functions. More...

#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/ASTMatchers/Dynamic/Diagnostics.h"
#include "clang/ASTMatchers/Dynamic/VariantValue.h"
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/STLExtras.h"
#include <string>
#include "clang/Basic/AttrList.inc"
Include dependency graph for Marshallers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  clang::ast_matchers::dynamic::internal::ArgTypeTraits< const T & >
struct  clang::ast_matchers::dynamic::internal::ArgTypeTraits< std::string >
struct  clang::ast_matchers::dynamic::internal::ArgTypeTraits< StringRef >
struct  clang::ast_matchers::dynamic::internal::ArgTypeTraits< ast_matchers::internal::Matcher< T > >
struct  clang::ast_matchers::dynamic::internal::ArgTypeTraits< unsigned >
struct  clang::ast_matchers::dynamic::internal::ArgTypeTraits< attr::Kind >
class  clang::ast_matchers::dynamic::internal::MatcherDescriptor
 Matcher descriptor interface. More...
class  clang::ast_matchers::dynamic::internal::FixedArgCountMatcherDescriptor
 Simple callback implementation. Marshaller and function are provided. More...
struct  clang::ast_matchers::dynamic::internal::BuildReturnTypeVector< T >
struct  clang::ast_matchers::dynamic::internal::BuildReturnTypeVector< ast_matchers::internal::Matcher< T > >
struct  clang::ast_matchers::dynamic::internal::BuildReturnTypeVector< ast_matchers::internal::BindableMatcher< T > >
class  clang::ast_matchers::dynamic::internal::VariadicFuncMatcherDescriptor
 Matcher descriptor for variadic functions. More...
class  clang::ast_matchers::dynamic::internal::DynCastAllOfMatcherDescriptor
 Return CK_Trivial when appropriate for VariadicDynCastAllOfMatchers. More...
class  clang::ast_matchers::dynamic::internal::AdaptativeOverloadCollector< ArgumentAdapterT, FromTypes, ToTypes >
 Helper class used to collect all the possible overloads of an argument adaptative matcher function. More...
class  clang::ast_matchers::dynamic::internal::OverloadedMatcherDescriptor
 MatcherDescriptor that wraps multiple "overloads" of the same matcher. More...
class  clang::ast_matchers::dynamic::internal::VariadicOperatorMatcherDescriptor
 Variadic operator marshaller function. More...

Namespaces

namespace  clang
namespace  clang::ast_matchers
namespace  clang::ast_matchers::dynamic
namespace  clang::ast_matchers::dynamic::internal

Defines

#define ATTR(X)   .Case("attr::" #X, attr:: X)
#define CHECK_ARG_COUNT(count)
 Helper macros to check the arguments on all marshaller functions.
#define CHECK_ARG_TYPE(index, type)

Functions

bool clang::ast_matchers::dynamic::internal::isRetKindConvertibleTo (ArrayRef< ast_type_traits::ASTNodeKind > RetKinds, ast_type_traits::ASTNodeKind Kind, unsigned *Specificity, ast_type_traits::ASTNodeKind *LeastDerivedKind)
template<class PolyMatcher >
static void clang::ast_matchers::dynamic::internal::mergePolyMatchers (const PolyMatcher &Poly, std::vector< DynTypedMatcher > &Out, ast_matchers::internal::EmptyTypeList)
 Helper methods to extract and merge all possible typed matchers out of the polymorphic object.
template<class PolyMatcher , class TypeList >
static void clang::ast_matchers::dynamic::internal::mergePolyMatchers (const PolyMatcher &Poly, std::vector< DynTypedMatcher > &Out, TypeList)
static VariantMatcher clang::ast_matchers::dynamic::internal::outvalueToVariantMatcher (const DynTypedMatcher &Matcher)
 Convert the return values of the functions into a VariantMatcher.
template<typename T >
static VariantMatcher clang::ast_matchers::dynamic::internal::outvalueToVariantMatcher (const T &PolyMatcher, typename T::ReturnTypes *=NULL)
template<typename T >
void clang::ast_matchers::dynamic::internal::buildReturnTypeVectorFromTypeList (std::vector< ast_type_traits::ASTNodeKind > &RetTypes)
template<>
void clang::ast_matchers::dynamic::internal::buildReturnTypeVectorFromTypeList< ast_matchers::internal::EmptyTypeList > (std::vector< ast_type_traits::ASTNodeKind > &RetTypes)
template<typename ResultT , typename ArgT , ResultT(*)(ArrayRef< const ArgT * >) Func>
VariantMatcher clang::ast_matchers::dynamic::internal::variadicMatcherDescriptor (StringRef MatcherName, const SourceRange &NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error)
 Variadic marshaller function.
template<typename ReturnType >
static VariantMatcher clang::ast_matchers::dynamic::internal::matcherMarshall0 (void(*Func)(), StringRef MatcherName, const SourceRange &NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error)
 0-arg marshaller function.
template<typename ReturnType , typename ArgType1 >
static VariantMatcher clang::ast_matchers::dynamic::internal::matcherMarshall1 (void(*Func)(), StringRef MatcherName, const SourceRange &NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error)
 1-arg marshaller function.
template<typename ReturnType , typename ArgType1 , typename ArgType2 >
static VariantMatcher clang::ast_matchers::dynamic::internal::matcherMarshall2 (void(*Func)(), StringRef MatcherName, const SourceRange &NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error)
 2-arg marshaller function.
template<typename ReturnType >
MatcherDescriptor * clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall (ReturnType(*Func)(), StringRef MatcherName)
 0-arg overload
template<typename ReturnType , typename ArgType1 >
MatcherDescriptor * clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall (ReturnType(*Func)(ArgType1), StringRef MatcherName)
 1-arg overload
template<typename ReturnType , typename ArgType1 , typename ArgType2 >
MatcherDescriptor * clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall (ReturnType(*Func)(ArgType1, ArgType2), StringRef MatcherName)
 2-arg overload
template<typename ResultT , typename ArgT , ResultT(*)(ArrayRef< const ArgT * >) Func>
MatcherDescriptor * clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall (llvm::VariadicFunction< ResultT, ArgT, Func > VarFunc, StringRef MatcherName)
 Variadic overload.
template<typename BaseT , typename DerivedT >
MatcherDescriptor * clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall (ast_matchers::internal::VariadicDynCastAllOfMatcher< BaseT, DerivedT > VarFunc, StringRef MatcherName)
 Overload for VariadicDynCastAllOfMatchers.
template<template< typename ToArg, typename FromArg > class ArgumentAdapterT, typename FromTypes , typename ToTypes >
MatcherDescriptor * clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall (ast_matchers::internal::ArgumentAdaptingMatcherFunc< ArgumentAdapterT, FromTypes, ToTypes >, StringRef MatcherName)
 Argument adaptative overload.
template<unsigned MinCount, unsigned MaxCount>
MatcherDescriptor * clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall (ast_matchers::internal::VariadicOperatorMatcherFunc< MinCount, MaxCount > Func, StringRef MatcherName)
 Variadic operator overload.

Detailed Description

Functions templates and classes to wrap matcher construct functions.

A collection of template function and classes that provide a generic marshalling layer on top of matcher construct functions. These are used by the registry to export all marshaller constructors with the same generic interface.

Definition in file Marshallers.h.


Define Documentation

#define ATTR (   X)    .Case("attr::" #X, attr:: X)
#define CHECK_ARG_COUNT (   count)
Value:
if (Args.size() != count) {                                                  \
    Error->addError(NameRange, Error->ET_RegistryWrongArgCount)                \
        << count << Args.size();                                               \
    return VariantMatcher();                                                   \
  }

Helper macros to check the arguments on all marshaller functions.

Definition at line 394 of file Marshallers.h.

Referenced by clang::ast_matchers::dynamic::internal::matcherMarshall0(), clang::ast_matchers::dynamic::internal::matcherMarshall1(), and clang::ast_matchers::dynamic::internal::matcherMarshall2().

#define CHECK_ARG_TYPE (   index,
  type 
)
Value:
if (!ArgTypeTraits<type>::is(Args[index].Value)) {                           \
    Error->addError(Args[index].Range, Error->ET_RegistryWrongArgType)         \
        << (index + 1) << ArgTypeTraits<type>::getKind().asString()            \
        << Args[index].Value.getTypeAsString();                                \
    return VariantMatcher();                                                   \
  }

Definition at line 401 of file Marshallers.h.

Referenced by clang::ast_matchers::dynamic::internal::matcherMarshall1(), and clang::ast_matchers::dynamic::internal::matcherMarshall2().