clang API Documentation

Classes | Functions
clang::ast_matchers::dynamic::internal Namespace Reference

Classes

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

Functions

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

Function Documentation

template<typename T >
void clang::ast_matchers::dynamic::internal::buildReturnTypeVectorFromTypeList ( std::vector< ast_type_traits::ASTNodeKind > &  RetTypes) [inline]

Definition at line 243 of file Marshallers.h.

template<>
void clang::ast_matchers::dynamic::internal::buildReturnTypeVectorFromTypeList< ast_matchers::internal::EmptyTypeList > ( std::vector< ast_type_traits::ASTNodeKind > &  RetTypes) [inline]

Definition at line 252 of file Marshallers.h.

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 
) [inline]
template<typename ReturnType >
MatcherDescriptor* clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall ( ReturnType(*)()  Func,
StringRef  MatcherName 
)

0-arg overload

Helper functions to select the appropriate marshaller functions. They detect the number of arguments, arguments types and return type.

Definition at line 618 of file Marshallers.h.

References clang::ast_matchers::dynamic::internal::BuildReturnTypeVector< T >::build().

template<typename ReturnType , typename ArgType1 >
MatcherDescriptor* clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall ( ReturnType(*)(ArgType1)  Func,
StringRef  MatcherName 
)
template<typename ReturnType , typename ArgType1 , typename ArgType2 >
MatcherDescriptor* clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall ( ReturnType(*)(ArgType1, ArgType2)  Func,
StringRef  MatcherName 
)
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.

Definition at line 656 of file Marshallers.h.

template<typename BaseT , typename DerivedT >
MatcherDescriptor* clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall ( ast_matchers::internal::VariadicDynCastAllOfMatcher< BaseT, DerivedT >  VarFunc,
StringRef  MatcherName 
)

Overload for VariadicDynCastAllOfMatchers.

Not strictly necessary, but DynCastAllOfMatcherDescriptor gives us better completion results for that type of matcher.

Definition at line 667 of file Marshallers.h.

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.

Definition at line 677 of file Marshallers.h.

template<unsigned MinCount, unsigned MaxCount>
MatcherDescriptor* clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall ( ast_matchers::internal::VariadicOperatorMatcherFunc< MinCount, MaxCount >  Func,
StringRef  MatcherName 
)

Variadic operator overload.

Definition at line 699 of file Marshallers.h.

template<typename ReturnType >
static VariantMatcher clang::ast_matchers::dynamic::internal::matcherMarshall0 ( void(*)()  Func,
StringRef  MatcherName,
const SourceRange &  NameRange,
ArrayRef< ParserValue >  Args,
Diagnostics *  Error 
) [static]

0-arg marshaller function.

Definition at line 412 of file Marshallers.h.

References CHECK_ARG_COUNT, and outvalueToVariantMatcher().

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 
) [static]

1-arg marshaller function.

Definition at line 423 of file Marshallers.h.

References CHECK_ARG_COUNT, CHECK_ARG_TYPE, and outvalueToVariantMatcher().

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 
) [static]

2-arg marshaller function.

Definition at line 436 of file Marshallers.h.

References CHECK_ARG_COUNT, CHECK_ARG_TYPE, and outvalueToVariantMatcher().

template<class PolyMatcher >
static void clang::ast_matchers::dynamic::internal::mergePolyMatchers ( const PolyMatcher &  Poly,
std::vector< DynTypedMatcher > &  Out,
ast_matchers::internal::EmptyTypeList   
) [static]

Helper methods to extract and merge all possible typed matchers out of the polymorphic object.

Definition at line 211 of file Marshallers.h.

Referenced by mergePolyMatchers(), and outvalueToVariantMatcher().

template<class PolyMatcher , class TypeList >
static void clang::ast_matchers::dynamic::internal::mergePolyMatchers ( const PolyMatcher &  Poly,
std::vector< DynTypedMatcher > &  Out,
TypeList   
) [static]

Definition at line 216 of file Marshallers.h.

References mergePolyMatchers().

static VariantMatcher clang::ast_matchers::dynamic::internal::outvalueToVariantMatcher ( const DynTypedMatcher &  Matcher) [static]

Convert the return values of the functions into a VariantMatcher.

There are 2 cases right now: The return value is a Matcher<T> or is a polymorphic matcher. For the former, we just construct the VariantMatcher. For the latter, we instantiate all the possible Matcher<T> of the poly matcher.

Definition at line 228 of file Marshallers.h.

References clang::ast_matchers::dynamic::VariantMatcher::SingleMatcher().

Referenced by matcherMarshall0(), matcherMarshall1(), matcherMarshall2(), and variadicMatcherDescriptor().

template<typename T >
static VariantMatcher clang::ast_matchers::dynamic::internal::outvalueToVariantMatcher ( const T &  PolyMatcher,
typename T::ReturnTypes *  = NULL 
) [static]
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 
)