clang API Documentation
Simple callback implementation. Marshaller and function are provided. More...
#include <Marshallers.h>
Public Types | |
typedef VariantMatcher(* | MarshallerType )(void(*Func)(), StringRef MatcherName, const SourceRange &NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error) |
Public Member Functions | |
FixedArgCountMatcherDescriptor (MarshallerType Marshaller, void(*Func)(), StringRef MatcherName, ArrayRef< ast_type_traits::ASTNodeKind > RetKinds, ArrayRef< ArgKind > ArgKinds) | |
VariantMatcher | create (const SourceRange &NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error) const |
bool | isVariadic () const |
unsigned | getNumArgs () const |
Returns the number of arguments accepted by the matcher if not variadic. | |
void | getArgKinds (ast_type_traits::ASTNodeKind ThisKind, unsigned ArgNo, std::vector< ArgKind > &Kinds) const |
bool | isConvertibleTo (ast_type_traits::ASTNodeKind Kind, unsigned *Specificity, ast_type_traits::ASTNodeKind *LeastDerivedKind) const |
Simple callback implementation. Marshaller and function are provided.
This class wraps a function of arbitrary signature and a marshaller function into a MatcherDescriptor. The marshaller is in charge of taking the VariantValue arguments, checking their types, unpacking them and calling the underlying function.
Definition at line 161 of file Marshallers.h.
typedef VariantMatcher(* clang::ast_matchers::dynamic::internal::FixedArgCountMatcherDescriptor::MarshallerType)(void(*Func)(), StringRef MatcherName, const SourceRange &NameRange, ArrayRef< ParserValue > Args, Diagnostics *Error) |
Definition at line 163 of file Marshallers.h.
clang::ast_matchers::dynamic::internal::FixedArgCountMatcherDescriptor::FixedArgCountMatcherDescriptor | ( | MarshallerType | Marshaller, |
void(*)() | Func, | ||
StringRef | MatcherName, | ||
ArrayRef< ast_type_traits::ASTNodeKind > | RetKinds, | ||
ArrayRef< ArgKind > | ArgKinds | ||
) | [inline] |
Marshaller | Function to unpack the arguments and call Func |
Func | Matcher construct function. This is the function that compile-time matcher expressions would use to create the matcher. |
RetKinds | The list of matcher types to which the matcher is convertible. |
ArgKinds | The types of the arguments this matcher takes. |
Definition at line 175 of file Marshallers.h.
VariantMatcher clang::ast_matchers::dynamic::internal::FixedArgCountMatcherDescriptor::create | ( | const SourceRange & | NameRange, |
ArrayRef< ParserValue > | Args, | ||
Diagnostics * | Error | ||
) | const [inline, virtual] |
Implements clang::ast_matchers::dynamic::internal::MatcherDescriptor.
Definition at line 183 of file Marshallers.h.
void clang::ast_matchers::dynamic::internal::FixedArgCountMatcherDescriptor::getArgKinds | ( | ast_type_traits::ASTNodeKind | ThisKind, |
unsigned | ArgNo, | ||
std::vector< ArgKind > & | ArgKinds | ||
) | const [inline, virtual] |
Given that the matcher is being converted to type ThisKind
, append the set of argument types accepted for argument ArgNo
to ArgKinds
.
Implements clang::ast_matchers::dynamic::internal::MatcherDescriptor.
Definition at line 190 of file Marshallers.h.
unsigned clang::ast_matchers::dynamic::internal::FixedArgCountMatcherDescriptor::getNumArgs | ( | ) | const [inline, virtual] |
Returns the number of arguments accepted by the matcher if not variadic.
Implements clang::ast_matchers::dynamic::internal::MatcherDescriptor.
Definition at line 189 of file Marshallers.h.
bool clang::ast_matchers::dynamic::internal::FixedArgCountMatcherDescriptor::isConvertibleTo | ( | ast_type_traits::ASTNodeKind | Kind, |
unsigned * | Specificity, | ||
ast_type_traits::ASTNodeKind * | LeastDerivedKind | ||
) | const [inline, virtual] |
Returns whether this matcher is convertible to the given type. If it is so convertible, store in *Specificity a value corresponding to the "specificity" of the converted matcher to the given context, and in LeastDerivedKind the least derived matcher kind which would result in the same matcher overload. Zero specificity indicates that this conversion would produce a trivial matcher that will either always or never match. Such matchers are excluded from code completion results.
Implements clang::ast_matchers::dynamic::internal::MatcherDescriptor.
Definition at line 194 of file Marshallers.h.
References clang::ast_matchers::dynamic::internal::isRetKindConvertibleTo().
bool clang::ast_matchers::dynamic::internal::FixedArgCountMatcherDescriptor::isVariadic | ( | ) | const [inline, virtual] |
Returns whether the matcher is variadic. Variadic matchers can take any number of arguments, but they must be of the same type.
Implements clang::ast_matchers::dynamic::internal::MatcherDescriptor.
Definition at line 188 of file Marshallers.h.