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

Classes

class  AdaptativeOverloadCollector
 Helper class used to collect all the possible overloads of an argument adaptative matcher function. More...
 
struct  ArgTypeTraits
 Helper template class to just from argument type to the right is/get functions in VariantValue. More...
 
struct  ArgTypeTraits< ast_matchers::internal::Matcher< T > >
 
struct  ArgTypeTraits< attr::Kind >
 
struct  ArgTypeTraits< bool >
 
struct  ArgTypeTraits< CastKind >
 
struct  ArgTypeTraits< const T & >
 
struct  ArgTypeTraits< double >
 
struct  ArgTypeTraits< llvm::Regex::RegexFlags >
 
struct  ArgTypeTraits< OpenMPClauseKind >
 
struct  ArgTypeTraits< std::string >
 
struct  ArgTypeTraits< StringRef >
 
struct  ArgTypeTraits< UnaryExprOrTypeTrait >
 
struct  ArgTypeTraits< unsigned >
 
struct  BuildReturnTypeVector
 
struct  BuildReturnTypeVector< ast_matchers::internal::BindableMatcher< T > >
 
struct  BuildReturnTypeVector< ast_matchers::internal::Matcher< T > >
 
class  DynCastAllOfMatcherDescriptor
 Return CK_Trivial when appropriate for VariadicDynCastAllOfMatchers. More...
 
class  FixedArgCountMatcherDescriptor
 Simple callback implementation. More...
 
class  MapAnyOfBuilderDescriptor
 
class  MapAnyOfMatcherDescriptor
 
class  MatcherDescriptor
 Matcher descriptor interface. More...
 
class  MatcherDescriptorPtr
 A smart (owning) pointer for MatcherDescriptor. More...
 
class  OverloadedMatcherDescriptor
 MatcherDescriptor that wraps multiple "overloads" of the same matcher. More...
 
class  RegexMatcherDescriptor
 
class  VariadicFuncMatcherDescriptor
 Matcher descriptor for variadic functions. More...
 
class  VariadicOperatorMatcherDescriptor
 Variadic operator marshaller function. More...
 

Functions

bool isRetKindConvertibleTo (ArrayRef< ASTNodeKind > RetKinds, ASTNodeKind Kind, unsigned *Specificity, 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)
 
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 *=nullptr)
 
template<typename T >
void buildReturnTypeVectorFromTypeList (std::vector< ASTNodeKind > &RetTypes)
 
template<>
void buildReturnTypeVectorFromTypeList< ast_matchers::internal::EmptyTypeList > (std::vector< ASTNodeKind > &RetTypes)
 
template<typename ResultT , typename ArgT , ResultT(*)(ArrayRef< const ArgT * >) Func>
VariantMatcher variadicMatcherDescriptor (StringRef MatcherName, SourceRange NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error)
 Variadic marshaller function.
 
template<typename ReturnType >
static VariantMatcher matcherMarshall0 (void(*Func)(), StringRef MatcherName, SourceRange NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error)
 0-arg marshaller function.
 
template<typename ReturnType , typename ArgType1 >
static VariantMatcher matcherMarshall1 (void(*Func)(), StringRef MatcherName, 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, SourceRange NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error)
 2-arg marshaller function.
 
template<typename ReturnType >
std::unique_ptr< MatcherDescriptormakeMatcherAutoMarshall (ReturnType(*Func)(), StringRef MatcherName)
 Helper functions to select the appropriate marshaller functions.
 
template<typename ReturnType , typename ArgType1 >
std::unique_ptr< MatcherDescriptormakeMatcherAutoMarshall (ReturnType(*Func)(ArgType1), StringRef MatcherName)
 1-arg overload
 
template<typename ReturnType , typename ArgType1 , typename ArgType2 >
std::unique_ptr< MatcherDescriptormakeMatcherAutoMarshall (ReturnType(*Func)(ArgType1, ArgType2), StringRef MatcherName)
 2-arg overload
 
template<typename ReturnType >
std::unique_ptr< MatcherDescriptormakeMatcherRegexMarshall (ReturnType(*FuncFlags)(llvm::StringRef, llvm::Regex::RegexFlags), ReturnType(*Func)(llvm::StringRef))
 
template<typename ResultT , typename ArgT , ResultT(*)(ArrayRef< const ArgT * >) Func>
std::unique_ptr< MatcherDescriptormakeMatcherAutoMarshall (ast_matchers::internal::VariadicFunction< ResultT, ArgT, Func > VarFunc, StringRef MatcherName)
 Variadic overload.
 
template<typename BaseT , typename DerivedT >
std::unique_ptr< 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 >
std::unique_ptr< MatcherDescriptormakeMatcherAutoMarshall (ast_matchers::internal::ArgumentAdaptingMatcherFunc< ArgumentAdapterT, FromTypes, ToTypes >, StringRef MatcherName)
 Argument adaptative overload.
 
template<unsigned MinCount, unsigned MaxCount>
std::unique_ptr< MatcherDescriptormakeMatcherAutoMarshall (ast_matchers::internal::VariadicOperatorMatcherFunc< MinCount, MaxCount > Func, StringRef MatcherName)
 Variadic operator overload.
 
template<typename CladeType , typename... MatcherT>
std::unique_ptr< MatcherDescriptormakeMatcherAutoMarshall (ast_matchers::internal::MapAnyOfMatcherImpl< CladeType, MatcherT... >, StringRef MatcherName)
 

Function Documentation

◆ buildReturnTypeVectorFromTypeList()

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

Definition at line 458 of file Marshallers.h.

◆ buildReturnTypeVectorFromTypeList< ast_matchers::internal::EmptyTypeList >()

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

Definition at line 464 of file Marshallers.h.

◆ isRetKindConvertibleTo()

bool clang::ast_matchers::dynamic::internal::isRetKindConvertibleTo ( ArrayRef< ASTNodeKind RetKinds,
ASTNodeKind  Kind,
unsigned Specificity,
ASTNodeKind LeastDerivedKind 
)
inline

◆ makeMatcherAutoMarshall() [1/8]

template<template< typename ToArg, typename FromArg > class ArgumentAdapterT, typename FromTypes , typename ToTypes >
std::unique_ptr< MatcherDescriptor > clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall ( ast_matchers::internal::ArgumentAdaptingMatcherFunc< ArgumentAdapterT, FromTypes, ToTypes >  ,
StringRef  MatcherName 
)

Argument adaptative overload.

Definition at line 1126 of file Marshallers.h.

◆ makeMatcherAutoMarshall() [2/8]

template<typename CladeType , typename... MatcherT>
std::unique_ptr< MatcherDescriptor > clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall ( ast_matchers::internal::MapAnyOfMatcherImpl< CladeType, MatcherT... >  ,
StringRef  MatcherName 
)

Definition at line 1157 of file Marshallers.h.

◆ makeMatcherAutoMarshall() [3/8]

template<typename BaseT , typename DerivedT >
std::unique_ptr< 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 1116 of file Marshallers.h.

◆ makeMatcherAutoMarshall() [4/8]

template<typename ResultT , typename ArgT , ResultT(*)(ArrayRef< const ArgT * >) Func>
std::unique_ptr< MatcherDescriptor > clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall ( ast_matchers::internal::VariadicFunction< ResultT, ArgT, Func VarFunc,
StringRef  MatcherName 
)

Variadic overload.

Definition at line 1105 of file Marshallers.h.

◆ makeMatcherAutoMarshall() [5/8]

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

Variadic operator overload.

Definition at line 1148 of file Marshallers.h.

References clang::Func.

◆ makeMatcherAutoMarshall() [6/8]

template<typename ReturnType >
std::unique_ptr< MatcherDescriptor > clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall ( ReturnType(*)()  Func,
StringRef  MatcherName 
)

Helper functions to select the appropriate marshaller functions.

They detect the number of arguments, arguments types and return type. 0-arg overload

Definition at line 1058 of file Marshallers.h.

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

◆ makeMatcherAutoMarshall() [7/8]

template<typename ReturnType , typename ArgType1 >
std::unique_ptr< MatcherDescriptor > clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall ( ReturnType(*)(ArgType1)  Func,
StringRef  MatcherName 
)

◆ makeMatcherAutoMarshall() [8/8]

template<typename ReturnType , typename ArgType1 , typename ArgType2 >
std::unique_ptr< MatcherDescriptor > clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall ( ReturnType(*)(ArgType1, ArgType2)  Func,
StringRef  MatcherName 
)

◆ makeMatcherRegexMarshall()

template<typename ReturnType >
std::unique_ptr< MatcherDescriptor > clang::ast_matchers::dynamic::internal::makeMatcherRegexMarshall ( ReturnType(*)(llvm::StringRef, llvm::Regex::RegexFlags)  FuncFlags,
ReturnType(*)(llvm::StringRef)  Func 
)

◆ matcherMarshall0()

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

0-arg marshaller function.

Definition at line 652 of file Marshallers.h.

References CHECK_ARG_COUNT, clang::Func, and outvalueToVariantMatcher().

◆ matcherMarshall1()

template<typename ReturnType , typename ArgType1 >
static VariantMatcher clang::ast_matchers::dynamic::internal::matcherMarshall1 ( void(*)()  Func,
StringRef  MatcherName,
SourceRange  NameRange,
ArrayRef< ParserValue Args,
Diagnostics Error 
)
static

1-arg marshaller function.

Definition at line 663 of file Marshallers.h.

References CHECK_ARG_COUNT, CHECK_ARG_TYPE, clang::Func, and outvalueToVariantMatcher().

◆ matcherMarshall2()

template<typename ReturnType , typename ArgType1 , typename ArgType2 >
static VariantMatcher clang::ast_matchers::dynamic::internal::matcherMarshall2 ( void(*)()  Func,
StringRef  MatcherName,
SourceRange  NameRange,
ArrayRef< ParserValue Args,
Diagnostics Error 
)
static

2-arg marshaller function.

Definition at line 676 of file Marshallers.h.

References CHECK_ARG_COUNT, CHECK_ARG_TYPE, clang::Func, and outvalueToVariantMatcher().

◆ mergePolyMatchers() [1/2]

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 425 of file Marshallers.h.

Referenced by mergePolyMatchers(), and outvalueToVariantMatcher().

◆ mergePolyMatchers() [2/2]

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 430 of file Marshallers.h.

References mergePolyMatchers().

◆ outvalueToVariantMatcher() [1/2]

VariantMatcher clang::ast_matchers::dynamic::internal::outvalueToVariantMatcher ( const DynTypedMatcher &  Matcher)
inline

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 442 of file Marshallers.h.

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

Referenced by clang::ast_matchers::dynamic::internal::RegexMatcherDescriptor< ReturnType >::create(), matcherMarshall0(), matcherMarshall1(), matcherMarshall2(), and variadicMatcherDescriptor().

◆ outvalueToVariantMatcher() [2/2]

template<typename T >
static VariantMatcher clang::ast_matchers::dynamic::internal::outvalueToVariantMatcher ( const T PolyMatcher,
typename T::ReturnTypes *  = nullptr 
)
static

◆ variadicMatcherDescriptor()

template<typename ResultT , typename ArgT , ResultT(*)(ArrayRef< const ArgT * >) Func>
VariantMatcher clang::ast_matchers::dynamic::internal::variadicMatcherDescriptor ( StringRef  MatcherName,
SourceRange  NameRange,
ArrayRef< ParserValue Args,
Diagnostics Error 
)