clang  13.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. More...
 
 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). 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::stringgetString () const
 
void setString (StringRef String)
 
bool isNodeKind () const
 
const ASTNodeKindgetNodeKind () const
 
void setNodeKind (ASTNodeKind NodeKind)
 
bool isMatcher () const
 Matcher value functions. More...
 
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. 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...
 

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 254 of file VariantValue.cpp.

◆ ~VariantValue()

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

Definition at line 282 of file VariantValue.cpp.

◆ VariantValue() [3/9]

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

Specific constructors for each supported type.

Definition at line 258 of file VariantValue.cpp.

References setBoolean().

◆ VariantValue() [4/9]

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

Definition at line 262 of file VariantValue.cpp.

References setDouble().

◆ VariantValue() [5/9]

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

Definition at line 266 of file VariantValue.cpp.

References setUnsigned(), and clang::Unsigned.

◆ VariantValue() [6/9]

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

Definition at line 270 of file VariantValue.cpp.

References setString().

◆ VariantValue() [7/9]

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

Definition at line 274 of file VariantValue.cpp.

References setNodeKind().

◆ VariantValue() [8/9]

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

Definition at line 278 of file VariantValue.cpp.

◆ 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.

References clang::Signed.

Member Function Documentation

◆ getBoolean()

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

Definition at line 338 of file VariantValue.cpp.

References isBoolean().

Referenced by operator=().

◆ getDouble()

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

Definition at line 353 of file VariantValue.cpp.

References isDouble().

Referenced by operator=().

◆ getMatcher()

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

Definition at line 411 of file VariantValue.cpp.

References isMatcher().

Referenced by getTypeAsString(), isConvertibleTo(), and operator=().

◆ getNodeKind()

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

Definition at line 396 of file VariantValue.cpp.

References isNodeKind().

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

◆ getString()

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

Definition at line 383 of file VariantValue.cpp.

References isString().

Referenced by operator=().

◆ getTypeAsString()

std::string clang::ast_matchers::dynamic::VariantValue::getTypeAsString ( ) const

String representation of the type of the value.

Definition at line 476 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 368 of file VariantValue.cpp.

References isUnsigned().

Referenced by operator=().

◆ 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 334 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 461 of file VariantValue.cpp.

References isConvertibleTo(), and max().

◆ isDouble()

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

Double value functions.

Definition at line 349 of file VariantValue.cpp.

Referenced by getDouble(), and isConvertibleTo().

◆ isMatcher()

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

Matcher value functions.

Definition at line 407 of file VariantValue.cpp.

Referenced by getMatcher(), and isConvertibleTo().

◆ isNodeKind()

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

Definition at line 394 of file VariantValue.cpp.

Referenced by getNodeKind(), and isConvertibleTo().

◆ isString()

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

String value functions.

Definition at line 379 of file VariantValue.cpp.

Referenced by getString(), and isConvertibleTo().

◆ isUnsigned()

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

Unsigned value functions.

Definition at line 364 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 343 of file VariantValue.cpp.

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

◆ setDouble()

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

Definition at line 358 of file VariantValue.cpp.

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

◆ setMatcher()

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

Definition at line 416 of file VariantValue.cpp.

Referenced by operator=().

◆ setNodeKind()

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

Definition at line 401 of file VariantValue.cpp.

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

◆ setString()

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

Definition at line 388 of file VariantValue.cpp.

References string().

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

◆ setUnsigned()

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

Definition at line 373 of file VariantValue.cpp.

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


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