clang API Documentation
Variant value class. More...
#include <VariantValue.h>
Classes | |
union | AllValues |
All supported value types. | |
Public Member Functions | |
VariantValue () | |
VariantValue (const VariantValue &Other) | |
~VariantValue () | |
VariantValue & | operator= (const VariantValue &Other) |
VariantValue (unsigned Unsigned) | |
Specific constructors for each supported type. | |
VariantValue (const std::string &String) | |
VariantValue (const VariantMatcher &Matchers) | |
LLVM_EXPLICIT | operator bool () const |
Returns true iff this is not an empty value. | |
bool | hasValue () const |
bool | isUnsigned () const |
Unsigned value functions. | |
unsigned | getUnsigned () const |
void | setUnsigned (unsigned Unsigned) |
bool | isString () const |
String value functions. | |
const std::string & | getString () const |
void | setString (const std::string &String) |
bool | isMatcher () const |
Matcher value functions. | |
const VariantMatcher & | getMatcher () const |
void | setMatcher (const VariantMatcher &Matcher) |
bool | isConvertibleTo (ArgKind Kind, unsigned *Specificity) const |
Determines if the contained value can be converted to Kind . | |
bool | isConvertibleTo (ArrayRef< ArgKind > Kinds, unsigned *Specificity) const |
Determines if the contained value can be converted to any kind in Kinds . | |
std::string | getTypeAsString () const |
String representation of the type of the value. |
Variant value class.
Basically, a tagged union with value type semantics. It is used by the registry as the return value and argument type for the matcher factory methods. It can be constructed from any of the supported types. It supports copy/assignment.
Supported types:
unsigned
std::string
VariantMatcher
(DynTypedMatcher
/ Matcher<T>
) Definition at line 247 of file VariantValue.h.
Definition at line 249 of file VariantValue.h.
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | const VariantValue & | Other | ) |
Definition at line 244 of file VariantValue.cpp.
Definition at line 260 of file VariantValue.cpp.
Specific constructors for each supported type.
Definition at line 248 of file VariantValue.cpp.
References setUnsigned().
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | const std::string & | String | ) |
Definition at line 252 of file VariantValue.cpp.
References setString().
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | const VariantMatcher & | Matchers | ) |
Definition at line 256 of file VariantValue.cpp.
References setMatcher().
const VariantMatcher & clang::ast_matchers::dynamic::VariantValue::getMatcher | ( | ) | const |
Definition at line 332 of file VariantValue.cpp.
References isMatcher().
Referenced by clang::ast_matchers::dynamic::internal::VariadicOperatorMatcherDescriptor::create(), getTypeAsString(), clang::ast_matchers::dynamic::internal::ArgTypeTraits< ast_matchers::internal::Matcher< T > >::is(), isConvertibleTo(), operator=(), and clang::ast_matchers::dynamic::Parser::parseMatcherExpression().
const std::string & clang::ast_matchers::dynamic::VariantValue::getString | ( | ) | const |
Definition at line 317 of file VariantValue.cpp.
References isString().
Referenced by clang::ast_matchers::dynamic::internal::ArgTypeTraits< attr::Kind >::is(), and operator=().
std::string clang::ast_matchers::dynamic::VariantValue::getTypeAsString | ( | ) | const |
String representation of the type of the value.
Definition at line 380 of file VariantValue.cpp.
References getMatcher(), and clang::ast_matchers::dynamic::VariantMatcher::getTypeAsString().
Referenced by clang::ast_matchers::dynamic::internal::VariadicOperatorMatcherDescriptor::create(), clang::ast_matchers::dynamic::Parser::parseMatcherExpression(), and clang::ast_matchers::dynamic::internal::variadicMatcherDescriptor().
Definition at line 302 of file VariantValue.cpp.
References isUnsigned().
Referenced by operator=().
bool clang::ast_matchers::dynamic::VariantValue::hasValue | ( | ) | const [inline] |
Definition at line 262 of file VariantValue.h.
Referenced by operator bool().
bool clang::ast_matchers::dynamic::VariantValue::isConvertibleTo | ( | ArgKind | Kind, |
unsigned * | Specificity | ||
) | const |
Determines if the contained value can be converted to Kind
.
Kind | the requested destination type. |
Specificity | value corresponding to the "specificity" of the convertion. |
Definition at line 343 of file VariantValue.cpp.
References clang::ast_matchers::dynamic::ArgKind::AK_Matcher, clang::ast_matchers::dynamic::ArgKind::AK_String, clang::ast_matchers::dynamic::ArgKind::AK_Unsigned, clang::ast_matchers::dynamic::ArgKind::getArgKind(), getMatcher(), clang::ast_matchers::dynamic::ArgKind::getMatcherKind(), clang::ast_matchers::dynamic::VariantMatcher::isConvertibleTo(), isMatcher(), isString(), and isUnsigned().
Referenced by isConvertibleTo().
bool clang::ast_matchers::dynamic::VariantValue::isConvertibleTo | ( | ArrayRef< ArgKind > | Kinds, |
unsigned * | Specificity | ||
) | const |
Determines if the contained value can be converted to any kind in Kinds
.
Kinds | the requested destination types. |
Specificity | value corresponding to the "specificity" of the convertion. It is the maximum specificity of all the possible conversions. |
Definition at line 365 of file VariantValue.cpp.
References isConvertibleTo().
Matcher value functions.
Definition at line 328 of file VariantValue.cpp.
Referenced by clang::ast_matchers::dynamic::internal::VariadicOperatorMatcherDescriptor::create(), getMatcher(), clang::ast_matchers::dynamic::internal::ArgTypeTraits< ast_matchers::internal::Matcher< T > >::is(), isConvertibleTo(), and clang::ast_matchers::dynamic::Parser::parseMatcherExpression().
String value functions.
Definition at line 313 of file VariantValue.cpp.
Referenced by getString(), clang::ast_matchers::dynamic::internal::ArgTypeTraits< std::string >::is(), clang::ast_matchers::dynamic::internal::ArgTypeTraits< attr::Kind >::is(), and isConvertibleTo().
Unsigned value functions.
Definition at line 298 of file VariantValue.cpp.
Referenced by getUnsigned(), clang::ast_matchers::dynamic::internal::ArgTypeTraits< unsigned >::is(), and isConvertibleTo().
LLVM_EXPLICIT clang::ast_matchers::dynamic::VariantValue::operator bool | ( | ) | const [inline] |
Returns true iff this is not an empty value.
Definition at line 261 of file VariantValue.h.
References hasValue().
VariantValue & clang::ast_matchers::dynamic::VariantValue::operator= | ( | const VariantValue & | Other | ) |
Definition at line 262 of file VariantValue.cpp.
References getMatcher(), getString(), getUnsigned(), setMatcher(), setString(), and setUnsigned().
void clang::ast_matchers::dynamic::VariantValue::setMatcher | ( | const VariantMatcher & | Matcher | ) |
Definition at line 337 of file VariantValue.cpp.
Referenced by operator=(), and VariantValue().
void clang::ast_matchers::dynamic::VariantValue::setString | ( | const std::string & | String | ) |
Definition at line 322 of file VariantValue.cpp.
Referenced by operator=(), and VariantValue().
void clang::ast_matchers::dynamic::VariantValue::setUnsigned | ( | unsigned | Unsigned | ) |
Definition at line 307 of file VariantValue.cpp.
Referenced by operator=(), and VariantValue().