clang  6.0.0svn
Classes | Namespaces | Macros | Functions
Marshallers.h File Reference

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

#include "clang/AST/ASTTypeTraits.h"
#include "clang/AST/OperationKinds.h"
#include "clang/ASTMatchers/ASTMatchersInternal.h"
#include "clang/ASTMatchers/Dynamic/Diagnostics.h"
#include "clang/ASTMatchers/Dynamic/VariantValue.h"
#include "clang/Basic/AttrKinds.h"
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
#include <cassert>
#include <cstddef>
#include <iterator>
#include <limits>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "clang/Basic/AttrList.inc"
#include "clang/AST/OperationKinds.def"
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< T >
 Helper template class to just from argument type to the right is/get functions in VariantValue. More...
 
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< bool >
 
struct  clang::ast_matchers::dynamic::internal::ArgTypeTraits< double >
 
struct  clang::ast_matchers::dynamic::internal::ArgTypeTraits< unsigned >
 
struct  clang::ast_matchers::dynamic::internal::ArgTypeTraits< attr::Kind >
 
struct  clang::ast_matchers::dynamic::internal::ArgTypeTraits< CastKind >
 
class  clang::ast_matchers::dynamic::internal::MatcherDescriptor
 Matcher descriptor interface. More...
 
class  clang::ast_matchers::dynamic::internal::FixedArgCountMatcherDescriptor
 Simple callback implementation. 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

 clang
 Dataflow Directional Tag Classes.
 
 clang::ast_matchers
 
 clang::ast_matchers::dynamic
 
 clang::ast_matchers::dynamic::internal
 

Macros

#define ATTR(X)   .Case("attr::" #X, attr:: X)
 
#define CAST_OPERATION(Name)   .Case( #Name, CK_##Name)
 
#define CHECK_ARG_COUNT(count)
 Helper macros to check the arguments on all marshaller functions. More...
 
#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. More...
 
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. More...
 
template<typename T >
static VariantMatcher clang::ast_matchers::dynamic::internal::outvalueToVariantMatcher (const T &PolyMatcher, typename T::ReturnTypes *=nullptr)
 
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, SourceRange NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error)
 Variadic marshaller function. More...
 
template<typename ReturnType >
static VariantMatcher clang::ast_matchers::dynamic::internal::matcherMarshall0 (void(*Func)(), StringRef MatcherName, SourceRange NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error)
 0-arg marshaller function. More...
 
template<typename ReturnType , typename ArgType1 >
static VariantMatcher clang::ast_matchers::dynamic::internal::matcherMarshall1 (void(*Func)(), StringRef MatcherName, SourceRange NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error)
 1-arg marshaller function. More...
 
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)
 2-arg marshaller function. More...
 
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. More...
 
template<typename ReturnType , typename ArgType1 >
std::unique_ptr< MatcherDescriptor > clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall (ReturnType(*Func)(ArgType1), StringRef MatcherName)
 1-arg overload More...
 
template<typename ReturnType , typename ArgType1 , typename ArgType2 >
std::unique_ptr< MatcherDescriptor > clang::ast_matchers::dynamic::internal::makeMatcherAutoMarshall (ReturnType(*Func)(ArgType1, ArgType2), StringRef MatcherName)
 2-arg overload More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 

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.

Macro Definition Documentation

◆ ATTR

#define ATTR (   X)    .Case("attr::" #X, attr:: X)

◆ CAST_OPERATION

#define CAST_OPERATION (   Name)    .Case( #Name, CK_##Name)

◆ CHECK_ARG_COUNT

#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 474 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().

◆ CHECK_ARG_TYPE

#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(); \
}
static Decl::Kind getKind(const Decl *D)
Definition: DeclBase.cpp:915

Definition at line 481 of file Marshallers.h.

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