clang 10.0.0git

Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
clang::APValue Class Reference

APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat], [Complex APSInt] [Complex APFloat], [Expr + Offset], [Vector: N * APValue], [Array: N * APValue]. More...

`#include "clang/AST/APValue.h"`

## Classes
struct | LV
class | LValueBase
class | LValuePathEntry
| A non-discriminated union of a base, field, or array index. More...
struct | MemberPointerData
struct | NoLValuePath
struct | UninitArray
struct | UninitStruct

## Public Types
enum | ValueKind { None, Indeterminate, Int, Float, FixedPoint, ComplexInt, ComplexFloat, LValue, Vector, Array, Struct, Union, MemberPointer, AddrLabelDiff }
typedef llvm::PointerIntPair< const Decl *, 1, bool > | BaseOrMemberType
| A FieldDecl or CXXRecordDecl, along with a flag indicating whether we mean a virtual or non-virtual base class subobject. More...

## Public Member Functions
| APValue ()
| APValue (APSInt I)
| APValue (APFloat F)
| APValue (APFixedPoint FX)
| APValue (const APValue *E, unsigned N)
| APValue (APSInt R, APSInt I)
| APValue (APFloat R, APFloat I)
| APValue (const APValue &RHS)
| APValue (APValue &&RHS)
| APValue (LValueBase B, const CharUnits &O, NoLValuePath N, bool IsNullPtr=false)
| APValue (LValueBase B, const CharUnits &O, ArrayRef< LValuePathEntry > Path, bool OnePastTheEnd, bool IsNullPtr=false)
| APValue (UninitArray, unsigned InitElts, unsigned Size)
| APValue (UninitStruct, unsigned B, unsigned M)
| APValue (const FieldDecl *D, const APValue &V=APValue())
| APValue (const ValueDecl *Member, bool IsDerivedMember, ArrayRef< const CXXRecordDecl *> Path)
| APValue (const AddrLabelExpr *LHSExpr, const AddrLabelExpr *RHSExpr)
| ~APValue ()
bool | needsCleanup () const
| Returns whether the object performed allocations. More...
void | swap (APValue &RHS)
| Swaps the contents of this and the given APValue. More...
ValueKind | getKind () const
bool | isAbsent () const
bool | isIndeterminate () const
bool | hasValue () const
bool | isInt () const
bool | isFloat () const
bool | isFixedPoint () const
bool | isComplexInt () const
bool | isComplexFloat () const
bool | isLValue () const
bool | isVector () const
bool | isArray () const
bool | isStruct () const
bool | isUnion () const
bool | isMemberPointer () const
bool | isAddrLabelDiff () const
void | dump () const
void | dump (raw_ostream &OS) const
void | printPretty (raw_ostream &OS, const ASTContext &Ctx, QualType Ty) const
std::string | getAsString (const ASTContext &Ctx, QualType Ty) const
APSInt & | getInt ()
const APSInt & | getInt () const
bool | toIntegralConstant (APSInt &Result, QualType SrcTy, const ASTContext &Ctx) const
| Try to convert this value to an integral constant. More...
APFloat & | getFloat ()
const APFloat & | getFloat () const
APFixedPoint & | getFixedPoint ()
const APFixedPoint & | getFixedPoint () const
APSInt & | getComplexIntReal ()
const APSInt & | getComplexIntReal () const
APSInt & | getComplexIntImag ()
const APSInt & | getComplexIntImag () const
APFloat & | getComplexFloatReal ()
const APFloat & | getComplexFloatReal () const
APFloat & | getComplexFloatImag ()
const APFloat & | getComplexFloatImag () const
const LValueBase | getLValueBase () const
CharUnits & | getLValueOffset ()
const CharUnits & | getLValueOffset () const
bool | isLValueOnePastTheEnd () const
bool | hasLValuePath () const
ArrayRef< LValuePathEntry > | getLValuePath () const
unsigned | getLValueCallIndex () const
unsigned | getLValueVersion () const
bool | isNullPointer () const
APValue & | getVectorElt (unsigned I)
const APValue & | getVectorElt (unsigned I) const
unsigned | getVectorLength () const
APValue & | getArrayInitializedElt (unsigned I)
const APValue & | getArrayInitializedElt (unsigned I) const
bool | hasArrayFiller () const
APValue & | getArrayFiller ()
const APValue & | getArrayFiller () const
unsigned | getArrayInitializedElts () const
unsigned | getArraySize () const
unsigned | getStructNumBases () const
unsigned | getStructNumFields () const
APValue & | getStructBase (unsigned i)
APValue & | getStructField (unsigned i)
const APValue & | getStructBase (unsigned i) const
const APValue & | getStructField (unsigned i) const
const FieldDecl * | getUnionField () const
APValue & | getUnionValue ()
const APValue & | getUnionValue () const
const ValueDecl * | getMemberPointerDecl () const
bool | isMemberPointerToDerivedMember () const
ArrayRef< const CXXRecordDecl * > | getMemberPointerPath () const
const AddrLabelExpr * | getAddrLabelDiffLHS () const
const AddrLabelExpr * | getAddrLabelDiffRHS () const
void | setInt (APSInt I)
void | setFloat (APFloat F)
void | setFixedPoint (APFixedPoint FX)
void | setVector (const APValue *E, unsigned N)
void | setComplexInt (APSInt R, APSInt I)
void | setComplexFloat (APFloat R, APFloat I)
void | setLValue (LValueBase B, const CharUnits &O, NoLValuePath, bool IsNullPtr)
void | setLValue (LValueBase B, const CharUnits &O, ArrayRef< LValuePathEntry > Path, bool OnePastTheEnd, bool IsNullPtr)
void | setUnion (const FieldDecl *Field, const APValue &Value)
void | setAddrLabelDiff (const AddrLabelExpr *LHSExpr, const AddrLabelExpr *RHSExpr)
APValue & | operator= (APValue RHS)
| Assign by swapping from a copy of the RHS. More...

## Static Public Member Functions
static APValue | IndeterminateValue ()

## Friends
class | ASTReader
class | ASTWriter

## Detailed Description

APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat], [Complex APSInt] [Complex APFloat], [Expr + Offset], [Vector: N * APValue], [Array: N * APValue].

Definition at line 115 of file APValue.h.

## Member Typedef Documentation

## ◆ BaseOrMemberType

typedef llvm::PointerIntPair<const Decl *, 1, bool> clang::APValue::BaseOrMemberType

A FieldDecl or CXXRecordDecl, along with a flag indicating whether we mean a virtual or non-virtual base class subobject.

Definition at line 192 of file APValue.h.

## Member Enumeration Documentation

## ◆ ValueKind

enum clang::APValue::ValueKind

Enumerator
None | There is no such object (it's outside its lifetime).
Indeterminate | This object has an indeterminate value (C++ [basic.indet]).
Int |
Float |
FixedPoint |
ComplexInt |
ComplexFloat |
LValue |
Vector |
Array |
Struct |
Union |
MemberPointer |
AddrLabelDiff |

Definition at line 119 of file APValue.h.

## Constructor & Destructor Documentation

## ◆ APValue() [1/16]

clang::APValue::APValue | ( |  | ) |
| inline

Definition at line 285 of file APValue.h.

## ◆ APValue() [2/16]

clang::APValue::APValue | ( | APSInt | I | ) |
| inline explicit

Definition at line 286 of file APValue.h.

## ◆ APValue() [3/16]

clang::APValue::APValue | ( | APFloat | F | ) |
| inline explicit

Definition at line 289 of file APValue.h.

## ◆ APValue() [4/16]

clang::APValue::APValue | ( | APFixedPoint | FX | ) |
| inline explicit

Definition at line 292 of file APValue.h.

## ◆ APValue() [5/16]

clang::APValue::APValue | ( | const APValue * | E,
|  | unsigned | N
| ) |  |
| inline explicit

Definition at line 295 of file APValue.h.

## ◆ APValue() [6/16]

clang::APValue::APValue | ( | APSInt | R,
|  | APSInt | I
| ) |  |
| inline

Definition at line 298 of file APValue.h.

## ◆ APValue() [7/16]

clang::APValue::APValue | ( | APFloat | R,
|  | APFloat | I
| ) |  |
| inline

Definition at line 301 of file APValue.h.

## ◆ APValue() [8/16]

APValue::APValue | ( | const APValue & | RHS | ) |

Definition at line 236 of file APValue.cpp.

References AddrLabelDiff, Array, ComplexFloat, ComplexInt, FixedPoint, Float, getAddrLabelDiffLHS(), getAddrLabelDiffRHS(), getArrayFiller(), getArrayInitializedElt(), getArrayInitializedElts(), getArraySize(), getComplexFloatImag(), getComplexFloatReal(), getComplexIntImag(), getComplexIntReal(), getFixedPoint(), getFloat(), getInt(), getKind(), getLValueBase(), getLValueOffset(), getLValuePath(), getMemberPointerDecl(), getMemberPointerPath(), getStructBase(), getStructField(), getStructNumBases(), getStructNumFields(), getUnionField(), getUnionValue(), getVectorLength(), hasArrayFiller(), hasLValuePath(), Indeterminate, Int, isLValueOnePastTheEnd(), isMemberPointerToDerivedMember(), isNullPointer(), LValue, MemberPointer, None, setAddrLabelDiff(), setComplexFloat(), setComplexInt(), setFloat(), setInt(), setLValue(), setUnion(), setVector(), Struct, Union, and Vector.

## ◆ APValue() [9/16]

clang::APValue::APValue | ( | APValue && | RHS | ) |
| inline

Definition at line 305 of file APValue.h.

## ◆ APValue() [10/16]

clang::APValue::APValue | ( | LValueBase | B,
|  | const CharUnits & | O,
|  | NoLValuePath | N,
|  | bool | IsNullPtr = `false`
| ) |  |
| inline

Definition at line 306 of file APValue.h.

## ◆ APValue() [11/16]

clang::APValue::APValue | ( | LValueBase | B,
|  | const CharUnits & | O,
|  | ArrayRef< LValuePathEntry > | Path,
|  | bool | OnePastTheEnd,
|  | bool | IsNullPtr = `false`
| ) |  |
| inline

Definition at line 311 of file APValue.h.

## ◆ APValue() [12/16]

clang::APValue::APValue | ( | UninitArray | ,
|  | unsigned | InitElts,
|  | unsigned | Size
| ) |  |
| inline

Definition at line 316 of file APValue.h.

## ◆ APValue() [13/16]

clang::APValue::APValue | ( | UninitStruct | ,
|  | unsigned | B,
|  | unsigned | M
| ) |  |
| inline

Definition at line 319 of file APValue.h.

## ◆ APValue() [14/16]

clang::APValue::APValue | ( | const FieldDecl * | D,
|  | const APValue & | V = `APValue()`
| ) |  |
| inline explicit

Definition at line 322 of file APValue.h.

References V.

## ◆ APValue() [15/16]

clang::APValue::APValue | ( | const ValueDecl * | Member,
|  | bool | IsDerivedMember,
|  | ArrayRef< const CXXRecordDecl *> | Path
| ) |  |
| inline

Definition at line 326 of file APValue.h.

## ◆ APValue() [16/16]

clang::APValue::APValue | ( | const AddrLabelExpr * | LHSExpr,
|  | const AddrLabelExpr * | RHSExpr
| ) |  |
| inline

Definition at line 330 of file APValue.h.

## ◆ ~APValue()

clang::APValue::~APValue | ( |  | ) |
| inline

Definition at line 340 of file APValue.h.

References clang::None.

## Member Function Documentation

## ◆ dump() [1/2]

LLVM_DUMP_METHOD void APValue::dump | ( |  | ) | const

Definition at line 381 of file APValue.cpp.

Referenced by dump(), and clang::TextNodeDumper::VisitConstantExpr().

## ◆ dump() [2/2]

void APValue::dump | ( | raw_ostream & | OS | ) | const

Definition at line 394 of file APValue.cpp.

References AddrLabelDiff, Array, ComplexFloat, ComplexInt, dump(), FixedPoint, Float, GetApproxValue(), getArrayFiller(), getArrayInitializedElt(), getArrayInitializedElts(), getArraySize(), getComplexFloatImag(), getComplexFloatReal(), getComplexIntImag(), getComplexIntReal(), getFixedPoint(), getFloat(), getInt(), getKind(), getStructBase(), getStructField(), getStructNumBases(), getStructNumFields(), getUnionValue(), getVectorElt(), getVectorLength(), hasArrayFiller(), Indeterminate, Int, LValue, MemberPointer, None, Struct, Union, and Vector.

## ◆ getAddrLabelDiffLHS()

const AddrLabelExpr* clang::APValue::getAddrLabelDiffLHS | ( |  | ) | const
| inline

Definition at line 534 of file APValue.h.

Referenced by APValue(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getAddrLabelDiffRHS()

const AddrLabelExpr* clang::APValue::getAddrLabelDiffRHS | ( |  | ) | const
| inline

Definition at line 538 of file APValue.h.

Referenced by APValue(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getArrayFiller() [1/2]

APValue& clang::APValue::getArrayFiller | ( |  | ) |
| inline

Definition at line 478 of file APValue.h.

Referenced by APValue(), CheckEvaluationResult(), dump(), EvaluateVector(), MaybeElementDependentArrayFiller(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getArrayFiller() [2/2]

const APValue& clang::APValue::getArrayFiller | ( |  | ) | const
| inline

Definition at line 483 of file APValue.h.

## ◆ getArrayInitializedElt() [1/2]

APValue& clang::APValue::getArrayInitializedElt | ( | unsigned | I | ) |
| inline

Definition at line 467 of file APValue.h.

Referenced by APValue(), CheckEvaluationResult(), dump(), clang::interp::EvalEmitter::fallthrough(), HandleDestructionImpl(), MaybeElementDependentArrayFiller(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getArrayInitializedElt() [2/2]

const APValue& clang::APValue::getArrayInitializedElt | ( | unsigned | I | ) | const
| inline

Definition at line 472 of file APValue.h.

## ◆ getArrayInitializedElts()

unsigned clang::APValue::getArrayInitializedElts | ( |  | ) | const
| inline

Definition at line 486 of file APValue.h.

Referenced by APValue(), CheckEvaluationResult(), dump(), HandleDestructionImpl(), MaybeElementDependentArrayFiller(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getArraySize()

unsigned clang::APValue::getArraySize | ( |  | ) | const
| inline

Definition at line 490 of file APValue.h.

Referenced by APValue(), dump(), HandleDestructionImpl(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getAsString()

std::string APValue::getAsString | ( | const ASTContext & | Ctx,
|  | QualType | Ty
| ) |  | const

Definition at line 705 of file APValue.cpp.

References printPretty(), and clang::Result.

Referenced by CheckConvertedConstantExpression(), checkDynamicType(), DiagnoseNarrowingInInitList(), getAlignmentArgument(), and HandleDestructionImpl().

## ◆ getComplexFloatImag() [1/2]

APFloat& clang::APValue::getComplexFloatImag | ( |  | ) |
| inline

Definition at line 434 of file APValue.h.

Referenced by clang::ASTRecordWriter::AddAPValue(), APValue(), dump(), HandleConversionToBool(), isFormalAccess(), IsSameFloatAfterCast(), needsCleanup(), printPretty(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getComplexFloatImag() [2/2]

const APFloat& clang::APValue::getComplexFloatImag | ( |  | ) | const
| inline

Definition at line 438 of file APValue.h.

## ◆ getComplexFloatReal() [1/2]

APFloat& clang::APValue::getComplexFloatReal | ( |  | ) |
| inline

Definition at line 426 of file APValue.h.

Referenced by clang::ASTRecordWriter::AddAPValue(), APValue(), dump(), handleCompoundAssignment(), HandleConversionToBool(), isFormalAccess(), IsSameFloatAfterCast(), needsCleanup(), printPretty(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getComplexFloatReal() [2/2]

const APFloat& clang::APValue::getComplexFloatReal | ( |  | ) | const
| inline

Definition at line 430 of file APValue.h.

## ◆ getComplexIntImag() [1/2]

APSInt& clang::APValue::getComplexIntImag | ( |  | ) |
| inline

Definition at line 418 of file APValue.h.

Referenced by clang::ASTRecordWriter::AddAPValue(), APValue(), dump(), GetValueRange(), HandleConversionToBool(), isFormalAccess(), needsCleanup(), printPretty(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getComplexIntImag() [2/2]

const APSInt& clang::APValue::getComplexIntImag | ( |  | ) | const
| inline

Definition at line 422 of file APValue.h.

## ◆ getComplexIntReal() [1/2]

APSInt& clang::APValue::getComplexIntReal | ( |  | ) |
| inline

Definition at line 410 of file APValue.h.

Referenced by clang::ASTRecordWriter::AddAPValue(), APValue(), dump(), GetValueRange(), handleCompoundAssignment(), HandleConversionToBool(), isFormalAccess(), needsCleanup(), printPretty(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getComplexIntReal() [2/2]

const APSInt& clang::APValue::getComplexIntReal | ( |  | ) | const
| inline

Definition at line 414 of file APValue.h.

## ◆ getFixedPoint() [1/2]

APFixedPoint& clang::APValue::getFixedPoint | ( |  | ) |
| inline

Definition at line 402 of file APValue.h.

Referenced by clang::ASTRecordWriter::AddAPValue(), APValue(), CheckImplicitConversion(), dump(), EvaluateComparisonBinaryOperator(), EvaluateFixedPoint(), HandleConversionToBool(), needsCleanup(), printPretty(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getFixedPoint() [2/2]

const APFixedPoint& clang::APValue::getFixedPoint | ( |  | ) | const
| inline

Definition at line 406 of file APValue.h.

## ◆ getFloat() [1/2]

APFloat& clang::APValue::getFloat | ( |  | ) |
| inline

Definition at line 394 of file APValue.h.

Referenced by clang::ASTRecordWriter::AddAPValue(), APValue(), dump(), clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), EvalAndBitcastToAPInt(), EvaluateComparisonBinaryOperator(), extractSubobject(), clang::StandardConversionSequence::getNarrowingKind(), handleAssignment(), handleCompoundAssignment(), HandleConversionToBool(), IsSameFloatAfterCast(), needsCleanup(), printPretty(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getFloat() [2/2]

const APFloat& clang::APValue::getFloat | ( |  | ) | const
| inline

Definition at line 398 of file APValue.h.

## ◆ getInt() [1/2]

APSInt& clang::APValue::getInt | ( |  | ) |
| inline

Definition at line 380 of file APValue.h.

Referenced by clang::ASTRecordWriter::AddAPValue(), AddVariableConstraints(), AnalyzeBitFieldAssignment(), APValue(), canConvertIntToOtherIntTy(), canConvertIntTyToFloatTy(), checkArrayExpressionDoesNotReferToUnitySize(), checkArrayExpressionDoesNotReferToWholeSize(), checkFormatStringExpr(), CheckImplicitConversion(), checkMapClauseExpressionBase(), checkOpenMPLoop(), checkSimdlenSafelenSpecified(), clang::CodeGen::CodeGenFunction::ConstantFoldsToSimpleInteger(), DiagnoseBadDivideOrRemainderValues(), DiagnoseBadFunctionCast(), DiagnoseBadShiftValues(), DiagnoseIntInBoolContext(), dump(), clang::CodeGen::CodeGenFunction::EmitARMBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), clang::CodeGen::emitDeclareSimdFunction(), EvalAndBitcastToAPInt(), EvaluateCPlusPlus11IntegralConstantExpr(), EvaluateInteger(), EvaluatePointer(), extractSubobject(), getAlignmentArgument(), getBuiltinAlignArguments(), getBytesReturnedByAllocSizeCall(), clang::ento::SValBuilder::getConstantVal(), clang::ComparisonCategoryInfo::ValueInfo::getIntValue(), clang::ConstantExpr::getStorageKind(), GetValueRange(), handleAssignment(), handleCompoundAssignment(), HandleConversionToBool(), hasDefaultSetterName(), isInLoop(), needsCleanup(), printPretty(), shouldAddCase(), toIntegralConstant(), truncateBitfieldValue(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getInt() [2/2]

const APSInt& clang::APValue::getInt | ( |  | ) | const
| inline

Definition at line 384 of file APValue.h.

References clang::Result.

## ◆ getKind()

ValueKind clang::APValue::getKind | ( |  | ) | const
| inline

Definition at line 355 of file APValue.h.

Referenced by clang::ASTRecordWriter::AddAPValue(), APValue(), dump(), EvaluateBuiltinConstantP(), clang::ConstantExpr::getStorageKind(), handleAssignment(), handleCompoundAssignment(), HandleConversionToBool(), needsCleanup(), printPretty(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getLValueBase()

const APValue::LValueBase APValue::getLValueBase | ( |  | ) | const

Definition at line 733 of file APValue.cpp.

References isLValue().

Referenced by APValue(), EvalPointerValueAsBool(), EvaluateBuiltinConstantPForLValue(), isNullPointerValueTemplateArgument(), printPretty(), and toIntegralConstant().

## ◆ getLValueCallIndex()

unsigned APValue::getLValueCallIndex | ( |  | ) | const

Definition at line 759 of file APValue.cpp.

References isLValue().

## ◆ getLValueOffset() [1/2]

CharUnits & APValue::getLValueOffset | ( |  | ) |

Definition at line 743 of file APValue.cpp.

References isLValue().

Referenced by APValue(), EvalPointerValueAsBool(), EvaluateBuiltinConstantPForLValue(), printPretty(), and toIntegralConstant().

## ◆ getLValueOffset() [2/2]

const CharUnits& clang::APValue::getLValueOffset | ( |  | ) | const
| inline

Definition at line 444 of file APValue.h.

## ◆ getLValuePath()

ArrayRef< APValue::LValuePathEntry > APValue::getLValuePath | ( |  | ) | const

Definition at line 753 of file APValue.cpp.

References clang::APValue::LV::getPath(), hasLValuePath(), and isLValue().

Referenced by APValue().

## ◆ getLValueVersion()

unsigned APValue::getLValueVersion | ( |  | ) | const

Definition at line 764 of file APValue.cpp.

References isLValue().

## ◆ getMemberPointerDecl()

const ValueDecl * APValue::getMemberPointerDecl | ( |  | ) | const

Definition at line 798 of file APValue.cpp.

References isMemberPointer().

Referenced by APValue(), CheckMemberPointerConstantExpression(), clang::CodeGen::CGCXXABI::getMemberPointerPathAdjustment(), HandleConversionToBool(), and isNullPointerValueTemplateArgument().

## ◆ getMemberPointerPath()

ArrayRef< const CXXRecordDecl * > APValue::getMemberPointerPath | ( |  | ) | const

Definition at line 812 of file APValue.cpp.

References Array, clang::APValue::MemberPointerData::getPath(), isAbsent(), isMemberPointer(), LValue, MemberPointer, memcpy(), and clang::APValue::MemberPointerData::resizePath().

Referenced by APValue(), and clang::CodeGen::CGCXXABI::getMemberPointerPathAdjustment().

## ◆ getStructBase() [1/2]

APValue& clang::APValue::getStructBase | ( | unsigned | i | ) |
| inline

Definition at line 503 of file APValue.h.

Referenced by APValue(), CheckEvaluationResult(), dump(), HandleConstructorCall(), and HandleDestructionImpl().

## ◆ getStructBase() [2/2]

const APValue& clang::APValue::getStructBase | ( | unsigned | i | ) | const
| inline

Definition at line 511 of file APValue.h.

## ◆ getStructField() [1/2]

APValue& clang::APValue::getStructField | ( | unsigned | i | ) |
| inline

Definition at line 507 of file APValue.h.

Referenced by APValue(), CheckEvaluationResult(), dump(), clang::interp::EvalEmitter::fallthrough(), clang::ComparisonCategoryInfo::ValueInfo::getIntValue(), HandleConstructorCall(), and HandleDestructionImpl().

## ◆ getStructField() [2/2]

const APValue& clang::APValue::getStructField | ( | unsigned | i | ) | const
| inline

Definition at line 514 of file APValue.h.

## ◆ getStructNumBases()

unsigned clang::APValue::getStructNumBases | ( |  | ) | const
| inline

Definition at line 495 of file APValue.h.

Referenced by APValue(), and dump().

## ◆ getStructNumFields()

unsigned clang::APValue::getStructNumFields | ( |  | ) | const
| inline

Definition at line 499 of file APValue.h.

Referenced by APValue(), and dump().

## ◆ getUnionField()

const FieldDecl* clang::APValue::getUnionField | ( |  | ) | const
| inline

Definition at line 518 of file APValue.h.

Referenced by APValue(), CheckEvaluationResult(), and HandleConstructorCall().

## ◆ getUnionValue() [1/2]

APValue& clang::APValue::getUnionValue | ( |  | ) |
| inline

Definition at line 522 of file APValue.h.

Referenced by APValue(), CheckEvaluationResult(), dump(), and HandleConstructorCall().

## ◆ getUnionValue() [2/2]

const APValue& clang::APValue::getUnionValue | ( |  | ) | const
| inline

Definition at line 526 of file APValue.h.

## ◆ getVectorElt() [1/2]

APValue& clang::APValue::getVectorElt | ( | unsigned | I | ) |
| inline

Definition at line 454 of file APValue.h.

References isVector().

Referenced by dump(), EvalAndBitcastToAPInt(), EvaluateVector(), GetValueRange(), IsSameFloatAfterCast(), printPretty(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ getVectorElt() [2/2]

const APValue& clang::APValue::getVectorElt | ( | unsigned | I | ) | const
| inline

Definition at line 459 of file APValue.h.

## ◆ getVectorLength()

unsigned clang::APValue::getVectorLength | ( |  | ) | const
| inline

Definition at line 462 of file APValue.h.

References isVector().

Referenced by APValue(), dump(), EvalAndBitcastToAPInt(), EvaluateVector(), GetValueRange(), IsSameFloatAfterCast(), printPretty(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ hasArrayFiller()

bool clang::APValue::hasArrayFiller | ( |  | ) | const
| inline

Definition at line 475 of file APValue.h.

Referenced by APValue(), CheckEvaluationResult(), dump(), EvaluateVector(), MaybeElementDependentArrayFiller(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ hasLValuePath()

bool APValue::hasLValuePath | ( |  | ) | const

Definition at line 748 of file APValue.cpp.

References isLValue().

Referenced by APValue(), getLValuePath(), and printPretty().

## ◆ hasValue()

bool clang::APValue::hasValue | ( |  | ) | const
| inline

Definition at line 359 of file APValue.h.

References clang::None.

Referenced by CheckEvaluationResult(), clang::CodeGen::CodeGenFunction::EmitDeclRefExprDbgValue(), EvaluateBuiltinConstantP(), EvaluateLValue(), getBuiltinAlignArguments(), HandleConstructorCall(), and MaybeElementDependentArrayFiller().

## ◆ IndeterminateValue()

static APValue clang::APValue::IndeterminateValue | ( |  | ) |
| inline static

Definition at line 334 of file APValue.h.

References clang::Result.

Referenced by clang::ASTRecordReader::readAPValue().

## ◆ isAbsent()

bool clang::APValue::isAbsent | ( |  | ) | const
| inline

Definition at line 357 of file APValue.h.

References clang::None.

Referenced by clang::VarDecl::evaluateValue(), findSubobject(), getMemberPointerPath(), and HandleDestructionImpl().

## ◆ isAddrLabelDiff()

bool clang::APValue::isAddrLabelDiff | ( |  | ) | const
| inline

Definition at line 372 of file APValue.h.

References dump(), and clang::getAsString().

Referenced by GetValueRange().

## ◆ isArray()

bool clang::APValue::isArray | ( |  | ) | const
| inline

Definition at line 368 of file APValue.h.

Referenced by CheckEvaluationResult(), EvaluateVector(), and MaybeElementDependentArrayFiller().

## ◆ isComplexFloat()

bool clang::APValue::isComplexFloat | ( |  | ) | const
| inline

Definition at line 365 of file APValue.h.

Referenced by isFormalAccess(), and IsSameFloatAfterCast().

## ◆ isComplexInt()

bool clang::APValue::isComplexInt | ( |  | ) | const
| inline

Definition at line 364 of file APValue.h.

Referenced by GetValueRange(), and isFormalAccess().

## ◆ isFixedPoint()

bool clang::APValue::isFixedPoint | ( |  | ) | const
| inline

Definition at line 363 of file APValue.h.

Referenced by EvaluateAsFixedPoint(), and EvaluateFixedPoint().

## ◆ isFloat()

bool clang::APValue::isFloat | ( |  | ) | const
| inline

Definition at line 362 of file APValue.h.

Referenced by clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), EvalAndBitcastToAPInt(), clang::StandardConversionSequence::getNarrowingKind(), handleAssignment(), IsSameFloatAfterCast(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ isIndeterminate()

bool clang::APValue::isIndeterminate | ( |  | ) | const
| inline

Definition at line 358 of file APValue.h.

Referenced by findSubobject().

## ◆ isInt()

bool clang::APValue::isInt | ( |  | ) | const
| inline

Definition at line 361 of file APValue.h.

Referenced by CheckConvertedConstantExpression(), clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), EvalAndBitcastToAPInt(), EvaluateAsInt(), EvaluateCPlusPlus11IntegralConstantExpr(), EvaluateInteger(), EvaluatePointer(), extractSubobject(), getAlignmentArgument(), getBuiltinAlignArguments(), GetValueRange(), handleAssignment(), shouldAddCase(), toIntegralConstant(), truncateBitfieldValue(), and clang::CodeGen::ConstantEmitter::tryEmitPrivate().

## ◆ isLValue()

bool clang::APValue::isLValue | ( |  | ) | const
| inline

Definition at line 366 of file APValue.h.

Referenced by CheckEvaluationResult(), getBuiltinAlignArguments(), getLValueBase(), getLValueCallIndex(), getLValueOffset(), getLValuePath(), getLValueVersion(), GetValueRange(), HandleCovariantReturnAdjustment(), hasLValuePath(), isLValueOnePastTheEnd(), isNullPointer(), isNullPointerValueTemplateArgument(), setLValue(), toIntegralConstant(), and truncateBitfieldValue().

## ◆ isLValueOnePastTheEnd()

bool APValue::isLValueOnePastTheEnd | ( |  | ) | const

Definition at line 738 of file APValue.cpp.

References isLValue().

Referenced by APValue().

## ◆ isMemberPointer()

bool clang::APValue::isMemberPointer | ( |  | ) | const
| inline

Definition at line 371 of file APValue.h.

Referenced by CheckEvaluationResult(), getMemberPointerDecl(), getMemberPointerPath(), isMemberPointerToDerivedMember(), and isNullPointerValueTemplateArgument().

## ◆ isMemberPointerToDerivedMember()

bool APValue::isMemberPointerToDerivedMember | ( |  | ) | const

Definition at line 805 of file APValue.cpp.

References isMemberPointer().

Referenced by APValue(), and clang::CodeGen::CGCXXABI::getMemberPointerPathAdjustment().

## ◆ isNullPointer()

bool APValue::isNullPointer | ( |  | ) | const

Definition at line 769 of file APValue.cpp.

References isLValue().

Referenced by APValue(), HandleCovariantReturnAdjustment(), printPretty(), clang::CodeGen::CodeGenFunction::ShouldNullCheckClassCastValue(), and toIntegralConstant().

## ◆ isStruct()

bool clang::APValue::isStruct | ( |  | ) | const
| inline

Definition at line 369 of file APValue.h.

Referenced by CheckEvaluationResult().

## ◆ isUnion()

bool clang::APValue::isUnion | ( |  | ) | const
| inline

Definition at line 370 of file APValue.h.

References Union.

Referenced by CheckEvaluationResult(), HandleConstructorCall(), and HandleFunctionCall().

## ◆ isVector()

bool clang::APValue::isVector | ( |  | ) | const
| inline

Definition at line 367 of file APValue.h.

Referenced by EvalAndBitcastToAPInt(), EvaluateTemporary(), GetValueRange(), and IsSameFloatAfterCast().

## ◆ needsCleanup()

bool APValue::needsCleanup | ( |  | ) | const

Returns whether the object performed allocations.

If APValues are constructed via placement new, `needsCleanup()` indicates whether the destructor must be called in order to correctly free all allocated memory.

Definition at line 335 of file APValue.cpp.

References AddrLabelDiff, Array, ComplexFloat, ComplexInt, FixedPoint, Float, getComplexFloatImag(), getComplexFloatReal(), getComplexIntImag(), getComplexIntReal(), getFixedPoint(), getFloat(), getInt(), getKind(), clang::APFixedPoint::getValue(), Indeterminate, Int, LValue, MemberPointer, None, Struct, Union, and Vector.

Referenced by clang::VarDecl::evaluateValue().

## ◆ operator=()

APValue& clang::APValue::operator= | ( | APValue | RHS | ) |
| inline

Assign by swapping from a copy of the RHS.

Definition at line 593 of file APValue.h.

References Union.

## ◆ printPretty()

void APValue::printPretty | ( | raw_ostream & | OS,
|  | const ASTContext & | Ctx,
|  | QualType | Ty
| ) |  | const

Definition at line 473 of file APValue.cpp.

References clang::Type::castAs(), ComplexFloat, ComplexInt, FixedPoint, Float, GetApproxValue(), getComplexFloatImag(), getComplexFloatReal(), getComplexIntImag(), getComplexIntReal(), getFixedPoint(), getFloat(), getInt(), getKind(), clang::ASTContext::getLangOpts(), getLValueBase(), getLValueOffset(), clang::QualType::getNonReferenceType(), clang::Type::getPointeeType(), clang::ASTContext::getPrintingPolicy(), clang::CharUnits::getQuantity(), getVectorElt(), getVectorLength(), hasLValuePath(), Indeterminate, Int, clang::Type::isBooleanType(), clang::QualType::isNull(), isNullPointer(), clang::Type::isReferenceType(), LValue, None, printPretty(), clang::QualType::stream(), and Vector.

Referenced by getAsString(), printPretty(), and clang::JSONNodeDumper::VisitConstantExpr().

## ◆ setAddrLabelDiff()

void clang::APValue::setAddrLabelDiff | ( | const AddrLabelExpr * | LHSExpr,
|  | const AddrLabelExpr * | RHSExpr
| ) |  |
| inline

Definition at line 586 of file APValue.h.

Referenced by APValue().

## ◆ setComplexFloat()

void clang::APValue::setComplexFloat | ( | APFloat | R,
|  | APFloat | I
| ) |  |
| inline

Definition at line 569 of file APValue.h.

Referenced by APValue().

## ◆ setComplexInt()

void clang::APValue::setComplexInt | ( | APSInt | R,
|  | APSInt | I
| ) |  |
| inline

Definition at line 562 of file APValue.h.

Referenced by APValue().

## ◆ setFixedPoint()

void clang::APValue::setFixedPoint | ( | APFixedPoint | FX | ) |
| inline

Definition at line 551 of file APValue.h.

## ◆ setFloat()

void clang::APValue::setFloat | ( | APFloat | F | ) |
| inline

Definition at line 547 of file APValue.h.

Referenced by APValue().

## ◆ setInt()

void clang::APValue::setInt | ( | APSInt | I | ) |
| inline

Definition at line 543 of file APValue.h.

Referenced by APValue().

## ◆ setLValue() [1/2]

void APValue::setLValue | ( | LValueBase | B,
|  | const CharUnits & | O,
|  | NoLValuePath | ,
|  | bool | IsNullPtr
| ) |  |

Definition at line 774 of file APValue.cpp.

References isLValue(), and clang::APValue::LV::resizePath().

Referenced by APValue().

## ◆ setLValue() [2/2]

void APValue::setLValue | ( | LValueBase | B,
|  | const CharUnits & | O,
|  | ArrayRef< LValuePathEntry > | Path,
|  | bool | OnePastTheEnd,
|  | bool | IsNullPtr
| ) |  |

Definition at line 785 of file APValue.cpp.

References clang::APValue::LV::getPath(), isLValue(), memcpy(), and clang::APValue::LV::resizePath().

## ◆ setUnion()

void clang::APValue::setUnion | ( | const FieldDecl * | Field,
|  | const APValue & | Value
| ) |  |
| inline

Definition at line 581 of file APValue.h.

Referenced by APValue().

## ◆ setVector()

void clang::APValue::setVector | ( | const APValue * | E,
|  | unsigned | N
| ) |  |
| inline

Definition at line 555 of file APValue.h.

References isVector().

Referenced by APValue().

## ◆ swap()

void APValue::swap | ( | APValue & | RHS | ) |

Swaps the contents of this and the given APValue.

Definition at line 373 of file APValue.cpp.

References memcpy().

Referenced by extractSubobject(), and isOnePastTheEndOfCompleteObject().

## ◆ toIntegralConstant()

bool APValue::toIntegralConstant | ( | APSInt & | Result,
|  | QualType | SrcTy,
|  | const ASTContext & | Ctx
| ) |  | const

Try to convert this value to an integral constant.

This works if it's an integer, null pointer, or offset from a null pointer. Returns true on success.

Definition at line 713 of file APValue.cpp.

References getInt(), getLValueBase(), getLValueOffset(), clang::ASTContext::getTargetNullPointerValue(), isInt(), isLValue(), isNullPointer(), and clang::ASTContext::MakeIntValue().

Referenced by AddVariableConstraints(), and EvaluateComparisonBinaryOperator().

## Friends And Related Function Documentation

## ◆ ASTReader

friend class ASTReader
| friend

Definition at line 230 of file APValue.h.

## ◆ ASTWriter

friend class ASTWriter
| friend

Definition at line 231 of file APValue.h.

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

- include/clang/AST/APValue.h
- lib/AST/APValue.cpp