clang  8.0.0
APValue.h
Go to the documentation of this file.
1 //===--- APValue.h - Union class for APFloat/APSInt/Complex -----*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the APValue class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_AST_APVALUE_H
15 #define LLVM_CLANG_AST_APVALUE_H
16 
17 #include "clang/Basic/LLVM.h"
18 #include "llvm/ADT/APFloat.h"
19 #include "llvm/ADT/APSInt.h"
20 #include "llvm/ADT/PointerIntPair.h"
21 #include "llvm/ADT/PointerUnion.h"
22 
23 namespace clang {
24  class AddrLabelExpr;
25  class ASTContext;
26  class CharUnits;
27  class DiagnosticBuilder;
28  class Expr;
29  class FieldDecl;
30  class Decl;
31  class ValueDecl;
32  class CXXRecordDecl;
33  class QualType;
34 
35 /// APValue - This class implements a discriminated union of [uninitialized]
36 /// [APSInt] [APFloat], [Complex APSInt] [Complex APFloat], [Expr + Offset],
37 /// [Vector: N * APValue], [Array: N * APValue]
38 class APValue {
39  typedef llvm::APSInt APSInt;
40  typedef llvm::APFloat APFloat;
41 public:
42  enum ValueKind {
44  Int,
55  };
56 
57  class LValueBase {
58  public:
59  typedef llvm::PointerUnion<const ValueDecl *, const Expr *> PtrTy;
60 
61  LValueBase() : CallIndex(0), Version(0) {}
62 
63  template <class T>
64  LValueBase(T P, unsigned I = 0, unsigned V = 0)
65  : Ptr(P), CallIndex(I), Version(V) {}
66 
67  template <class T>
68  bool is() const { return Ptr.is<T>(); }
69 
70  template <class T>
71  T get() const { return Ptr.get<T>(); }
72 
73  template <class T>
74  T dyn_cast() const { return Ptr.dyn_cast<T>(); }
75 
76  void *getOpaqueValue() const;
77 
78  bool isNull() const;
79 
80  explicit operator bool () const;
81 
82  PtrTy getPointer() const {
83  return Ptr;
84  }
85 
86  unsigned getCallIndex() const {
87  return CallIndex;
88  }
89 
90  void setCallIndex(unsigned Index) {
91  CallIndex = Index;
92  }
93 
94  unsigned getVersion() const {
95  return Version;
96  }
97 
98  bool operator==(const LValueBase &Other) const {
99  return Ptr == Other.Ptr && CallIndex == Other.CallIndex &&
100  Version == Other.Version;
101  }
102 
103  private:
104  PtrTy Ptr;
105  unsigned CallIndex, Version;
106  };
107 
108  typedef llvm::PointerIntPair<const Decl *, 1, bool> BaseOrMemberType;
110  /// BaseOrMember - The FieldDecl or CXXRecordDecl indicating the next item
111  /// in the path. An opaque value of type BaseOrMemberType.
113  /// ArrayIndex - The array index of the next item in the path.
114  uint64_t ArrayIndex;
115  };
116  struct NoLValuePath {};
117  struct UninitArray {};
118  struct UninitStruct {};
119 private:
120  ValueKind Kind;
121 
122  struct ComplexAPSInt {
123  APSInt Real, Imag;
124  ComplexAPSInt() : Real(1), Imag(1) {}
125  };
126  struct ComplexAPFloat {
127  APFloat Real, Imag;
128  ComplexAPFloat() : Real(0.0), Imag(0.0) {}
129  };
130  struct LV;
131  struct Vec {
132  APValue *Elts;
133  unsigned NumElts;
134  Vec() : Elts(nullptr), NumElts(0) {}
135  ~Vec() { delete[] Elts; }
136  };
137  struct Arr {
138  APValue *Elts;
139  unsigned NumElts, ArrSize;
140  Arr(unsigned NumElts, unsigned ArrSize);
141  ~Arr();
142  };
143  struct StructData {
144  APValue *Elts;
145  unsigned NumBases;
146  unsigned NumFields;
147  StructData(unsigned NumBases, unsigned NumFields);
148  ~StructData();
149  };
150  struct UnionData {
151  const FieldDecl *Field;
152  APValue *Value;
153  UnionData();
154  ~UnionData();
155  };
156  struct AddrLabelDiffData {
157  const AddrLabelExpr* LHSExpr;
158  const AddrLabelExpr* RHSExpr;
159  };
160  struct MemberPointerData;
161 
162  // We ensure elsewhere that Data is big enough for LV and MemberPointerData.
163  typedef llvm::AlignedCharArrayUnion<void *, APSInt, APFloat, ComplexAPSInt,
164  ComplexAPFloat, Vec, Arr, StructData,
165  UnionData, AddrLabelDiffData> DataType;
166  static const size_t DataSize = sizeof(DataType);
167 
168  DataType Data;
169 
170 public:
171  APValue() : Kind(Uninitialized) {}
172  explicit APValue(APSInt I) : Kind(Uninitialized) {
173  MakeInt(); setInt(std::move(I));
174  }
175  explicit APValue(APFloat F) : Kind(Uninitialized) {
176  MakeFloat(); setFloat(std::move(F));
177  }
178  explicit APValue(const APValue *E, unsigned N) : Kind(Uninitialized) {
179  MakeVector(); setVector(E, N);
180  }
181  APValue(APSInt R, APSInt I) : Kind(Uninitialized) {
182  MakeComplexInt(); setComplexInt(std::move(R), std::move(I));
183  }
184  APValue(APFloat R, APFloat I) : Kind(Uninitialized) {
185  MakeComplexFloat(); setComplexFloat(std::move(R), std::move(I));
186  }
187  APValue(const APValue &RHS);
188  APValue(APValue &&RHS) : Kind(Uninitialized) { swap(RHS); }
190  bool IsNullPtr = false)
191  : Kind(Uninitialized) {
192  MakeLValue(); setLValue(B, O, N, IsNullPtr);
193  }
195  bool OnePastTheEnd, bool IsNullPtr = false)
196  : Kind(Uninitialized) {
197  MakeLValue(); setLValue(B, O, Path, OnePastTheEnd, IsNullPtr);
198  }
199  APValue(UninitArray, unsigned InitElts, unsigned Size) : Kind(Uninitialized) {
200  MakeArray(InitElts, Size);
201  }
202  APValue(UninitStruct, unsigned B, unsigned M) : Kind(Uninitialized) {
203  MakeStruct(B, M);
204  }
205  explicit APValue(const FieldDecl *D, const APValue &V = APValue())
206  : Kind(Uninitialized) {
207  MakeUnion(); setUnion(D, V);
208  }
209  APValue(const ValueDecl *Member, bool IsDerivedMember,
211  MakeMemberPointer(Member, IsDerivedMember, Path);
212  }
213  APValue(const AddrLabelExpr* LHSExpr, const AddrLabelExpr* RHSExpr)
214  : Kind(Uninitialized) {
215  MakeAddrLabelDiff(); setAddrLabelDiff(LHSExpr, RHSExpr);
216  }
217 
219  MakeUninit();
220  }
221 
222  /// Returns whether the object performed allocations.
223  ///
224  /// If APValues are constructed via placement new, \c needsCleanup()
225  /// indicates whether the destructor must be called in order to correctly
226  /// free all allocated memory.
227  bool needsCleanup() const;
228 
229  /// Swaps the contents of this and the given APValue.
230  void swap(APValue &RHS);
231 
232  ValueKind getKind() const { return Kind; }
233  bool isUninit() const { return Kind == Uninitialized; }
234  bool isInt() const { return Kind == Int; }
235  bool isFloat() const { return Kind == Float; }
236  bool isComplexInt() const { return Kind == ComplexInt; }
237  bool isComplexFloat() const { return Kind == ComplexFloat; }
238  bool isLValue() const { return Kind == LValue; }
239  bool isVector() const { return Kind == Vector; }
240  bool isArray() const { return Kind == Array; }
241  bool isStruct() const { return Kind == Struct; }
242  bool isUnion() const { return Kind == Union; }
243  bool isMemberPointer() const { return Kind == MemberPointer; }
244  bool isAddrLabelDiff() const { return Kind == AddrLabelDiff; }
245 
246  void dump() const;
247  void dump(raw_ostream &OS) const;
248 
249  void printPretty(raw_ostream &OS, ASTContext &Ctx, QualType Ty) const;
250  std::string getAsString(ASTContext &Ctx, QualType Ty) const;
251 
252  APSInt &getInt() {
253  assert(isInt() && "Invalid accessor");
254  return *(APSInt*)(char*)Data.buffer;
255  }
256  const APSInt &getInt() const {
257  return const_cast<APValue*>(this)->getInt();
258  }
259 
260  /// Try to convert this value to an integral constant. This works if it's an
261  /// integer, null pointer, or offset from a null pointer. Returns true on
262  /// success.
263  bool toIntegralConstant(APSInt &Result, QualType SrcTy,
264  const ASTContext &Ctx) const;
265 
266  APFloat &getFloat() {
267  assert(isFloat() && "Invalid accessor");
268  return *(APFloat*)(char*)Data.buffer;
269  }
270  const APFloat &getFloat() const {
271  return const_cast<APValue*>(this)->getFloat();
272  }
273 
274  APSInt &getComplexIntReal() {
275  assert(isComplexInt() && "Invalid accessor");
276  return ((ComplexAPSInt*)(char*)Data.buffer)->Real;
277  }
278  const APSInt &getComplexIntReal() const {
279  return const_cast<APValue*>(this)->getComplexIntReal();
280  }
281 
282  APSInt &getComplexIntImag() {
283  assert(isComplexInt() && "Invalid accessor");
284  return ((ComplexAPSInt*)(char*)Data.buffer)->Imag;
285  }
286  const APSInt &getComplexIntImag() const {
287  return const_cast<APValue*>(this)->getComplexIntImag();
288  }
289 
290  APFloat &getComplexFloatReal() {
291  assert(isComplexFloat() && "Invalid accessor");
292  return ((ComplexAPFloat*)(char*)Data.buffer)->Real;
293  }
294  const APFloat &getComplexFloatReal() const {
295  return const_cast<APValue*>(this)->getComplexFloatReal();
296  }
297 
298  APFloat &getComplexFloatImag() {
299  assert(isComplexFloat() && "Invalid accessor");
300  return ((ComplexAPFloat*)(char*)Data.buffer)->Imag;
301  }
302  const APFloat &getComplexFloatImag() const {
303  return const_cast<APValue*>(this)->getComplexFloatImag();
304  }
305 
306  const LValueBase getLValueBase() const;
308  const CharUnits &getLValueOffset() const {
309  return const_cast<APValue*>(this)->getLValueOffset();
310  }
311  bool isLValueOnePastTheEnd() const;
312  bool hasLValuePath() const;
314  unsigned getLValueCallIndex() const;
315  unsigned getLValueVersion() const;
316  bool isNullPointer() const;
317 
318  APValue &getVectorElt(unsigned I) {
319  assert(isVector() && "Invalid accessor");
320  assert(I < getVectorLength() && "Index out of range");
321  return ((Vec*)(char*)Data.buffer)->Elts[I];
322  }
323  const APValue &getVectorElt(unsigned I) const {
324  return const_cast<APValue*>(this)->getVectorElt(I);
325  }
326  unsigned getVectorLength() const {
327  assert(isVector() && "Invalid accessor");
328  return ((const Vec*)(const void *)Data.buffer)->NumElts;
329  }
330 
332  assert(isArray() && "Invalid accessor");
333  assert(I < getArrayInitializedElts() && "Index out of range");
334  return ((Arr*)(char*)Data.buffer)->Elts[I];
335  }
336  const APValue &getArrayInitializedElt(unsigned I) const {
337  return const_cast<APValue*>(this)->getArrayInitializedElt(I);
338  }
339  bool hasArrayFiller() const {
341  }
343  assert(isArray() && "Invalid accessor");
344  assert(hasArrayFiller() && "No array filler");
345  return ((Arr*)(char*)Data.buffer)->Elts[getArrayInitializedElts()];
346  }
347  const APValue &getArrayFiller() const {
348  return const_cast<APValue*>(this)->getArrayFiller();
349  }
350  unsigned getArrayInitializedElts() const {
351  assert(isArray() && "Invalid accessor");
352  return ((const Arr*)(const void *)Data.buffer)->NumElts;
353  }
354  unsigned getArraySize() const {
355  assert(isArray() && "Invalid accessor");
356  return ((const Arr*)(const void *)Data.buffer)->ArrSize;
357  }
358 
359  unsigned getStructNumBases() const {
360  assert(isStruct() && "Invalid accessor");
361  return ((const StructData*)(const char*)Data.buffer)->NumBases;
362  }
363  unsigned getStructNumFields() const {
364  assert(isStruct() && "Invalid accessor");
365  return ((const StructData*)(const char*)Data.buffer)->NumFields;
366  }
367  APValue &getStructBase(unsigned i) {
368  assert(isStruct() && "Invalid accessor");
369  return ((StructData*)(char*)Data.buffer)->Elts[i];
370  }
371  APValue &getStructField(unsigned i) {
372  assert(isStruct() && "Invalid accessor");
373  return ((StructData*)(char*)Data.buffer)->Elts[getStructNumBases() + i];
374  }
375  const APValue &getStructBase(unsigned i) const {
376  return const_cast<APValue*>(this)->getStructBase(i);
377  }
378  const APValue &getStructField(unsigned i) const {
379  return const_cast<APValue*>(this)->getStructField(i);
380  }
381 
382  const FieldDecl *getUnionField() const {
383  assert(isUnion() && "Invalid accessor");
384  return ((const UnionData*)(const char*)Data.buffer)->Field;
385  }
387  assert(isUnion() && "Invalid accessor");
388  return *((UnionData*)(char*)Data.buffer)->Value;
389  }
390  const APValue &getUnionValue() const {
391  return const_cast<APValue*>(this)->getUnionValue();
392  }
393 
394  const ValueDecl *getMemberPointerDecl() const;
395  bool isMemberPointerToDerivedMember() const;
397 
399  assert(isAddrLabelDiff() && "Invalid accessor");
400  return ((const AddrLabelDiffData*)(const char*)Data.buffer)->LHSExpr;
401  }
403  assert(isAddrLabelDiff() && "Invalid accessor");
404  return ((const AddrLabelDiffData*)(const char*)Data.buffer)->RHSExpr;
405  }
406 
407  void setInt(APSInt I) {
408  assert(isInt() && "Invalid accessor");
409  *(APSInt *)(char *)Data.buffer = std::move(I);
410  }
411  void setFloat(APFloat F) {
412  assert(isFloat() && "Invalid accessor");
413  *(APFloat *)(char *)Data.buffer = std::move(F);
414  }
415  void setVector(const APValue *E, unsigned N) {
416  assert(isVector() && "Invalid accessor");
417  ((Vec*)(char*)Data.buffer)->Elts = new APValue[N];
418  ((Vec*)(char*)Data.buffer)->NumElts = N;
419  for (unsigned i = 0; i != N; ++i)
420  ((Vec*)(char*)Data.buffer)->Elts[i] = E[i];
421  }
422  void setComplexInt(APSInt R, APSInt I) {
423  assert(R.getBitWidth() == I.getBitWidth() &&
424  "Invalid complex int (type mismatch).");
425  assert(isComplexInt() && "Invalid accessor");
426  ((ComplexAPSInt *)(char *)Data.buffer)->Real = std::move(R);
427  ((ComplexAPSInt *)(char *)Data.buffer)->Imag = std::move(I);
428  }
429  void setComplexFloat(APFloat R, APFloat I) {
430  assert(&R.getSemantics() == &I.getSemantics() &&
431  "Invalid complex float (type mismatch).");
432  assert(isComplexFloat() && "Invalid accessor");
433  ((ComplexAPFloat *)(char *)Data.buffer)->Real = std::move(R);
434  ((ComplexAPFloat *)(char *)Data.buffer)->Imag = std::move(I);
435  }
436  void setLValue(LValueBase B, const CharUnits &O, NoLValuePath,
437  bool IsNullPtr);
438  void setLValue(LValueBase B, const CharUnits &O,
439  ArrayRef<LValuePathEntry> Path, bool OnePastTheEnd,
440  bool IsNullPtr);
441  void setUnion(const FieldDecl *Field, const APValue &Value) {
442  assert(isUnion() && "Invalid accessor");
443  ((UnionData*)(char*)Data.buffer)->Field = Field;
444  *((UnionData*)(char*)Data.buffer)->Value = Value;
445  }
446  void setAddrLabelDiff(const AddrLabelExpr* LHSExpr,
447  const AddrLabelExpr* RHSExpr) {
448  ((AddrLabelDiffData*)(char*)Data.buffer)->LHSExpr = LHSExpr;
449  ((AddrLabelDiffData*)(char*)Data.buffer)->RHSExpr = RHSExpr;
450  }
451 
452  /// Assign by swapping from a copy of the RHS.
454  swap(RHS);
455  return *this;
456  }
457 
458 private:
459  void DestroyDataAndMakeUninit();
460  void MakeUninit() {
461  if (Kind != Uninitialized)
462  DestroyDataAndMakeUninit();
463  }
464  void MakeInt() {
465  assert(isUninit() && "Bad state change");
466  new ((void*)Data.buffer) APSInt(1);
467  Kind = Int;
468  }
469  void MakeFloat() {
470  assert(isUninit() && "Bad state change");
471  new ((void*)(char*)Data.buffer) APFloat(0.0);
472  Kind = Float;
473  }
474  void MakeVector() {
475  assert(isUninit() && "Bad state change");
476  new ((void*)(char*)Data.buffer) Vec();
477  Kind = Vector;
478  }
479  void MakeComplexInt() {
480  assert(isUninit() && "Bad state change");
481  new ((void*)(char*)Data.buffer) ComplexAPSInt();
482  Kind = ComplexInt;
483  }
484  void MakeComplexFloat() {
485  assert(isUninit() && "Bad state change");
486  new ((void*)(char*)Data.buffer) ComplexAPFloat();
487  Kind = ComplexFloat;
488  }
489  void MakeLValue();
490  void MakeArray(unsigned InitElts, unsigned Size);
491  void MakeStruct(unsigned B, unsigned M) {
492  assert(isUninit() && "Bad state change");
493  new ((void*)(char*)Data.buffer) StructData(B, M);
494  Kind = Struct;
495  }
496  void MakeUnion() {
497  assert(isUninit() && "Bad state change");
498  new ((void*)(char*)Data.buffer) UnionData();
499  Kind = Union;
500  }
501  void MakeMemberPointer(const ValueDecl *Member, bool IsDerivedMember,
503  void MakeAddrLabelDiff() {
504  assert(isUninit() && "Bad state change");
505  new ((void*)(char*)Data.buffer) AddrLabelDiffData();
506  Kind = AddrLabelDiff;
507  }
508 };
509 
510 } // end namespace clang.
511 
512 namespace llvm {
513 template<> struct DenseMapInfo<clang::APValue::LValueBase> {
514  static clang::APValue::LValueBase getEmptyKey();
515  static clang::APValue::LValueBase getTombstoneKey();
516  static unsigned getHashValue(const clang::APValue::LValueBase &Base);
517  static bool isEqual(const clang::APValue::LValueBase &LHS,
518  const clang::APValue::LValueBase &RHS);
519 };
520 }
521 
522 #endif
unsigned getStructNumFields() const
Definition: APValue.h:363
A (possibly-)qualified type.
Definition: Type.h:638
APValue(const AddrLabelExpr *LHSExpr, const AddrLabelExpr *RHSExpr)
Definition: APValue.h:213
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:30
llvm::PointerUnion< const ValueDecl *, const Expr * > PtrTy
Definition: APValue.h:59
StringRef P
bool isUninit() const
Definition: APValue.h:233
APValue(UninitStruct, unsigned B, unsigned M)
Definition: APValue.h:202
bool isVector() const
Definition: APValue.h:239
void * BaseOrMember
BaseOrMember - The FieldDecl or CXXRecordDecl indicating the next item in the path.
Definition: APValue.h:112
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const APValue & getStructField(unsigned i) const
Definition: APValue.h:378
const AddrLabelExpr * getAddrLabelDiffLHS() const
Definition: APValue.h:398
PtrTy getPointer() const
Definition: APValue.h:82
APFloat & getComplexFloatReal()
Definition: APValue.h:290
void dump() const
Definition: APValue.cpp:300
ArrayRef< LValuePathEntry > getLValuePath() const
Definition: APValue.cpp:643
const APFloat & getComplexFloatReal() const
Definition: APValue.h:294
bool isAddrLabelDiff() const
Definition: APValue.h:244
const APValue & getArrayFiller() const
Definition: APValue.h:347
const APSInt & getComplexIntReal() const
Definition: APValue.h:278
bool isLValueOnePastTheEnd() const
Definition: APValue.cpp:628
const ValueDecl * getMemberPointerDecl() const
Definition: APValue.cpp:688
unsigned getVersion() const
Definition: APValue.h:94
APValue & operator=(APValue RHS)
Assign by swapping from a copy of the RHS.
Definition: APValue.h:453
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:155
APValue(const APValue *E, unsigned N)
Definition: APValue.h:178
Represents a member of a struct/union/class.
Definition: Decl.h:2579
const APValue & getUnionValue() const
Definition: APValue.h:390
unsigned getCallIndex() const
Definition: APValue.h:86
unsigned getArraySize() const
Definition: APValue.h:354
unsigned getLValueCallIndex() const
Definition: APValue.cpp:649
bool isFloat() const
Definition: APValue.h:235
bool operator==(const LValueBase &Other) const
Definition: APValue.h:98
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
std::string getAsString(ASTContext &Ctx, QualType Ty) const
Definition: APValue.cpp:595
void setCallIndex(unsigned Index)
Definition: APValue.h:90
bool isComplexFloat() const
Definition: APValue.h:237
bool isComplexInt() const
Definition: APValue.h:236
void printPretty(raw_ostream &OS, ASTContext &Ctx, QualType Ty) const
Definition: APValue.cpp:386
bool isInt() const
Definition: APValue.h:234
APValue(APSInt I)
Definition: APValue.h:172
bool needsCleanup() const
Returns whether the object performed allocations.
Definition: APValue.cpp:257
APSInt & getComplexIntReal()
Definition: APValue.h:274
APValue(UninitArray, unsigned InitElts, unsigned Size)
Definition: APValue.h:199
APValue & getVectorElt(unsigned I)
Definition: APValue.h:318
unsigned getLValueVersion() const
Definition: APValue.cpp:654
bool isUnion() const
Definition: APValue.h:242
bool hasLValuePath() const
Definition: APValue.cpp:638
const APFloat & getComplexFloatImag() const
Definition: APValue.h:302
APValue(APFloat F)
Definition: APValue.h:175
APValue & getArrayFiller()
Definition: APValue.h:342
uint64_t ArrayIndex
ArrayIndex - The array index of the next item in the path.
Definition: APValue.h:114
bool hasArrayFiller() const
Definition: APValue.h:339
const APValue & getVectorElt(unsigned I) const
Definition: APValue.h:323
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:637
const APSInt & getInt() const
Definition: APValue.h:256
#define bool
Definition: stdbool.h:31
APValue(const FieldDecl *D, const APValue &V=APValue())
Definition: APValue.h:205
APValue(APFloat R, APFloat I)
Definition: APValue.h:184
APValue & getStructField(unsigned i)
Definition: APValue.h:371
bool isNullPointer() const
Definition: APValue.cpp:659
APSInt & getComplexIntImag()
Definition: APValue.h:282
const APValue & getArrayInitializedElt(unsigned I) const
Definition: APValue.h:336
The result type of a method or function.
APValue(const ValueDecl *Member, bool IsDerivedMember, ArrayRef< const CXXRecordDecl *> Path)
Definition: APValue.h:209
const FieldDecl * getUnionField() const
Definition: APValue.h:382
void setVector(const APValue *E, unsigned N)
Definition: APValue.h:415
APValue & getStructBase(unsigned i)
Definition: APValue.h:367
unsigned getStructNumBases() const
Definition: APValue.h:359
LValueBase(T P, unsigned I=0, unsigned V=0)
Definition: APValue.h:64
APValue & getArrayInitializedElt(unsigned I)
Definition: APValue.h:331
Kind
const LValueBase getLValueBase() const
Definition: APValue.cpp:623
void * getOpaqueValue() const
Definition: APValue.cpp:34
const APSInt & getComplexIntImag() const
Definition: APValue.h:286
void setInt(APSInt I)
Definition: APValue.h:407
void setLValue(LValueBase B, const CharUnits &O, NoLValuePath, bool IsNullPtr)
Definition: APValue.cpp:664
const AddrLabelExpr * getAddrLabelDiffRHS() const
Definition: APValue.h:402
APValue & getUnionValue()
Definition: APValue.h:386
APFloat & getFloat()
Definition: APValue.h:266
bool isMemberPointer() const
Definition: APValue.h:243
void setAddrLabelDiff(const AddrLabelExpr *LHSExpr, const AddrLabelExpr *RHSExpr)
Definition: APValue.h:446
bool isLValue() const
Definition: APValue.h:238
bool isMemberPointerToDerivedMember() const
Definition: APValue.cpp:695
const APValue & getStructBase(unsigned i) const
Definition: APValue.h:375
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3762
Dataflow Directional Tag Classes.
void swap(APValue &RHS)
Swaps the contents of this and the given APValue.
Definition: APValue.cpp:292
unsigned getArrayInitializedElts() const
Definition: APValue.h:350
APValue(APSInt R, APSInt I)
Definition: APValue.h:181
APValue(LValueBase B, const CharUnits &O, NoLValuePath N, bool IsNullPtr=false)
Definition: APValue.h:189
bool toIntegralConstant(APSInt &Result, QualType SrcTy, const ASTContext &Ctx) const
Try to convert this value to an integral constant.
Definition: APValue.cpp:603
ArrayRef< const CXXRecordDecl * > getMemberPointerPath() const
Definition: APValue.cpp:702
const APFloat & getFloat() const
Definition: APValue.h:270
bool isArray() const
Definition: APValue.h:240
bool isStruct() const
Definition: APValue.h:241
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
Definition: APValue.h:38
ValueKind getKind() const
Definition: APValue.h:232
APFloat & getComplexFloatImag()
Definition: APValue.h:298
const CharUnits & getLValueOffset() const
Definition: APValue.h:308
APValue(LValueBase B, const CharUnits &O, ArrayRef< LValuePathEntry > Path, bool OnePastTheEnd, bool IsNullPtr=false)
Definition: APValue.h:194
llvm::PointerIntPair< const Decl *, 1, bool > BaseOrMemberType
Definition: APValue.h:108
void setFloat(APFloat F)
Definition: APValue.h:411
void setComplexInt(APSInt R, APSInt I)
Definition: APValue.h:422
void setUnion(const FieldDecl *Field, const APValue &Value)
Definition: APValue.h:441
APSInt & getInt()
Definition: APValue.h:252
void setComplexFloat(APFloat R, APFloat I)
Definition: APValue.h:429
CharUnits & getLValueOffset()
Definition: APValue.cpp:633
APValue(APValue &&RHS)
Definition: APValue.h:188
unsigned getVectorLength() const
Definition: APValue.h:326