clang 19.0.0git
Classes | Public Member Functions | List of all members
clang::ast_matchers::dynamic::VariantValue Class Reference

Variant value class. More...

#include "clang/ASTMatchers/Dynamic/VariantValue.h"

Public Member Functions

 VariantValue ()
 
 VariantValue (const VariantValue &Other)
 
 ~VariantValue ()
 
VariantValueoperator= (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 ASTNodeKindgetNodeKind () const
 
void setNodeKind (ASTNodeKind NodeKind)
 
bool isMatcher () const
 Matcher value functions.
 
const VariantMatchergetMatcher () 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.
 

Detailed Description

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

Definition at line 254 of file VariantValue.h.

Constructor & Destructor Documentation

◆ VariantValue() [1/9]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( )
inline

Definition at line 256 of file VariantValue.h.

◆ VariantValue() [2/9]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( const VariantValue Other)

Definition at line 255 of file VariantValue.cpp.

References clang::Other.

◆ ~VariantValue()

clang::ast_matchers::dynamic::VariantValue::~VariantValue ( )

Definition at line 283 of file VariantValue.cpp.

◆ VariantValue() [3/9]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( bool  Boolean)

Specific constructors for each supported type.

Definition at line 259 of file VariantValue.cpp.

References setBoolean().

◆ VariantValue() [4/9]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( double  Double)

Definition at line 263 of file VariantValue.cpp.

References clang::Double, and setDouble().

◆ VariantValue() [5/9]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( unsigned  Unsigned)

Definition at line 267 of file VariantValue.cpp.

References setUnsigned(), and clang::Unsigned.

◆ VariantValue() [6/9]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( StringRef  String)

Definition at line 271 of file VariantValue.cpp.

References setString().

◆ VariantValue() [7/9]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( ASTNodeKind  NodeKind)

Definition at line 275 of file VariantValue.cpp.

References setNodeKind().

◆ VariantValue() [8/9]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( const VariantMatcher Matchers)

Definition at line 279 of file VariantValue.cpp.

References setMatcher().

◆ VariantValue() [9/9]

clang::ast_matchers::dynamic::VariantValue::VariantValue ( int  Signed)
inline

Constructs an unsigned value (disambiguation from bool).

Definition at line 271 of file VariantValue.h.

Member Function Documentation

◆ getBoolean()

bool clang::ast_matchers::dynamic::VariantValue::getBoolean ( ) const

Definition at line 339 of file VariantValue.cpp.

References isBoolean().

◆ getDouble()

double clang::ast_matchers::dynamic::VariantValue::getDouble ( ) const

Definition at line 354 of file VariantValue.cpp.

References isDouble().

◆ getMatcher()

const VariantMatcher & clang::ast_matchers::dynamic::VariantValue::getMatcher ( ) const

Definition at line 412 of file VariantValue.cpp.

References isMatcher().

Referenced by getTypeAsString(), and isConvertibleTo().

◆ getNodeKind()

const ASTNodeKind & clang::ast_matchers::dynamic::VariantValue::getNodeKind ( ) const

Definition at line 397 of file VariantValue.cpp.

References isNodeKind().

Referenced by getTypeAsString().

◆ getString()

const std::string & clang::ast_matchers::dynamic::VariantValue::getString ( ) const

Definition at line 384 of file VariantValue.cpp.

References isString().

◆ getTypeAsString()

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().

◆ getUnsigned()

unsigned clang::ast_matchers::dynamic::VariantValue::getUnsigned ( ) const

Definition at line 369 of file VariantValue.cpp.

References isUnsigned().

◆ hasValue()

bool clang::ast_matchers::dynamic::VariantValue::hasValue ( ) const
inline

Definition at line 275 of file VariantValue.h.

Referenced by operator bool().

◆ isBoolean()

bool clang::ast_matchers::dynamic::VariantValue::isBoolean ( ) const

Boolean value functions.

Definition at line 335 of file VariantValue.cpp.

Referenced by getBoolean(), and isConvertibleTo().

◆ isConvertibleTo() [1/2]

bool clang::ast_matchers::dynamic::VariantValue::isConvertibleTo ( ArgKind  Kind,
unsigned Specificity 
) const

◆ isConvertibleTo() [2/2]

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.

Parameters
Kindsthe requested destination types.
Specificityvalue 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().

◆ isDouble()

bool clang::ast_matchers::dynamic::VariantValue::isDouble ( ) const

Double value functions.

Definition at line 350 of file VariantValue.cpp.

Referenced by getDouble(), and isConvertibleTo().

◆ isMatcher()

bool clang::ast_matchers::dynamic::VariantValue::isMatcher ( ) const

Matcher value functions.

Definition at line 408 of file VariantValue.cpp.

Referenced by getMatcher(), and isConvertibleTo().

◆ isNodeKind()

bool clang::ast_matchers::dynamic::VariantValue::isNodeKind ( ) const

Definition at line 395 of file VariantValue.cpp.

Referenced by getNodeKind(), and isConvertibleTo().

◆ isString()

bool clang::ast_matchers::dynamic::VariantValue::isString ( ) const

String value functions.

Definition at line 380 of file VariantValue.cpp.

Referenced by getString(), and isConvertibleTo().

◆ isUnsigned()

bool clang::ast_matchers::dynamic::VariantValue::isUnsigned ( ) const

Unsigned value functions.

Definition at line 365 of file VariantValue.cpp.

Referenced by getUnsigned(), and isConvertibleTo().

◆ operator bool()

clang::ast_matchers::dynamic::VariantValue::operator bool ( ) const
inlineexplicit

Returns true iff this is not an empty value.

Definition at line 274 of file VariantValue.h.

References hasValue().

◆ operator=()

VariantValue & clang::ast_matchers::dynamic::VariantValue::operator= ( const VariantValue Other)

◆ setBoolean()

void clang::ast_matchers::dynamic::VariantValue::setBoolean ( bool  Boolean)

Definition at line 344 of file VariantValue.cpp.

Referenced by operator=(), and VariantValue().

◆ setDouble()

void clang::ast_matchers::dynamic::VariantValue::setDouble ( double  Double)

Definition at line 359 of file VariantValue.cpp.

Referenced by operator=(), and VariantValue().

◆ setMatcher()

void clang::ast_matchers::dynamic::VariantValue::setMatcher ( const VariantMatcher Matcher)

Definition at line 417 of file VariantValue.cpp.

Referenced by operator=(), and VariantValue().

◆ setNodeKind()

void clang::ast_matchers::dynamic::VariantValue::setNodeKind ( ASTNodeKind  NodeKind)

Definition at line 402 of file VariantValue.cpp.

Referenced by operator=(), and VariantValue().

◆ setString()

void clang::ast_matchers::dynamic::VariantValue::setString ( StringRef  String)

Definition at line 389 of file VariantValue.cpp.

Referenced by operator=(), and VariantValue().

◆ setUnsigned()

void clang::ast_matchers::dynamic::VariantValue::setUnsigned ( unsigned  Unsigned)

Definition at line 374 of file VariantValue.cpp.

Referenced by operator=(), and VariantValue().


The documentation for this class was generated from the following files: