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