clang API Documentation
Go to the source code of this file.
Defines | |
#define | AST_MATCHER_FUNCTION_P(ReturnType, DefineMatcher, ParamType, Param) |
AST_MATCHER_FUNCTION_P(ReturnType, DefineMatcher, ParamType, Param) { defines a single-parameter function named DefineMatcher() that returns a ReturnType object. | |
#define | AST_MATCHER_FUNCTION_P_OVERLOAD(ReturnType, DefineMatcher, ParamType,Param, OverloadId) |
#define | AST_MATCHER(Type, DefineMatcher) |
AST_MATCHER(Type, DefineMatcher) { ... } defines a zero parameter function named DefineMatcher() that returns a Matcher<Type> object. | |
#define | AST_MATCHER_P(Type, DefineMatcher, ParamType, Param) AST_MATCHER_P_OVERLOAD(Type, DefineMatcher, ParamType, Param, 0) |
AST_MATCHER_P(Type, DefineMatcher, ParamType, Param) { ... } defines a single-parameter function named DefineMatcher() that returns a Matcher<Type> object. | |
#define | AST_MATCHER_P_OVERLOAD(Type, DefineMatcher, ParamType, Param,OverloadId) |
#define | AST_MATCHER_P2(Type, DefineMatcher, ParamType1, Param1, ParamType2,Param2) |
AST_MATCHER_P2( Type, DefineMatcher, ParamType1, Param1, ParamType2, Param2) { ... } defines a two-parameter function named DefineMatcher() that returns a Matcher<Type> object. | |
#define | AST_MATCHER_P2_OVERLOAD(Type, DefineMatcher, ParamType1, Param1,ParamType2, Param2, OverloadId) |
#define | AST_POLYMORPHIC_SUPPORTED_TYPES_1(t1) void(internal::TypeList<t1>) |
Construct a type-list to be passed to the AST_POLYMORPHIC_MATCHER* macros. | |
#define | AST_POLYMORPHIC_SUPPORTED_TYPES_2(t1, t2) void(internal::TypeList<t1, t2>) |
#define | AST_POLYMORPHIC_SUPPORTED_TYPES_3(t1, t2, t3) void(internal::TypeList<t1, t2, t3>) |
#define | AST_POLYMORPHIC_SUPPORTED_TYPES_4(t1, t2, t3, t4) void(internal::TypeList<t1, t2, t3, t4>) |
#define | AST_POLYMORPHIC_SUPPORTED_TYPES_5(t1, t2, t3, t4, t5) void(internal::TypeList<t1, t2, t3, internal::TypeList<t4, t5> >) |
#define | AST_POLYMORPHIC_MATCHER(DefineMatcher, ReturnTypesF) |
AST_POLYMORPHIC_MATCHER(DefineMatcher) { ... } defines a single-parameter function named DefineMatcher() that is polymorphic in the return type. | |
#define | AST_POLYMORPHIC_MATCHER_P(DefineMatcher, ReturnTypesF, ParamType,Param) |
AST_POLYMORPHIC_MATCHER_P(DefineMatcher, ParamType, Param) { ... } defines a single-parameter function named DefineMatcher() that is polymorphic in the return type. | |
#define | AST_POLYMORPHIC_MATCHER_P_OVERLOAD(DefineMatcher, ReturnTypesF,ParamType, Param, OverloadId) |
#define | AST_POLYMORPHIC_MATCHER_P2(DefineMatcher, ReturnTypesF, ParamType1,Param1, ParamType2, Param2) |
AST_POLYMORPHIC_MATCHER_P2( DefineMatcher, ParamType1, Param1, ParamType2, Param2) { ... } defines a two-parameter function named matcher() that is polymorphic in the return type. | |
#define | AST_POLYMORPHIC_MATCHER_P2_OVERLOAD(DefineMatcher, ReturnTypesF,ParamType1, Param1, ParamType2,Param2, OverloadId) |
#define | AST_TYPE_MATCHER(NodeType, MatcherName) const internal::VariadicDynCastAllOfMatcher<Type, NodeType> MatcherName |
Creates a variadic matcher for both a specific Type as well as the corresponding TypeLoc . | |
#define | AST_TYPE_TRAVERSE_MATCHER(MatcherName, FunctionName, ReturnTypesF) |
AST_TYPE_TRAVERSE_MATCHER(MatcherName, FunctionName) defines the matcher MatcherName that can be used to traverse from one Type to another. | |
#define | AST_TYPELOC_TRAVERSE_MATCHER(MatcherName, FunctionName, ReturnTypesF) |
AST_TYPELOC_TRAVERSE_MATCHER(MatcherName, FunctionName) works identical to AST_TYPE_TRAVERSE_MATCHER but operates on TypeLocs . |
#define AST_MATCHER | ( | Type, | |
DefineMatcher | |||
) |
namespace internal { \ class matcher_##DefineMatcher##Matcher : public MatcherInterface<Type> { \ public: \ explicit matcher_##DefineMatcher##Matcher() {} \ bool matches(const Type &Node, ASTMatchFinder *Finder, \ BoundNodesTreeBuilder *Builder) const override; \ }; \ } \ inline internal::Matcher<Type> DefineMatcher() { \ return internal::makeMatcher( \ new internal::matcher_##DefineMatcher##Matcher()); \ } \ inline bool internal::matcher_##DefineMatcher##Matcher::matches( \ const Type &Node, ASTMatchFinder *Finder, \ BoundNodesTreeBuilder *Builder) const
AST_MATCHER(Type, DefineMatcher) { ... } defines a zero parameter function named DefineMatcher() that returns a Matcher<Type> object.
The code between the curly braces has access to the following variables:
Node: the AST node being matched; its type is Type. Finder: an ASTMatchFinder*. Builder: a BoundNodesTreeBuilder*.
The code should return true if 'Node' matches.
Definition at line 70 of file ASTMatchersMacros.h.
#define AST_MATCHER_FUNCTION_P | ( | ReturnType, | |
DefineMatcher, | |||
ParamType, | |||
Param | |||
) |
AST_MATCHER_FUNCTION_P_OVERLOAD(ReturnType, DefineMatcher, ParamType, Param, \ 0)
AST_MATCHER_FUNCTION_P(ReturnType, DefineMatcher, ParamType, Param) { defines a single-parameter function named DefineMatcher() that returns a ReturnType object.
The code between the curly braces has access to the following variables:
Param: the parameter passed to the function; its type is ParamType.
The code should return an instance of ReturnType.
Definition at line 50 of file ASTMatchersMacros.h.
#define AST_MATCHER_FUNCTION_P_OVERLOAD | ( | ReturnType, | |
DefineMatcher, | |||
ParamType, | |||
Param, | |||
OverloadId | |||
) |
inline ReturnType DefineMatcher(ParamType const &Param); \ typedef ReturnType (&DefineMatcher##_Type##OverloadId)(ParamType const &); \ inline ReturnType DefineMatcher(ParamType const &Param)
Definition at line 53 of file ASTMatchersMacros.h.
#define AST_MATCHER_P | ( | Type, | |
DefineMatcher, | |||
ParamType, | |||
Param | |||
) | AST_MATCHER_P_OVERLOAD(Type, DefineMatcher, ParamType, Param, 0) |
AST_MATCHER_P(Type, DefineMatcher, ParamType, Param) { ... } defines a single-parameter function named DefineMatcher() that returns a Matcher<Type> object.
The code between the curly braces has access to the following variables:
Node: the AST node being matched; its type is Type. Param: the parameter passed to the function; its type is ParamType. Finder: an ASTMatchFinder*. Builder: a BoundNodesTreeBuilder*.
The code should return true if 'Node' matches.
Definition at line 100 of file ASTMatchersMacros.h.
#define AST_MATCHER_P2 | ( | Type, | |
DefineMatcher, | |||
ParamType1, | |||
Param1, | |||
ParamType2, | |||
Param2 | |||
) |
AST_MATCHER_P2_OVERLOAD(Type, DefineMatcher, ParamType1, Param1, ParamType2, \ Param2, 0)
AST_MATCHER_P2( Type, DefineMatcher, ParamType1, Param1, ParamType2, Param2) { ... } defines a two-parameter function named DefineMatcher() that returns a Matcher<Type> object.
The code between the curly braces has access to the following variables:
Node: the AST node being matched; its type is Type. Param1, Param2: the parameters passed to the function; their types are ParamType1 and ParamType2. Finder: an ASTMatchFinder*. Builder: a BoundNodesTreeBuilder*.
The code should return true if 'Node' matches.
Definition at line 143 of file ASTMatchersMacros.h.
#define AST_MATCHER_P2_OVERLOAD | ( | Type, | |
DefineMatcher, | |||
ParamType1, | |||
Param1, | |||
ParamType2, | |||
Param2, | |||
OverloadId | |||
) |
namespace internal { \ class matcher_##DefineMatcher##OverloadId##Matcher \ : public MatcherInterface<Type> { \ public: \ matcher_##DefineMatcher##OverloadId##Matcher(ParamType1 const &A##Param1, \ ParamType2 const &A##Param2) \ : Param1(A##Param1), Param2(A##Param2) {} \ bool matches(const Type &Node, ASTMatchFinder *Finder, \ BoundNodesTreeBuilder *Builder) const override; \ \ private: \ ParamType1 const Param1; \ ParamType2 const Param2; \ }; \ } \ inline internal::Matcher<Type> DefineMatcher(ParamType1 const &Param1, \ ParamType2 const &Param2) { \ return internal::makeMatcher( \ new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param1, \ Param2)); \ } \ typedef internal::Matcher<Type>(&DefineMatcher##_Type##OverloadId)( \ ParamType1 const &Param1, ParamType2 const &Param2); \ inline bool internal::matcher_##DefineMatcher##OverloadId##Matcher::matches( \ const Type &Node, ASTMatchFinder *Finder, \ BoundNodesTreeBuilder *Builder) const
Definition at line 148 of file ASTMatchersMacros.h.
#define AST_MATCHER_P_OVERLOAD | ( | Type, | |
DefineMatcher, | |||
ParamType, | |||
Param, | |||
OverloadId | |||
) |
namespace internal { \ class matcher_##DefineMatcher##OverloadId##Matcher \ : public MatcherInterface<Type> { \ public: \ explicit matcher_##DefineMatcher##OverloadId##Matcher( \ ParamType const &A##Param) \ : Param(A##Param) {} \ bool matches(const Type &Node, ASTMatchFinder *Finder, \ BoundNodesTreeBuilder *Builder) const override; \ \ private: \ ParamType const Param; \ }; \ } \ inline internal::Matcher<Type> DefineMatcher(ParamType const &Param) { \ return internal::makeMatcher( \ new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param)); \ } \ typedef internal::Matcher<Type>(&DefineMatcher##_Type##OverloadId)( \ ParamType const &Param); \ inline bool internal::matcher_##DefineMatcher##OverloadId##Matcher::matches( \ const Type &Node, ASTMatchFinder *Finder, \ BoundNodesTreeBuilder *Builder) const
Definition at line 103 of file ASTMatchersMacros.h.
#define AST_POLYMORPHIC_MATCHER | ( | DefineMatcher, | |
ReturnTypesF | |||
) |
namespace internal { \ template <typename NodeType> \ class matcher_##DefineMatcher##Matcher : public MatcherInterface<NodeType> { \ public: \ bool matches(const NodeType &Node, ASTMatchFinder *Finder, \ BoundNodesTreeBuilder *Builder) const override; \ }; \ } \ inline internal::PolymorphicMatcherWithParam0< \ internal::matcher_##DefineMatcher##Matcher, ReturnTypesF> \ DefineMatcher() { \ return internal::PolymorphicMatcherWithParam0< \ internal::matcher_##DefineMatcher##Matcher, ReturnTypesF>(); \ } \ template <typename NodeType> \ bool internal::matcher_##DefineMatcher##Matcher<NodeType>::matches( \ const NodeType &Node, ASTMatchFinder *Finder, \ BoundNodesTreeBuilder *Builder) const
AST_POLYMORPHIC_MATCHER(DefineMatcher) { ... } defines a single-parameter function named DefineMatcher() that is polymorphic in the return type.
The variables are the same as for AST_MATCHER, but NodeType will be deduced from the calling context.
Definition at line 201 of file ASTMatchersMacros.h.
#define AST_POLYMORPHIC_MATCHER_P | ( | DefineMatcher, | |
ReturnTypesF, | |||
ParamType, | |||
Param | |||
) |
AST_POLYMORPHIC_MATCHER_P_OVERLOAD(DefineMatcher, ReturnTypesF, ParamType, \ Param, 0)
AST_POLYMORPHIC_MATCHER_P(DefineMatcher, ParamType, Param) { ... } defines a single-parameter function named DefineMatcher() that is polymorphic in the return type.
The variables are the same as for AST_MATCHER_P, with the addition of NodeType, which specifies the node type of the matcher Matcher<NodeType> returned by the function matcher().
FIXME: Pull out common code with above macro?
Definition at line 230 of file ASTMatchersMacros.h.
#define AST_POLYMORPHIC_MATCHER_P2 | ( | DefineMatcher, | |
ReturnTypesF, | |||
ParamType1, | |||
Param1, | |||
ParamType2, | |||
Param2 | |||
) |
AST_POLYMORPHIC_MATCHER_P2_OVERLOAD(DefineMatcher, ReturnTypesF, ParamType1, \ Param1, ParamType2, Param2, 0)
AST_POLYMORPHIC_MATCHER_P2( DefineMatcher, ParamType1, Param1, ParamType2, Param2) { ... } defines a two-parameter function named matcher() that is polymorphic in the return type.
The variables are the same as for AST_MATCHER_P2, with the addition of NodeType, which specifies the node type of the matcher Matcher<NodeType> returned by the function DefineMatcher().
Definition at line 276 of file ASTMatchersMacros.h.
#define AST_POLYMORPHIC_MATCHER_P2_OVERLOAD | ( | DefineMatcher, | |
ReturnTypesF, | |||
ParamType1, | |||
Param1, | |||
ParamType2, | |||
Param2, | |||
OverloadId | |||
) |
Definition at line 281 of file ASTMatchersMacros.h.
#define AST_POLYMORPHIC_MATCHER_P_OVERLOAD | ( | DefineMatcher, | |
ReturnTypesF, | |||
ParamType, | |||
Param, | |||
OverloadId | |||
) |
namespace internal { \ template <typename NodeType, typename ParamT> \ class matcher_##DefineMatcher##OverloadId##Matcher \ : public MatcherInterface<NodeType> { \ public: \ explicit matcher_##DefineMatcher##OverloadId##Matcher( \ ParamType const &A##Param) \ : Param(A##Param) {} \ bool matches(const NodeType &Node, ASTMatchFinder *Finder, \ BoundNodesTreeBuilder *Builder) const override; \ \ private: \ ParamType const Param; \ }; \ } \ inline internal::PolymorphicMatcherWithParam1< \ internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType, \ ReturnTypesF> DefineMatcher(ParamType const &Param) { \ return internal::PolymorphicMatcherWithParam1< \ internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType, \ ReturnTypesF>(Param); \ } \ typedef internal::PolymorphicMatcherWithParam1< \ internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType, \ ReturnTypesF>(&DefineMatcher##_Type##OverloadId)( \ ParamType const &Param); \ template <typename NodeType, typename ParamT> \ bool internal::matcher_##DefineMatcher##OverloadId##Matcher< \ NodeType, ParamT>::matches(const NodeType &Node, ASTMatchFinder *Finder, \ BoundNodesTreeBuilder *Builder) const
Definition at line 235 of file ASTMatchersMacros.h.
#define AST_POLYMORPHIC_SUPPORTED_TYPES_1 | ( | t1 | ) | void(internal::TypeList<t1>) |
Construct a type-list to be passed to the AST_POLYMORPHIC_MATCHER* macros.
You can't pass something like TypeList<Foo, Bar>
to a macro, because it will look at that as two arguments. However, you can pass void(TypeList<Foo, Bar>)
, which works thanks to the parenthesis. The PolymorphicMatcherWithParam*
classes will unpack the function type to extract the TypeList object.
Definition at line 185 of file ASTMatchersMacros.h.
#define AST_POLYMORPHIC_SUPPORTED_TYPES_2 | ( | t1, | |
t2 | |||
) | void(internal::TypeList<t1, t2>) |
Definition at line 186 of file ASTMatchersMacros.h.
Referenced by clang::ast_matchers::hasOverloadedOperatorName().
#define AST_POLYMORPHIC_SUPPORTED_TYPES_3 | ( | t1, | |
t2, | |||
t3 | |||
) | void(internal::TypeList<t1, t2, t3>) |
Definition at line 188 of file ASTMatchersMacros.h.
#define AST_POLYMORPHIC_SUPPORTED_TYPES_4 | ( | t1, | |
t2, | |||
t3, | |||
t4 | |||
) | void(internal::TypeList<t1, t2, t3, t4>) |
Definition at line 190 of file ASTMatchersMacros.h.
#define AST_POLYMORPHIC_SUPPORTED_TYPES_5 | ( | t1, | |
t2, | |||
t3, | |||
t4, | |||
t5 | |||
) | void(internal::TypeList<t1, t2, t3, internal::TypeList<t4, t5> >) |
Definition at line 192 of file ASTMatchersMacros.h.
#define AST_TYPE_MATCHER | ( | NodeType, | |
MatcherName | |||
) | const internal::VariadicDynCastAllOfMatcher<Type, NodeType> MatcherName |
Creates a variadic matcher for both a specific Type
as well as the corresponding TypeLoc
.
Definition at line 320 of file ASTMatchersMacros.h.
#define AST_TYPE_TRAVERSE_MATCHER | ( | MatcherName, | |
FunctionName, | |||
ReturnTypesF | |||
) |
namespace internal { \ template <typename T> struct TypeMatcher##MatcherName##Getter { \ static QualType (T::*value())() const { return &T::FunctionName; } \ }; \ } \ const internal::TypeTraversePolymorphicMatcher< \ QualType, internal::TypeMatcher##MatcherName##Getter, \ internal::TypeTraverseMatcher, ReturnTypesF>::Func MatcherName
AST_TYPE_TRAVERSE_MATCHER(MatcherName, FunctionName) defines the matcher MatcherName
that can be used to traverse from one Type
to another.
For a specific SpecificType
, the traversal is done using SpecificType::FunctionName
. The existence of such a function determines whether a corresponding matcher can be used on SpecificType
.
Definition at line 332 of file ASTMatchersMacros.h.
#define AST_TYPELOC_TRAVERSE_MATCHER | ( | MatcherName, | |
FunctionName, | |||
ReturnTypesF | |||
) |
namespace internal { \ template <typename T> struct TypeLocMatcher##MatcherName##Getter { \ static TypeLoc (T::*value())() const { return &T::FunctionName##Loc; } \ }; \ } \ const internal::TypeTraversePolymorphicMatcher< \ TypeLoc, internal::TypeLocMatcher##MatcherName##Getter, \ internal::TypeLocTraverseMatcher, ReturnTypesF>::Func MatcherName##Loc; \ AST_TYPE_TRAVERSE_MATCHER(MatcherName, FunctionName##Type, ReturnTypesF)
AST_TYPELOC_TRAVERSE_MATCHER(MatcherName, FunctionName) works identical to AST_TYPE_TRAVERSE_MATCHER
but operates on TypeLocs
.
Definition at line 344 of file ASTMatchersMacros.h.