clang API Documentation

Classes | Public Types | Public Member Functions
clang::APValue Class Reference

#include <APValue.h>

List of all members.

Classes

struct  AddrLabelDiffData
struct  Arr
struct  ComplexAPFloat
struct  ComplexAPSInt
struct  LV
union  LValuePathEntry
struct  MemberPointerData
struct  NoLValuePath
struct  StructData
struct  UninitArray
struct  UninitStruct
struct  UnionData
struct  Vec

Public Types

enum  ValueKind {
  Uninitialized, Int, Float, ComplexInt,
  ComplexFloat, LValue, Vector, Array,
  Struct, Union, MemberPointer, AddrLabelDiff
}
typedef llvm::PointerUnion
< const ValueDecl *, const
Expr * > 
LValueBase
typedef llvm::PointerIntPair
< const Decl *, 1, bool
BaseOrMemberType

Public Member Functions

 APValue ()
 APValue (APSInt I)
 APValue (APFloat F)
 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, unsigned CallIndex)
 APValue (LValueBase B, const CharUnits &O, ArrayRef< LValuePathEntry > Path, bool OnePastTheEnd, unsigned CallIndex)
 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.
void swap (APValue &RHS)
 Swaps the contents of this and the given APValue.
ValueKind getKind () const
bool isUninit () const
bool isInt () const
bool isFloat () 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, ASTContext &Ctx, QualType Ty) const
std::string getAsString (ASTContext &Ctx, QualType Ty) const
APSInt & getInt ()
const APSInt & getInt () const
APFloat & getFloat ()
const APFloat & getFloat () 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
CharUnitsgetLValueOffset ()
const CharUnitsgetLValueOffset () const
bool isLValueOnePastTheEnd () const
bool hasLValuePath () const
ArrayRef< LValuePathEntrygetLValuePath () const
unsigned getLValueCallIndex () const
APValuegetVectorElt (unsigned I)
const APValuegetVectorElt (unsigned I) const
unsigned getVectorLength () const
APValuegetArrayInitializedElt (unsigned I)
const APValuegetArrayInitializedElt (unsigned I) const
bool hasArrayFiller () const
APValuegetArrayFiller ()
const APValuegetArrayFiller () const
unsigned getArrayInitializedElts () const
unsigned getArraySize () const
unsigned getStructNumBases () const
unsigned getStructNumFields () const
APValuegetStructBase (unsigned i)
APValuegetStructField (unsigned i)
const APValuegetStructBase (unsigned i) const
const APValuegetStructField (unsigned i) const
const FieldDeclgetUnionField () const
APValuegetUnionValue ()
const APValuegetUnionValue () const
const ValueDeclgetMemberPointerDecl () const
bool isMemberPointerToDerivedMember () const
ArrayRef< const CXXRecordDecl * > getMemberPointerPath () const
const AddrLabelExprgetAddrLabelDiffLHS () const
const AddrLabelExprgetAddrLabelDiffRHS () const
void setInt (APSInt I)
void setFloat (APFloat F)
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, unsigned CallIndex)
void setLValue (LValueBase B, const CharUnits &O, ArrayRef< LValuePathEntry > Path, bool OnePastTheEnd, unsigned CallIndex)
void setUnion (const FieldDecl *Field, const APValue &Value)
void setAddrLabelDiff (const AddrLabelExpr *LHSExpr, const AddrLabelExpr *RHSExpr)
APValueoperator= (APValue RHS)
 Assign by swapping from a copy of the RHS.

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 38 of file APValue.h.


Member Typedef Documentation

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

Definition at line 57 of file APValue.h.

typedef llvm::PointerUnion<const ValueDecl *, const Expr *> clang::APValue::LValueBase

Definition at line 56 of file APValue.h.


Member Enumeration Documentation

Enumerator:
Uninitialized 
Int 
Float 
ComplexInt 
ComplexFloat 
LValue 
Vector 
Array 
Struct 
Union 
MemberPointer 
AddrLabelDiff 

Definition at line 42 of file APValue.h.


Constructor & Destructor Documentation

Definition at line 120 of file APValue.h.

clang::APValue::APValue ( APSInt  I) [inline, explicit]

Definition at line 121 of file APValue.h.

References setInt().

clang::APValue::APValue ( APFloat  F) [inline, explicit]

Definition at line 124 of file APValue.h.

References setFloat().

clang::APValue::APValue ( const APValue E,
unsigned  N 
) [inline, explicit]

Definition at line 127 of file APValue.h.

References setVector().

clang::APValue::APValue ( APSInt  R,
APSInt  I 
) [inline]

Definition at line 130 of file APValue.h.

References setComplexInt().

clang::APValue::APValue ( APFloat  R,
APFloat  I 
) [inline]

Definition at line 133 of file APValue.h.

References setComplexFloat().

APValue::APValue ( const APValue RHS)
clang::APValue::APValue ( APValue &&  RHS) [inline]

Definition at line 137 of file APValue.h.

References swap().

clang::APValue::APValue ( LValueBase  B,
const CharUnits O,
NoLValuePath  N,
unsigned  CallIndex 
) [inline]

Definition at line 138 of file APValue.h.

References setLValue().

clang::APValue::APValue ( LValueBase  B,
const CharUnits O,
ArrayRef< LValuePathEntry Path,
bool  OnePastTheEnd,
unsigned  CallIndex 
) [inline]

Definition at line 142 of file APValue.h.

References setLValue().

clang::APValue::APValue ( UninitArray  ,
unsigned  InitElts,
unsigned  Size 
) [inline]

Definition at line 147 of file APValue.h.

Definition at line 150 of file APValue.h.

clang::APValue::APValue ( const FieldDecl D,
const APValue V = APValue() 
) [inline, explicit]

Definition at line 153 of file APValue.h.

References setUnion().

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

Definition at line 157 of file APValue.h.

clang::APValue::APValue ( const AddrLabelExpr LHSExpr,
const AddrLabelExpr RHSExpr 
) [inline]

Definition at line 161 of file APValue.h.

References setAddrLabelDiff().

Definition at line 166 of file APValue.h.


Member Function Documentation

void APValue::dump ( ) const

Definition at line 258 of file APValue.cpp.

Referenced by dump().

void APValue::dump ( raw_ostream &  OS) const

Definition at line 338 of file APValue.h.

References isAddrLabelDiff().

Referenced by APValue(), clang::CodeGen::CodeGenModule::EmitConstantValue(), and printPretty().

Definition at line 342 of file APValue.h.

References isAddrLabelDiff().

Referenced by APValue(), clang::CodeGen::CodeGenModule::EmitConstantValue(), and printPretty().

const APValue& clang::APValue::getArrayFiller ( ) const [inline]

Definition at line 287 of file APValue.h.

References getArrayFiller().

Definition at line 276 of file APValue.h.

References getArrayInitializedElt().

std::string APValue::getAsString ( ASTContext Ctx,
QualType  Ty 
) const
APFloat& clang::APValue::getComplexFloatImag ( ) [inline]
const APFloat& clang::APValue::getComplexFloatImag ( ) const [inline]

Definition at line 244 of file APValue.h.

References getComplexFloatImag().

APFloat& clang::APValue::getComplexFloatReal ( ) [inline]
const APFloat& clang::APValue::getComplexFloatReal ( ) const [inline]

Definition at line 236 of file APValue.h.

References getComplexFloatReal().

APSInt& clang::APValue::getComplexIntImag ( ) [inline]
const APSInt& clang::APValue::getComplexIntImag ( ) const [inline]

Definition at line 228 of file APValue.h.

References getComplexIntImag().

APSInt& clang::APValue::getComplexIntReal ( ) [inline]
const APSInt& clang::APValue::getComplexIntReal ( ) const [inline]

Definition at line 220 of file APValue.h.

References getComplexIntReal().

APFloat& clang::APValue::getFloat ( ) [inline]
const APFloat& clang::APValue::getFloat ( ) const [inline]

Definition at line 212 of file APValue.h.

References getFloat().

APSInt& clang::APValue::getInt ( ) [inline]
const APSInt& clang::APValue::getInt ( ) const [inline]

Definition at line 204 of file APValue.h.

References getInt().

ValueKind clang::APValue::getKind ( ) const [inline]

Definition at line 579 of file APValue.cpp.

References isLValue().

Referenced by APValue().

const CharUnits& clang::APValue::getLValueOffset ( ) const [inline]

Definition at line 250 of file APValue.h.

References getLValueOffset().

Definition at line 573 of file APValue.cpp.

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

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

ArrayRef< const CXXRecordDecl * > APValue::getMemberPointerPath ( ) const
const APValue& clang::APValue::getStructBase ( unsigned  i) const [inline]

Definition at line 315 of file APValue.h.

References getStructBase().

const APValue& clang::APValue::getStructField ( unsigned  i) const [inline]

Definition at line 318 of file APValue.h.

References getStructField().

Definition at line 299 of file APValue.h.

References isStruct().

Referenced by APValue(), dump(), getStructField(), and printPretty().

Definition at line 303 of file APValue.h.

References isStruct().

Referenced by APValue(), and dump().

const FieldDecl* clang::APValue::getUnionField ( ) const [inline]

Definition at line 322 of file APValue.h.

References isUnion().

Referenced by APValue(), CheckConstantExpression(), findSubobject(), HandleConstructorCall(), and printPretty().

const APValue& clang::APValue::getUnionValue ( ) const [inline]

Definition at line 330 of file APValue.h.

References getUnionValue().

const APValue& clang::APValue::getVectorElt ( unsigned  I) const [inline]

Definition at line 263 of file APValue.h.

References getVectorElt().

Definition at line 568 of file APValue.cpp.

References isLValue().

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

Definition at line 192 of file APValue.h.

References AddrLabelDiff.

Referenced by getAddrLabelDiffLHS(), and getAddrLabelDiffRHS().

bool clang::APValue::isArray ( ) const [inline]

Definition at line 185 of file APValue.h.

References ComplexFloat.

Referenced by findSubobject(), getComplexFloatImag(), getComplexFloatReal(), and setComplexFloat().

bool clang::APValue::isComplexInt ( ) const [inline]

Definition at line 184 of file APValue.h.

References ComplexInt.

Referenced by findSubobject(), getComplexIntImag(), getComplexIntReal(), and setComplexInt().

bool clang::APValue::isFloat ( ) const [inline]
bool clang::APValue::isInt ( ) const [inline]
bool clang::APValue::isLValue ( ) const [inline]

Definition at line 558 of file APValue.cpp.

References isLValue().

Referenced by APValue(), and printPretty().

Definition at line 615 of file APValue.cpp.

References isMemberPointer().

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

bool clang::APValue::isStruct ( ) const [inline]
bool clang::APValue::isUninit ( ) const [inline]
bool clang::APValue::isUnion ( ) const [inline]

Definition at line 190 of file APValue.h.

References Union.

Referenced by CheckConstantExpression(), getUnionField(), getUnionValue(), HandleConstructorCall(), and setUnion().

bool clang::APValue::isVector ( ) const [inline]

Definition at line 187 of file APValue.h.

References Vector.

Referenced by EvalAndBitcastToAPInt(), getVectorElt(), getVectorLength(), and setVector().

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 215 of file APValue.cpp.

References AddrLabelDiff, Array, ComplexFloat, ComplexInt, Float, getComplexFloatImag(), getComplexFloatReal(), getComplexIntImag(), getComplexIntReal(), getFloat(), getInt(), getKind(), Int, LValue, MemberPointer, Struct, Uninitialized, Union, and Vector.

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

APValue& clang::APValue::operator= ( APValue  RHS) [inline]

Assign by swapping from a copy of the RHS.

Definition at line 393 of file APValue.h.

References swap().

void APValue::printPretty ( raw_ostream &  OS,
ASTContext Ctx,
QualType  Ty 
) const
void clang::APValue::setAddrLabelDiff ( const AddrLabelExpr LHSExpr,
const AddrLabelExpr RHSExpr 
) [inline]

Definition at line 386 of file APValue.h.

Referenced by APValue().

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

Definition at line 369 of file APValue.h.

References isComplexFloat().

Referenced by APValue().

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

Definition at line 362 of file APValue.h.

References isComplexInt().

Referenced by APValue().

void clang::APValue::setFloat ( APFloat  F) [inline]

Definition at line 351 of file APValue.h.

References isFloat().

Referenced by APValue().

void clang::APValue::setInt ( APSInt  I) [inline]

Definition at line 347 of file APValue.h.

References isInt().

Referenced by APValue().

void APValue::setLValue ( LValueBase  B,
const CharUnits O,
NoLValuePath  ,
unsigned  CallIndex 
)

Definition at line 584 of file APValue.cpp.

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

Referenced by APValue().

void APValue::setLValue ( LValueBase  B,
const CharUnits O,
ArrayRef< LValuePathEntry Path,
bool  OnePastTheEnd,
unsigned  CallIndex 
)
void clang::APValue::setUnion ( const FieldDecl Field,
const APValue Value 
) [inline]

Definition at line 381 of file APValue.h.

References isUnion().

Referenced by APValue().

void clang::APValue::setVector ( const APValue E,
unsigned  N 
) [inline]

Definition at line 355 of file APValue.h.

References isVector().

Referenced by APValue().

void APValue::swap ( APValue RHS)

Swaps the contents of this and the given APValue.

Definition at line 250 of file APValue.cpp.

Referenced by APValue(), expandArray(), and operator=().


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