clang 22.0.0git
clang::Value Class Reference

#include "clang/Interpreter/Value.h"

Inheritance diagram for clang::Value:
[legend]

Classes

struct  convertFwd
struct  convertFwd< T * >

Public Types

enum  Kind { K_Void , K_PtrOrObj , K_Unspecified }

Public Member Functions

 Value ()=default
 Value (const 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 ()
const ASTContextgetASTContext () const
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)
void setRawBits (void *Ptr, unsigned NBits=sizeof(Storage))
template<typename T>
REPL_BUILTIN_TYPES T convertTo () const
 Get the value with cast.
template<>
void * as () const

Protected Member Functions

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

Protected Attributes

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

Detailed Description

Definition at line 95 of file Value.h.

Member Enumeration Documentation

◆ Kind

Enumerator
K_Void 
K_PtrOrObj 
K_Unspecified 

Definition at line 105 of file Value.h.

Constructor & Destructor Documentation

◆ Value() [1/4]

◆ Value() [2/4]

◆ Value() [3/4]

clang::Value::Value ( const Value & RHS)

Definition at line 167 of file Value.cpp.

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

◆ Value() [4/4]

clang::Value::Value ( Value && RHS)
noexcept

Definition at line 174 of file Value.cpp.

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

◆ ~Value()

clang::Value::~Value ( )

Definition at line 225 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 165 of file Value.h.

References REPL_BUILTIN_TYPES, clang::T, and ValueKind.

Referenced by as().

◆ as() [2/2]

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

Definition at line 204 of file Value.h.

References as(), Data, and isPointerOrObjectType().

◆ clear()

void clang::Value::clear ( )

Definition at line 216 of file Value.cpp.

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

Referenced by clang::ASTContext::cleanup(), Value(), and ~Value().

◆ 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 156 of file Value.h.

References clang::Value::convertFwd< T >::cast(), and clang::T.

◆ dump()

void clang::Value::dump ( ) const

Definition at line 251 of file Value.cpp.

References print().

◆ getASTContext()

const ASTContext & clang::Value::getASTContext ( ) const

Definition at line 247 of file Value.cpp.

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

Referenced by Value(), and Value().

◆ getInterpreter()

const Interpreter & clang::Value::getInterpreter ( ) const

Definition at line 241 of file Value.cpp.

References Interp.

Referenced by getASTContext(), Value(), and Value().

◆ getKind()

◆ getPtr()

void * clang::Value::getPtr ( ) const

Definition at line 227 of file Value.cpp.

References Data, K_PtrOrObj, and ValueKind.

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

◆ getType()

QualType clang::Value::getType ( ) const

Definition at line 237 of file Value.cpp.

References clang::QualType::getFromOpaquePtr(), and OpaqueType.

Referenced by __clang_Interpreter_SetValueNoAlloc(), AddResultTypeChunk(), clang::Sema::ApplyNullability(), buildFMulAdd(), clang::Sema::BuildStmtExpr(), CheckEvaluationResult(), ClassifyMemberExpr(), createCastsForTypeOfSameSize(), DeduceNonTypeTemplateArgument(), DeduceNullPtrTemplateArgument(), clang::CodeGen::CodeGenFunction::EmitAArch64BuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitAArch64CompareBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitAMDGPUBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitARMBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitAtomicStore(), clang::CodeGen::CodeGenFunction::EmitBitfieldConversionCheck(), EmitBitfieldTruncationCheckHelper(), EmitBitTestIntrinsic(), clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitCheckedArgForBuiltin(), clang::CodeGen::CodeGenFunction::EmitDirectXBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitDynamicCast(), clang::CodeGen::CodeGenFunction::EmitFromMemory(), EmitGEPOffsetInBytes(), clang::CodeGen::CodeGenFunction::EmitHLSLBuiltinExpr(), EmitIntegerSignChangeCheckHelper(), EmitIntegerTruncationCheckHelper(), EmitllvmFAbs(), clang::CodeGen::CodeGenFunction::EmitMSVCBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitNVPTXBuiltinExpr(), EmitOverflowCheckedAbs(), emitPointerArithmetic(), clang::CodeGen::CodeGenFunction::emitPointerAuthResign(), clang::CodeGen::CodeGenFunction::emitPointerAuthResignCall(), clang::CodeGen::CodeGenFunction::EmitPPCBuiltinExpr(), emitRVVVLEFFBuiltin(), EmitScalarFMAExpr(), clang::CodeGen::CodeGenFunction::EmitScalarRangeCheck(), clang::CodeGen::CodeGenFunction::EmitSPIRVBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::CodeGenFunction::EmitSVEPredicateCast(), clang::CodeGen::CodeGenFunction::EmitSVEPredicateTupleCast(), clang::CodeGen::CodeGenFunction::EmitSVEPrefetchLoad(), clang::CodeGen::CodeGenFunction::EmitToMemory(), clang::CodeGen::CodeGenFunction::EmitWebAssemblyBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitX86BuiltinExpr(), EmitX86CvtF16ToFloatExpr(), EmitX86FMAExpr(), EmitX86FunnelShift(), EmitX86MaskedCompareResult(), EmitX86ScalarSelect(), EmitX86Select(), EmitX86vpcom(), clang::CodeGen::CodeGenFunction::GetAddressOfBaseClass(), clang::CodeGen::CodeGenFunction::GetAddressOfDerivedClass(), clang::getDeclUsageType(), getMaskVecValue(), handleHlslSplitdouble(), isReferenceToNonConstCapture(), isUnsigned(), MakeAtomicCmpXchgValue(), clang::ast_matchers::matchEachArgumentWithParamTypeImpl(), clang::Sema::PerformMoveOrCopyInitialization(), print(), clang::CodeGen::CodeGenFunction::tryEmitAsConstant(), Value(), and clang::interp::Compiler< Emitter >::visitSwitchStmt().

◆ hasValue()

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

Definition at line 135 of file Value.h.

References isValid(), and isVoid().

Referenced by CheckEvaluationResult(), and HandleConstructorCall().

◆ isManuallyAlloc()

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

Definition at line 136 of file Value.h.

References IsManuallyAlloc.

◆ isPointerOrObjectType()

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

Definition at line 161 of file Value.h.

References K_PtrOrObj, and ValueKind.

Referenced by as().

◆ isValid()

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

Definition at line 133 of file Value.h.

References K_Unspecified, and ValueKind.

Referenced by hasValue(), and print().

◆ isVoid()

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

Definition at line 134 of file Value.h.

References K_Void, and ValueKind.

Referenced by __clang_Interpreter_SetValueNoAlloc(), and hasValue().

◆ operator=() [1/2]

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

Definition at line 185 of file Value.cpp.

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

Referenced by Value().

◆ operator=() [2/2]

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

Definition at line 201 of file Value.cpp.

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

◆ print()

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

Definition at line 262 of file Value.cpp.

References getType(), isValid(), OpaqueType, printData(), and printType().

Referenced by dump().

◆ printData()

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

Definition at line 257 of file Value.cpp.

References Interp.

Referenced by print(), and Value().

◆ printType()

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

Definition at line 253 of file Value.cpp.

References Interp.

Referenced by print(), and Value().

◆ setKind()

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

Definition at line 138 of file Value.h.

References ValueKind.

Referenced by Value().

◆ setOpaqueType()

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

Definition at line 139 of file Value.h.

References OpaqueType.

◆ setPtr()

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

Definition at line 142 of file Value.h.

References Data.

Referenced by __clang_Interpreter_SetValueNoAlloc(), and Value().

◆ setRawBits()

void clang::Value::setRawBits ( void * Ptr,
unsigned NBits = sizeof(Storage) )

Definition at line 232 of file Value.cpp.

References Data, and memcpy().

Member Data Documentation

◆ Data

Storage clang::Value::Data
protected

Definition at line 199 of file Value.h.

Referenced by as(), getPtr(), operator=(), operator=(), setPtr(), setRawBits(), Value(), and Value().

◆ Interp

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

Definition at line 197 of file Value.h.

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

◆ IsManuallyAlloc

bool clang::Value::IsManuallyAlloc = false
protected

◆ OpaqueType

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

Definition at line 198 of file Value.h.

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

◆ ValueKind

Kind clang::Value::ValueKind = K_Unspecified
protected

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