clang 19.0.0git
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clang::Value Class Reference

#include "clang/Interpreter/Value.h"

Classes

struct  convertFwd
 
struct  convertFwd< T * >
 

Public Types

enum  Kind { K_Void , K_PtrOrObj , K_Unspecified }
 

Public Member Functions

 Value ()=default
 
 Value (Interpreter *In, void *Ty)
 
 Value (const Value &RHS)
 
 Value (Value &&RHS) noexcept
 
Valueoperator= (const Value &RHS)
 
Valueoperator= (Value &&RHS) noexcept
 
 ~Value ()
 
void printType (llvm::raw_ostream &Out) const
 
void printData (llvm::raw_ostream &Out) const
 
void print (llvm::raw_ostream &Out) const
 
void dump () const
 
void clear ()
 
ASTContextgetASTContext ()
 
const ASTContextgetASTContext () const
 
InterpretergetInterpreter ()
 
const InterpretergetInterpreter () const
 
QualType getType () const
 
bool isValid () const
 
bool isVoid () const
 
bool hasValue () const
 
bool isManuallyAlloc () const
 
Kind getKind () const
 
void setKind (Kind K)
 
void setOpaqueType (void *Ty)
 
void * getPtr () const
 
void setPtr (void *Ptr)
 
template<typename T >
REPL_BUILTIN_TYPESconvertTo () const
 Get the value with cast.
 
template<>
void * as () const
 

Protected Member Functions

bool isPointerOrObjectType () const
 
template<typename T >
as () const
 Get to the value with type checking casting the underlying stored value to T.
 

Protected Attributes

InterpreterInterp = nullptr
 
void * OpaqueType = nullptr
 
Storage Data
 
Kind ValueKind = K_Unspecified
 
bool IsManuallyAlloc = false
 

Detailed Description

Definition at line 92 of file Value.h.

Member Enumeration Documentation

◆ Kind

Enumerator
K_Void 
K_PtrOrObj 
K_Unspecified 

Definition at line 101 of file Value.h.

Constructor & Destructor Documentation

◆ Value() [1/4]

clang::Value::Value ( )
default

◆ Value() [2/4]

Value::Value ( Interpreter In,
void *  Ty 
)

◆ Value() [3/4]

Value::Value ( const Value RHS)

Definition at line 169 of file Value.cpp.

References getPtr(), and IsManuallyAlloc.

◆ Value() [4/4]

Value::Value ( Value &&  RHS)
noexcept

Definition at line 176 of file Value.cpp.

References clang::Data.

◆ ~Value()

Value::~Value ( )

Definition at line 227 of file Value.cpp.

References clear().

Member Function Documentation

◆ as() [1/2]

template<typename T >
T clang::Value::as ( ) const
inlineprotected

Get to the value with type checking casting the underlying stored value to T.

Definition at line 162 of file Value.h.

References REPL_BUILTIN_TYPES.

◆ as() [2/2]

template<>
void * clang::Value::as ( ) const
inline

Definition at line 201 of file Value.h.

References Data, and isPointerOrObjectType().

◆ clear()

void Value::clear ( )

◆ convertTo()

template<typename T >
REPL_BUILTIN_TYPES T clang::Value::convertTo ( ) const
inline

Get the value with cast.

Get the value cast to T. This is similar to reinterpret_cast<T>(value), casting the value of builtins (except void), enums and pointers. Values referencing an object are treated as pointers to the object.

Definition at line 153 of file Value.h.

◆ dump()

void Value::dump ( ) const

Definition at line 256 of file Value.cpp.

References print().

Referenced by clang::Interpreter::ParseAndExecute().

◆ getASTContext() [1/2]

ASTContext & Value::getASTContext ( )

Definition at line 250 of file Value.cpp.

References clang::Interpreter::getASTContext(), and getInterpreter().

Referenced by Value().

◆ getASTContext() [2/2]

const ASTContext & Value::getASTContext ( ) const

Definition at line 252 of file Value.cpp.

References clang::Interpreter::getASTContext(), and getInterpreter().

◆ getInterpreter() [1/2]

Interpreter & Value::getInterpreter ( )

Definition at line 238 of file Value.cpp.

References Interp.

Referenced by getASTContext(), and Value().

◆ getInterpreter() [2/2]

const Interpreter & Value::getInterpreter ( ) const

Definition at line 244 of file Value.cpp.

References Interp.

◆ getKind()

Kind clang::Value::getKind ( ) const
inline

◆ getPtr()

void * Value::getPtr ( ) const

Definition at line 229 of file Value.cpp.

References Data, K_PtrOrObj, and ValueKind.

Referenced by __clang_Interpreter_SetValueWithAlloc(), clear(), operator=(), and Value().

◆ getType()

QualType Value::getType ( ) const

◆ hasValue()

bool clang::Value::hasValue ( ) const
inline

Definition at line 133 of file Value.h.

Referenced by CheckEvaluationResult(), and HandleConstructorCall().

◆ isManuallyAlloc()

bool clang::Value::isManuallyAlloc ( ) const
inline

Definition at line 134 of file Value.h.

◆ isPointerOrObjectType()

bool clang::Value::isPointerOrObjectType ( ) const
inlineprotected

Definition at line 158 of file Value.h.

Referenced by as().

◆ isValid()

bool clang::Value::isValid ( ) const
inline

Definition at line 131 of file Value.h.

Referenced by clang::Interpreter::ParseAndExecute().

◆ isVoid()

bool clang::Value::isVoid ( ) const
inline

Definition at line 132 of file Value.h.

◆ operator=() [1/2]

Value & Value::operator= ( const Value RHS)

Definition at line 187 of file Value.cpp.

References Data, getPtr(), Interp, IsManuallyAlloc, OpaqueType, and ValueKind.

◆ operator=() [2/2]

Value & Value::operator= ( Value &&  RHS)
noexcept

Definition at line 203 of file Value.cpp.

References clang::Data.

◆ print()

void Value::print ( llvm::raw_ostream &  Out) const

Definition at line 264 of file Value.cpp.

References OpaqueType.

Referenced by dump().

◆ printData()

void Value::printData ( llvm::raw_ostream &  Out) const

Definition at line 261 of file Value.cpp.

◆ printType()

void Value::printType ( llvm::raw_ostream &  Out) const

Definition at line 258 of file Value.cpp.

◆ setKind()

void clang::Value::setKind ( Kind  K)
inline

Definition at line 136 of file Value.h.

Referenced by Value().

◆ setOpaqueType()

void clang::Value::setOpaqueType ( void *  Ty)
inline

Definition at line 137 of file Value.h.

◆ setPtr()

void clang::Value::setPtr ( void *  Ptr)
inline

Definition at line 140 of file Value.h.

References Data.

Referenced by __clang_Interpreter_SetValueNoAlloc(), and Value().

Member Data Documentation

◆ Data

Storage clang::Value::Data
protected

Definition at line 196 of file Value.h.

Referenced by as(), getPtr(), and operator=().

◆ Interp

Interpreter* clang::Value::Interp = nullptr
protected

Definition at line 194 of file Value.h.

Referenced by clear(), getInterpreter(), operator=(), and Value().

◆ IsManuallyAlloc

bool clang::Value::IsManuallyAlloc = false
protected

Definition at line 198 of file Value.h.

Referenced by clear(), operator=(), and Value().

◆ OpaqueType

void* clang::Value::OpaqueType = nullptr
protected

Definition at line 195 of file Value.h.

Referenced by clear(), getType(), operator=(), and print().

◆ ValueKind

Kind clang::Value::ValueKind = K_Unspecified
protected

Definition at line 197 of file Value.h.

Referenced by clear(), getPtr(), operator=(), and Value().


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