clang 20.0.0git
|
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. | |
VariantValue (double Double) | |
VariantValue (unsigned Unsigned) | |
VariantValue (StringRef String) | |
VariantValue (ASTNodeKind NodeKind) | |
VariantValue (const VariantMatcher &Matchers) | |
VariantValue (int Signed) | |
Constructs an unsigned value (disambiguation from bool). | |
operator bool () const | |
Returns true iff this is not an empty value. | |
bool | hasValue () const |
bool | isBoolean () const |
Boolean value functions. | |
bool | getBoolean () const |
void | setBoolean (bool Boolean) |
bool | isDouble () const |
Double value functions. | |
double | getDouble () const |
void | setDouble (double Double) |
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 (StringRef String) |
bool | isNodeKind () const |
const ASTNodeKind & | getNodeKind () const |
void | setNodeKind (ASTNodeKind NodeKind) |
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:
bool
unsigned
llvm::StringRef
VariantMatcher
(DynTypedMatcher
/ Matcher<T>
) Definition at line 254 of file VariantValue.h.
|
inline |
Definition at line 256 of file VariantValue.h.
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | const VariantValue & | Other | ) |
Definition at line 255 of file VariantValue.cpp.
References clang::Other.
clang::ast_matchers::dynamic::VariantValue::~VariantValue | ( | ) |
Definition at line 283 of file VariantValue.cpp.
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | bool | Boolean | ) |
Specific constructors for each supported type.
Definition at line 259 of file VariantValue.cpp.
References setBoolean().
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | double | Double | ) |
Definition at line 263 of file VariantValue.cpp.
References clang::Double, and setDouble().
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | unsigned | Unsigned | ) |
Definition at line 267 of file VariantValue.cpp.
References setUnsigned(), and clang::Unsigned.
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | StringRef | String | ) |
Definition at line 271 of file VariantValue.cpp.
References setString().
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | ASTNodeKind | NodeKind | ) |
Definition at line 275 of file VariantValue.cpp.
References setNodeKind().
clang::ast_matchers::dynamic::VariantValue::VariantValue | ( | const VariantMatcher & | Matchers | ) |
Definition at line 279 of file VariantValue.cpp.
References setMatcher().
|
inline |
Constructs an unsigned
value (disambiguation from bool).
Definition at line 271 of file VariantValue.h.
bool clang::ast_matchers::dynamic::VariantValue::getBoolean | ( | ) | const |
Definition at line 339 of file VariantValue.cpp.
References isBoolean().
double clang::ast_matchers::dynamic::VariantValue::getDouble | ( | ) | const |
Definition at line 354 of file VariantValue.cpp.
References isDouble().
const VariantMatcher & clang::ast_matchers::dynamic::VariantValue::getMatcher | ( | ) | const |
Definition at line 412 of file VariantValue.cpp.
References isMatcher().
Referenced by getTypeAsString(), and isConvertibleTo().
const ASTNodeKind & clang::ast_matchers::dynamic::VariantValue::getNodeKind | ( | ) | const |
Definition at line 397 of file VariantValue.cpp.
References isNodeKind().
Referenced by getTypeAsString().
const std::string & clang::ast_matchers::dynamic::VariantValue::getString | ( | ) | const |
Definition at line 384 of file VariantValue.cpp.
References isString().
std::string clang::ast_matchers::dynamic::VariantValue::getTypeAsString | ( | ) | const |
String representation of the type of the value.
Definition at line 477 of file VariantValue.cpp.
References clang::ASTNodeKind::asStringRef(), getMatcher(), getNodeKind(), and clang::ast_matchers::dynamic::VariantMatcher::getTypeAsString().
unsigned clang::ast_matchers::dynamic::VariantValue::getUnsigned | ( | ) | const |
Definition at line 369 of file VariantValue.cpp.
References isUnsigned().
|
inline |
Definition at line 275 of file VariantValue.h.
Referenced by operator bool().
bool clang::ast_matchers::dynamic::VariantValue::isBoolean | ( | ) | const |
Boolean value functions.
Definition at line 335 of file VariantValue.cpp.
Referenced by getBoolean(), 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 423 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_Node, clang::ast_matchers::dynamic::ArgKind::AK_String, clang::ast_matchers::dynamic::ArgKind::AK_Unsigned, getMatcher(), isBoolean(), clang::ast_matchers::dynamic::VariantMatcher::isConvertibleTo(), isDouble(), isMatcher(), isNodeKind(), isString(), isUnsigned(), and Kind.
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 462 of file VariantValue.cpp.
References isConvertibleTo(), and Kind.
bool clang::ast_matchers::dynamic::VariantValue::isDouble | ( | ) | const |
Double value functions.
Definition at line 350 of file VariantValue.cpp.
Referenced by getDouble(), and isConvertibleTo().
bool clang::ast_matchers::dynamic::VariantValue::isMatcher | ( | ) | const |
Matcher value functions.
Definition at line 408 of file VariantValue.cpp.
Referenced by getMatcher(), and isConvertibleTo().
bool clang::ast_matchers::dynamic::VariantValue::isNodeKind | ( | ) | const |
Definition at line 395 of file VariantValue.cpp.
Referenced by getNodeKind(), and isConvertibleTo().
bool clang::ast_matchers::dynamic::VariantValue::isString | ( | ) | const |
String value functions.
Definition at line 380 of file VariantValue.cpp.
Referenced by getString(), and isConvertibleTo().
bool clang::ast_matchers::dynamic::VariantValue::isUnsigned | ( | ) | const |
Unsigned value functions.
Definition at line 365 of file VariantValue.cpp.
Referenced by getUnsigned(), and isConvertibleTo().
|
inlineexplicit |
Returns true iff this is not an empty value.
Definition at line 274 of file VariantValue.h.
References hasValue().
VariantValue & clang::ast_matchers::dynamic::VariantValue::operator= | ( | const VariantValue & | Other | ) |
Definition at line 285 of file VariantValue.cpp.
References clang::Other, setBoolean(), setDouble(), setMatcher(), setNodeKind(), setString(), and setUnsigned().
void clang::ast_matchers::dynamic::VariantValue::setBoolean | ( | bool | Boolean | ) |
Definition at line 344 of file VariantValue.cpp.
Referenced by operator=(), and VariantValue().
void clang::ast_matchers::dynamic::VariantValue::setDouble | ( | double | Double | ) |
Definition at line 359 of file VariantValue.cpp.
Referenced by operator=(), and VariantValue().
void clang::ast_matchers::dynamic::VariantValue::setMatcher | ( | const VariantMatcher & | Matcher | ) |
Definition at line 417 of file VariantValue.cpp.
Referenced by operator=(), and VariantValue().
void clang::ast_matchers::dynamic::VariantValue::setNodeKind | ( | ASTNodeKind | NodeKind | ) |
Definition at line 402 of file VariantValue.cpp.
Referenced by operator=(), and VariantValue().
void clang::ast_matchers::dynamic::VariantValue::setString | ( | StringRef | String | ) |
Definition at line 389 of file VariantValue.cpp.
Referenced by operator=(), and VariantValue().
void clang::ast_matchers::dynamic::VariantValue::setUnsigned | ( | unsigned | Unsigned | ) |
Definition at line 374 of file VariantValue.cpp.
Referenced by operator=(), and VariantValue().