clang API Documentation
A variant matcher object. More...
#include <VariantValue.h>
Classes | |
class | MatcherOps |
Methods that depend on T from hasTypedMatcher/getTypedMatcher. | |
class | Payload |
Payload interface to be specialized by each matcher type. | |
class | PolymorphicPayload |
class | SinglePayload |
class | VariadicOpPayload |
Public Member Functions | |
VariantMatcher () | |
A null matcher. | |
void | reset () |
Makes the matcher the "null" matcher. | |
bool | isNull () const |
Whether the matcher is null. | |
llvm::Optional< DynTypedMatcher > | getSingleMatcher () const |
Return a single matcher, if there is no ambiguity. | |
template<class T > | |
bool | hasTypedMatcher () const |
Determines if the contained matcher can be converted to Matcher<T> . | |
bool | isConvertibleTo (ast_type_traits::ASTNodeKind Kind, unsigned *Specificity) const |
Determines if the contained matcher can be converted to Kind . | |
template<class T > | |
ast_matchers::internal::Matcher < T > | getTypedMatcher () const |
Return this matcher as a Matcher<T> . | |
std::string | getTypeAsString () const |
String representation of the type of the value. | |
Static Public Member Functions | |
static VariantMatcher | SingleMatcher (const DynTypedMatcher &Matcher) |
Clones the provided matcher. | |
static VariantMatcher | PolymorphicMatcher (std::vector< DynTypedMatcher > Matchers) |
Clones the provided matchers. | |
static VariantMatcher | VariadicOperatorMatcher (DynTypedMatcher::VariadicOperatorFunction Func, std::vector< VariantMatcher > Args) |
Creates a 'variadic' operator matcher. |
A variant matcher object.
The purpose of this object is to abstract simple and polymorphic matchers into a single object type. Polymorphic matchers might be implemented as a list of all the possible overloads of the matcher. VariantMatcher
knows how to select the appropriate overload when needed. To get a real matcher object out of a VariantMatcher
you can do:
Definition at line 92 of file VariantValue.h.
A null matcher.
Definition at line 216 of file VariantValue.cpp.
Referenced by PolymorphicMatcher(), SingleMatcher(), and VariadicOperatorMatcher().
llvm::Optional< DynTypedMatcher > clang::ast_matchers::dynamic::VariantMatcher::getSingleMatcher | ( | ) | const |
Return a single matcher, if there is no ambiguity.
Definition at line 233 of file VariantValue.cpp.
Referenced by clang::ast_matchers::dynamic::Registry::constructBoundMatcher(), and clang::ast_matchers::dynamic::Parser::parseMatcherExpression().
std::string clang::ast_matchers::dynamic::VariantMatcher::getTypeAsString | ( | ) | const |
String representation of the type of the value.
If the underlying matcher is a polymorphic one, the string will show all the types.
Definition at line 239 of file VariantValue.cpp.
Referenced by clang::ast_matchers::dynamic::VariantValue::getTypeAsString().
ast_matchers::internal::Matcher<T> clang::ast_matchers::dynamic::VariantMatcher::getTypedMatcher | ( | ) | const [inline] |
Return this matcher as a Matcher<T>
.
Handles the different types (Single, Polymorphic) accordingly. Asserts that hasTypedMatcher<T>()
is true.
Definition at line 199 of file VariantValue.h.
bool clang::ast_matchers::dynamic::VariantMatcher::hasTypedMatcher | ( | ) | const [inline] |
Determines if the contained matcher can be converted to Matcher<T>
.
For the Single case, it returns true if it can be converted to Matcher<T>
. For the Polymorphic case, it returns true if one, and only one, of the overloads can be converted to Matcher<T>
. If there are more than one that can, the result would be ambiguous and false is returned.
Definition at line 176 of file VariantValue.h.
Referenced by clang::ast_matchers::dynamic::internal::ArgTypeTraits< ast_matchers::internal::Matcher< T > >::is().
bool clang::ast_matchers::dynamic::VariantMatcher::isConvertibleTo | ( | ast_type_traits::ASTNodeKind | Kind, |
unsigned * | Specificity | ||
) | const [inline] |
Determines if the contained matcher can be converted to Kind
.
Kind | the requested destination type. |
Specificity | value corresponding to the "specificity" of the convertion. |
Definition at line 187 of file VariantValue.h.
Referenced by clang::ast_matchers::dynamic::VariantValue::isConvertibleTo().
bool clang::ast_matchers::dynamic::VariantMatcher::isNull | ( | ) | const [inline] |
Whether the matcher is null.
Definition at line 158 of file VariantValue.h.
Referenced by clang::ast_matchers::dynamic::Registry::constructBoundMatcher(), and clang::ast_matchers::dynamic::internal::OverloadedMatcherDescriptor::create().
VariantMatcher clang::ast_matchers::dynamic::VariantMatcher::PolymorphicMatcher | ( | std::vector< DynTypedMatcher > | Matchers | ) | [static] |
Clones the provided matchers.
They should be the result of a polymorphic matcher.
Definition at line 223 of file VariantValue.cpp.
References VariantMatcher().
Referenced by clang::ast_matchers::dynamic::internal::outvalueToVariantMatcher().
Makes the matcher the "null" matcher.
Definition at line 237 of file VariantValue.cpp.
VariantMatcher clang::ast_matchers::dynamic::VariantMatcher::SingleMatcher | ( | const DynTypedMatcher & | Matcher | ) | [static] |
Clones the provided matcher.
Definition at line 218 of file VariantValue.cpp.
References VariantMatcher().
Referenced by clang::ast_matchers::dynamic::internal::outvalueToVariantMatcher().
VariantMatcher clang::ast_matchers::dynamic::VariantMatcher::VariadicOperatorMatcher | ( | DynTypedMatcher::VariadicOperatorFunction | Func, |
std::vector< VariantMatcher > | Args | ||
) | [static] |
Creates a 'variadic' operator matcher.
It will bind to the appropriate type on getTypedMatcher<T>().
Definition at line 227 of file VariantValue.cpp.
References VariantMatcher().
Referenced by clang::ast_matchers::dynamic::internal::VariadicOperatorMatcherDescriptor::create().