clang
6.0.0
|
Variant value class. More...
#include "clang/ASTMatchers/Dynamic/VariantValue.h"
Public Member Functions | |
VariantValue () | |
VariantValue (const VariantValue &Other) | |
~VariantValue () | |
VariantValue & | operator= (const VariantValue &Other) |
VariantValue (bool Boolean) | |
Specific constructors for each supported type. More... | |
VariantValue (double Double) | |
VariantValue (unsigned Unsigned) | |
VariantValue (StringRef String) | |
VariantValue (const VariantMatcher &Matchers) | |
VariantValue (int Signed) | |
Constructs an unsigned value (disambiguation from bool). More... | |
operator bool () const | |
Returns true iff this is not an empty value. More... | |
bool | hasValue () const |
bool | isBoolean () const |
Boolean value functions. More... | |
bool | getBoolean () const |
void | setBoolean (bool Boolean) |
bool | isDouble () const |
Double value functions. More... | |
double | getDouble () const |
void | setDouble (double Double) |
bool | isUnsigned () const |
Unsigned value functions. More... | |
unsigned | getUnsigned () const |
void | setUnsigned (unsigned Unsigned) |
bool | isString () const |
String value functions. More... | |
const std::string & | getString () const |
void | setString (StringRef String) |
bool | isMatcher () const |
Matcher value functions. More... | |
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 . More... | |
bool | isConvertibleTo (ArrayRef< ArgKind > Kinds, unsigned *Specificity) const |
Determines if the contained value can be converted to any kind in Kinds . More... | |
std::string | getTypeAsString () const |
String representation of the type of the value. More... | |
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:
bool
- unsigned
llvm::StringRef
VariantMatcher
(DynTypedMatcher
/ Matcher<T>
) Definition at line 251 of file VariantValue.h.
|
inline |
Definition at line 253 of file VariantValue.h.
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | const VariantValue & | Other | ) |
Definition at line 250 of file VariantValue.cpp.
clang::ast_matchers::dynamic::VariantValue::~VariantValue | ( | ) |
Definition at line 274 of file VariantValue.cpp.
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | bool | Boolean | ) |
Specific constructors for each supported type.
Definition at line 254 of file VariantValue.cpp.
References setBoolean().
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | double | Double | ) |
Definition at line 258 of file VariantValue.cpp.
References setDouble().
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | unsigned | Unsigned | ) |
Definition at line 262 of file VariantValue.cpp.
References setUnsigned().
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | StringRef | String | ) |
Definition at line 266 of file VariantValue.cpp.
References setString().
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | const VariantMatcher & | Matchers | ) |
Definition at line 270 of file VariantValue.cpp.
References setMatcher().
|
inline |
Constructs an unsigned
value (disambiguation from bool).
Definition at line 267 of file VariantValue.h.
bool clang::ast_matchers::dynamic::VariantValue::getBoolean | ( | ) | const |
double clang::ast_matchers::dynamic::VariantValue::getDouble | ( | ) | const |
const VariantMatcher & clang::ast_matchers::dynamic::VariantValue::getMatcher | ( | ) | const |
Definition at line 384 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 369 of file VariantValue.cpp.
References isString().
Referenced by clang::ast_matchers::dynamic::internal::ArgTypeTraits< attr::Kind >::is(), clang::ast_matchers::dynamic::internal::ArgTypeTraits< CastKind >::is(), clang::ast_matchers::dynamic::Parser::ScopedContextEntry::nextArg(), and operator=().
std::string clang::ast_matchers::dynamic::VariantValue::getTypeAsString | ( | ) | const |
String representation of the type of the value.
Definition at line 444 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().
unsigned clang::ast_matchers::dynamic::VariantValue::getUnsigned | ( | ) | const |
Definition at line 354 of file VariantValue.cpp.
References isUnsigned().
Referenced by operator=().
|
inline |
Definition at line 271 of file VariantValue.h.
bool clang::ast_matchers::dynamic::VariantValue::isBoolean | ( | ) | const |
Boolean value functions.
Definition at line 320 of file VariantValue.cpp.
Referenced by getBoolean(), clang::ast_matchers::dynamic::internal::ArgTypeTraits< bool >::is(), and isConvertibleTo().
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 conversion. |
Definition at line 395 of file VariantValue.cpp.
References clang::ast_matchers::dynamic::ArgKind::AK_Boolean, clang::ast_matchers::dynamic::ArgKind::AK_Double, 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(), isBoolean(), clang::ast_matchers::dynamic::VariantMatcher::isConvertibleTo(), isDouble(), 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 conversion. It is the maximum specificity of all the possible conversions. |
Definition at line 429 of file VariantValue.cpp.
References isConvertibleTo(), and max().
bool clang::ast_matchers::dynamic::VariantValue::isDouble | ( | ) | const |
Double value functions.
Definition at line 335 of file VariantValue.cpp.
Referenced by getDouble(), clang::ast_matchers::dynamic::internal::ArgTypeTraits< double >::is(), and isConvertibleTo().
bool clang::ast_matchers::dynamic::VariantValue::isMatcher | ( | ) | const |
Matcher value functions.
Definition at line 380 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().
bool clang::ast_matchers::dynamic::VariantValue::isString | ( | ) | const |
String value functions.
Definition at line 365 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(), clang::ast_matchers::dynamic::internal::ArgTypeTraits< CastKind >::is(), isConvertibleTo(), and clang::ast_matchers::dynamic::Parser::ScopedContextEntry::nextArg().
bool clang::ast_matchers::dynamic::VariantValue::isUnsigned | ( | ) | const |
Unsigned value functions.
Definition at line 350 of file VariantValue.cpp.
Referenced by getUnsigned(), clang::ast_matchers::dynamic::internal::ArgTypeTraits< unsigned >::is(), and isConvertibleTo().
|
inlineexplicit |
Returns true iff this is not an empty value.
Definition at line 270 of file VariantValue.h.
VariantValue & clang::ast_matchers::dynamic::VariantValue::operator= | ( | const VariantValue & | Other | ) |
Definition at line 276 of file VariantValue.cpp.
References getBoolean(), getDouble(), getMatcher(), getString(), getUnsigned(), setBoolean(), setDouble(), setMatcher(), setString(), and setUnsigned().
void clang::ast_matchers::dynamic::VariantValue::setBoolean | ( | bool | Boolean | ) |
Definition at line 329 of file VariantValue.cpp.
Referenced by operator=(), and VariantValue().
void clang::ast_matchers::dynamic::VariantValue::setDouble | ( | double | Double | ) |
Definition at line 344 of file VariantValue.cpp.
Referenced by operator=(), and VariantValue().
void clang::ast_matchers::dynamic::VariantValue::setMatcher | ( | const VariantMatcher & | Matcher | ) |
Definition at line 389 of file VariantValue.cpp.
Referenced by operator=(), and VariantValue().
void clang::ast_matchers::dynamic::VariantValue::setString | ( | StringRef | String | ) |
Definition at line 374 of file VariantValue.cpp.
Referenced by operator=(), and VariantValue().
void clang::ast_matchers::dynamic::VariantValue::setUnsigned | ( | unsigned | Unsigned | ) |
Definition at line 359 of file VariantValue.cpp.
Referenced by operator=(), and VariantValue().