Clang Project

clang_source_code/include/clang/AST/APValue.h
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
23namespace 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]
38class APValue {
39  typedef llvm::APSInt APSInt;
40  typedef llvm::APFloat APFloat;
41public:
42  enum ValueKind {
43    Uninitialized,
44    Int,
45    Float,
46    FixedPoint,
47    ComplexInt,
48    ComplexFloat,
49    LValue,
50    Vector,
51    Array,
52    Struct,
53    Union,
54    MemberPointer,
55    AddrLabelDiff
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 Punsigned I = 0unsigned 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 &Otherconst {
100      return Ptr == Other.Ptr && CallIndex == Other.CallIndex &&
101             Version == Other.Version;
102    }
103
104  private:
105    PtrTy Ptr;
106    unsigned CallIndexVersion;
107  };
108
109  typedef llvm::PointerIntPair<const Decl *, 1boolBaseOrMemberType;
110  union LValuePathEntry {
111    /// BaseOrMember - The FieldDecl or CXXRecordDecl indicating the next item
112    /// in the path. An opaque value of type BaseOrMemberType.
113    void *BaseOrMember;
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 {};
120private:
121  ValueKind Kind;
122
123  struct ComplexAPSInt {
124    APSInt RealImag;
125    ComplexAPSInt() : Real(1), Imag(1) {}
126  };
127  struct ComplexAPFloat {
128    APFloat RealImag;
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 NumEltsArrSize;
141    Arr(unsigned NumEltsunsigned ArrSize);
142    ~Arr();
143  };
144  struct StructData {
145    APValue *Elts;
146    unsigned NumBases;
147    unsigned NumFields;
148    StructData(unsigned NumBasesunsigned NumFields);
149    ~StructData();
150  };
151  struct UnionData {
152    const FieldDecl *Field;
153    APValue *Value;
154    UnionData();
155    ~UnionData();
156  };
157  struct AddrLabelDiffData {
158    const AddrLabelExprLHSExpr;
159    const AddrLabelExprRHSExpr;
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
171public:
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 *Eunsigned N) : Kind(Uninitialized) {
183    MakeVector(); setVector(EN);
184  }
185  APValue(APSInt RAPSInt I) : Kind(Uninitialized) {
186    MakeComplexInt(); setComplexInt(std::move(R), std::move(I));
187  }
188  APValue(APFloat RAPFloat 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); }
193  APValue(LValueBase Bconst CharUnits &ONoLValuePath N,
194          bool IsNullPtr = false)
195      : Kind(Uninitialized) {
196    MakeLValue(); setLValue(BONIsNullPtr);
197  }
198  APValue(LValueBase Bconst CharUnits &OArrayRef<LValuePathEntryPath,
199          bool OnePastTheEndbool IsNullPtr = false)
200      : Kind(Uninitialized) {
201    MakeLValue(); setLValue(B, O, Path, OnePastTheEnd, IsNullPtr);
202  }
203  APValue(UninitArrayunsigned InitEltsunsigned Size) : Kind(Uninitialized) {
204    MakeArray(InitEltsSize);
205  }
206  APValue(UninitStructunsigned Bunsigned M) : Kind(Uninitialized) {
207    MakeStruct(BM);
208  }
209  explicit APValue(const FieldDecl *Dconst APValue &V = APValue())
210      : Kind(Uninitialized) {
211    MakeUnion(); setUnion(DV);
212  }
213  APValue(const ValueDecl *Memberbool IsDerivedMember,
214          ArrayRef<const CXXRecordDecl*> Path) : Kind(Uninitialized) {
215    MakeMemberPointer(Member, IsDerivedMember, Path);
216  }
217  APValue(const AddrLabelExprLHSExprconst AddrLabelExprRHSExpr)
218      : Kind(Uninitialized) {
219    MakeAddrLabelDiff(); setAddrLabelDiff(LHSExprRHSExpr);
220  }
221
222  ~APValue() {
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 &OSconst;
253
254  void printPretty(raw_ostream &OSASTContext &CtxQualType Tyconst;
255  std::string getAsString(ASTContext &CtxQualType Tyconst;
256
257  APSInt &getInt() {
258     (0) . __assert_fail ("isInt() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 258, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">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 &ResultQualType SrcTy,
269                          const ASTContext &Ctxconst;
270
271  APFloat &getFloat() {
272     (0) . __assert_fail ("isFloat() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 272, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">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
279  APFixedPoint &getFixedPoint() {
280     (0) . __assert_fail ("isFixedPoint() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 280, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">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     (0) . __assert_fail ("isComplexInt() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 288, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">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     (0) . __assert_fail ("isComplexInt() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 296, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">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     (0) . __assert_fail ("isComplexFloat() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 304, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">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     (0) . __assert_fail ("isComplexFloat() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 312, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">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;
320  CharUnits &getLValueOffset();
321  const CharUnits &getLValueOffset() const {
322    return const_cast<APValue*>(this)->getLValueOffset();
323  }
324  bool isLValueOnePastTheEnd() const;
325  bool hasLValuePath() const;
326  ArrayRef<LValuePathEntrygetLValuePath() const;
327  unsigned getLValueCallIndex() const;
328  unsigned getLValueVersion() const;
329  bool isNullPointer() const;
330
331  APValue &getVectorElt(unsigned I) {
332     (0) . __assert_fail ("isVector() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 332, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isVector() && "Invalid accessor");
333     (0) . __assert_fail ("I < getVectorLength() && \"Index out of range\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 333, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(I < getVectorLength() && "Index out of range");
334    return ((Vec*)(char*)Data.buffer)->Elts[I];
335  }
336  const APValue &getVectorElt(unsigned Iconst {
337    return const_cast<APValue*>(this)->getVectorElt(I);
338  }
339  unsigned getVectorLength() const {
340     (0) . __assert_fail ("isVector() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 340, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isVector() && "Invalid accessor");
341    return ((const Vec*)(const void *)Data.buffer)->NumElts;
342  }
343
344  APValue &getArrayInitializedElt(unsigned I) {
345     (0) . __assert_fail ("isArray() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 345, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isArray() && "Invalid accessor");
346     (0) . __assert_fail ("I < getArrayInitializedElts() && \"Index out of range\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 346, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(I < getArrayInitializedElts() && "Index out of range");
347    return ((Arr*)(char*)Data.buffer)->Elts[I];
348  }
349  const APValue &getArrayInitializedElt(unsigned Iconst {
350    return const_cast<APValue*>(this)->getArrayInitializedElt(I);
351  }
352  bool hasArrayFiller() const {
353    return getArrayInitializedElts() != getArraySize();
354  }
355  APValue &getArrayFiller() {
356     (0) . __assert_fail ("isArray() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 356, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isArray() && "Invalid accessor");
357     (0) . __assert_fail ("hasArrayFiller() && \"No array filler\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 357, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">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     (0) . __assert_fail ("isArray() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 364, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isArray() && "Invalid accessor");
365    return ((const Arr*)(const void *)Data.buffer)->NumElts;
366  }
367  unsigned getArraySize() const {
368     (0) . __assert_fail ("isArray() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 368, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isArray() && "Invalid accessor");
369    return ((const Arr*)(const void *)Data.buffer)->ArrSize;
370  }
371
372  unsigned getStructNumBases() const {
373     (0) . __assert_fail ("isStruct() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 373, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isStruct() && "Invalid accessor");
374    return ((const StructData*)(const char*)Data.buffer)->NumBases;
375  }
376  unsigned getStructNumFields() const {
377     (0) . __assert_fail ("isStruct() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 377, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isStruct() && "Invalid accessor");
378    return ((const StructData*)(const char*)Data.buffer)->NumFields;
379  }
380  APValue &getStructBase(unsigned i) {
381     (0) . __assert_fail ("isStruct() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 381, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isStruct() && "Invalid accessor");
382    return ((StructData*)(char*)Data.buffer)->Elts[i];
383  }
384  APValue &getStructField(unsigned i) {
385     (0) . __assert_fail ("isStruct() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 385, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isStruct() && "Invalid accessor");
386    return ((StructData*)(char*)Data.buffer)->Elts[getStructNumBases() + i];
387  }
388  const APValue &getStructBase(unsigned iconst {
389    return const_cast<APValue*>(this)->getStructBase(i);
390  }
391  const APValue &getStructField(unsigned iconst {
392    return const_cast<APValue*>(this)->getStructField(i);
393  }
394
395  const FieldDecl *getUnionField() const {
396     (0) . __assert_fail ("isUnion() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 396, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isUnion() && "Invalid accessor");
397    return ((const UnionData*)(const char*)Data.buffer)->Field;
398  }
399  APValue &getUnionValue() {
400     (0) . __assert_fail ("isUnion() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 400, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">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;
409  ArrayRef<const CXXRecordDecl*> getMemberPointerPath() const;
410
411  const AddrLabelExprgetAddrLabelDiffLHS() const {
412     (0) . __assert_fail ("isAddrLabelDiff() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 412, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isAddrLabelDiff() && "Invalid accessor");
413    return ((const AddrLabelDiffData*)(const char*)Data.buffer)->LHSExpr;
414  }
415  const AddrLabelExprgetAddrLabelDiffRHS() const {
416     (0) . __assert_fail ("isAddrLabelDiff() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 416, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isAddrLabelDiff() && "Invalid accessor");
417    return ((const AddrLabelDiffData*)(const char*)Data.buffer)->RHSExpr;
418  }
419
420  void setInt(APSInt I) {
421     (0) . __assert_fail ("isInt() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 421, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isInt() && "Invalid accessor");
422    *(APSInt *)(char *)Data.buffer = std::move(I);
423  }
424  void setFloat(APFloat F) {
425     (0) . __assert_fail ("isFloat() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 425, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isFloat() && "Invalid accessor");
426    *(APFloat *)(char *)Data.buffer = std::move(F);
427  }
428  void setFixedPoint(APFixedPoint FX) {
429     (0) . __assert_fail ("isFixedPoint() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 429, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isFixedPoint() && "Invalid accessor");
430    *(APFixedPoint *)(char *)Data.buffer = std::move(FX);
431  }
432  void setVector(const APValue *Eunsigned N) {
433     (0) . __assert_fail ("isVector() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 433, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isVector() && "Invalid accessor");
434    ((Vec*)(char*)Data.buffer)->Elts = new APValue[N];
435    ((Vec*)(char*)Data.buffer)->NumElts = N;
436    for (unsigned i = 0i != N; ++i)
437      ((Vec*)(char*)Data.buffer)->Elts[i] = E[i];
438  }
439  void setComplexInt(APSInt RAPSInt I) {
440     (0) . __assert_fail ("R.getBitWidth() == I.getBitWidth() && \"Invalid complex int (type mismatch).\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 441, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(R.getBitWidth() == I.getBitWidth() &&
441 (0) . __assert_fail ("R.getBitWidth() == I.getBitWidth() && \"Invalid complex int (type mismatch).\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 441, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">           "Invalid complex int (type mismatch).");
442     (0) . __assert_fail ("isComplexInt() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 442, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">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 RAPFloat I) {
447     (0) . __assert_fail ("&R.getSemantics() == &I.getSemantics() && \"Invalid complex float (type mismatch).\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 448, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(&R.getSemantics() == &I.getSemantics() &&
448 (0) . __assert_fail ("&R.getSemantics() == &I.getSemantics() && \"Invalid complex float (type mismatch).\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 448, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">           "Invalid complex float (type mismatch).");
449     (0) . __assert_fail ("isComplexFloat() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 449, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">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 Bconst CharUnits &ONoLValuePath,
454                 bool IsNullPtr);
455  void setLValue(LValueBase Bconst CharUnits &O,
456                 ArrayRef<LValuePathEntryPathbool OnePastTheEnd,
457                 bool IsNullPtr);
458  void setUnion(const FieldDecl *Fieldconst APValue &Value) {
459     (0) . __assert_fail ("isUnion() && \"Invalid accessor\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 459, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isUnion() && "Invalid accessor");
460    ((UnionData*)(char*)Data.buffer)->Field = Field;
461    *((UnionData*)(char*)Data.buffer)->Value = Value;
462  }
463  void setAddrLabelDiff(const AddrLabelExprLHSExpr,
464                        const AddrLabelExprRHSExpr) {
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.
470  APValue &operator=(APValue RHS) {
471    swap(RHS);
472    return *this;
473  }
474
475private:
476  void DestroyDataAndMakeUninit();
477  void MakeUninit() {
478    if (Kind != Uninitialized)
479      DestroyDataAndMakeUninit();
480  }
481  void MakeInt() {
482     (0) . __assert_fail ("isUninit() && \"Bad state change\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 482, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isUninit() && "Bad state change");
483    new ((void*)Data.buffer) APSInt(1);
484    Kind = Int;
485  }
486  void MakeFloat() {
487     (0) . __assert_fail ("isUninit() && \"Bad state change\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 487, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isUninit() && "Bad state change");
488    new ((void*)(char*)Data.buffer) APFloat(0.0);
489    Kind = Float;
490  }
491  void MakeFixedPoint(APFixedPoint &&FX) {
492     (0) . __assert_fail ("isUninit() && \"Bad state change\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 492, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isUninit() && "Bad state change");
493    new ((void *)(char *)Data.buffer) APFixedPoint(std::move(FX));
494    Kind = FixedPoint;
495  }
496  void MakeVector() {
497     (0) . __assert_fail ("isUninit() && \"Bad state change\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 497, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isUninit() && "Bad state change");
498    new ((void*)(char*)Data.buffer) Vec();
499    Kind = Vector;
500  }
501  void MakeComplexInt() {
502     (0) . __assert_fail ("isUninit() && \"Bad state change\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 502, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isUninit() && "Bad state change");
503    new ((void*)(char*)Data.buffer) ComplexAPSInt();
504    Kind = ComplexInt;
505  }
506  void MakeComplexFloat() {
507     (0) . __assert_fail ("isUninit() && \"Bad state change\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 507, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isUninit() && "Bad state change");
508    new ((void*)(char*)Data.buffer) ComplexAPFloat();
509    Kind = ComplexFloat;
510  }
511  void MakeLValue();
512  void MakeArray(unsigned InitEltsunsigned Size);
513  void MakeStruct(unsigned Bunsigned M) {
514     (0) . __assert_fail ("isUninit() && \"Bad state change\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 514, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isUninit() && "Bad state change");
515    new ((void*)(char*)Data.buffer) StructData(BM);
516    Kind = Struct;
517  }
518  void MakeUnion() {
519     (0) . __assert_fail ("isUninit() && \"Bad state change\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 519, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isUninit() && "Bad state change");
520    new ((void*)(char*)Data.buffer) UnionData();
521    Kind = Union;
522  }
523  void MakeMemberPointer(const ValueDecl *Memberbool IsDerivedMember,
524                         ArrayRef<const CXXRecordDecl*> Path);
525  void MakeAddrLabelDiff() {
526     (0) . __assert_fail ("isUninit() && \"Bad state change\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/APValue.h", 526, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isUninit() && "Bad state change");
527    new ((void*)(char*)Data.buffer) AddrLabelDiffData();
528    Kind = AddrLabelDiff;
529  }
530};
531
532// end namespace clang.
533
534namespace llvm {
535template<> 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
545
clang::APValue::ValueKind
clang::APValue::LValueBase
clang::APValue::LValueBase::is
clang::APValue::LValueBase::get
clang::APValue::LValueBase::dyn_cast
clang::APValue::LValueBase::getOpaqueValue
clang::APValue::LValueBase::isNull
clang::APValue::LValueBase::getPointer
clang::APValue::LValueBase::getCallIndex
clang::APValue::LValueBase::setCallIndex
clang::APValue::LValueBase::getVersion
clang::APValue::LValueBase::Ptr
clang::APValue::LValueBase::CallIndex
clang::APValue::LValueBase::Version
clang::APValue::LValuePathEntry
clang::APValue::LValuePathEntry::BaseOrMember
clang::APValue::LValuePathEntry::ArrayIndex
clang::APValue::NoLValuePath
clang::APValue::UninitArray
clang::APValue::UninitStruct
clang::APValue::Kind
clang::APValue::ComplexAPSInt
clang::APValue::ComplexAPSInt::Real
clang::APValue::ComplexAPSInt::Imag
clang::APValue::ComplexAPFloat
clang::APValue::ComplexAPFloat::Real
clang::APValue::ComplexAPFloat::Imag
clang::APValue::Vec
clang::APValue::Vec::Elts
clang::APValue::Vec::NumElts
clang::APValue::Arr
clang::APValue::Arr::Elts
clang::APValue::Arr::NumElts
clang::APValue::Arr::ArrSize
clang::APValue::StructData
clang::APValue::StructData::Elts
clang::APValue::StructData::NumBases
clang::APValue::StructData::NumFields
clang::APValue::UnionData
clang::APValue::UnionData::Field
clang::APValue::UnionData::Value
clang::APValue::AddrLabelDiffData
clang::APValue::AddrLabelDiffData::LHSExpr
clang::APValue::AddrLabelDiffData::RHSExpr
clang::APValue::Data
clang::APValue::needsCleanup
clang::APValue::swap
clang::APValue::getKind
clang::APValue::isUninit
clang::APValue::isInt
clang::APValue::isFloat
clang::APValue::isFixedPoint
clang::APValue::isComplexInt
clang::APValue::isComplexFloat
clang::APValue::isLValue
clang::APValue::isVector
clang::APValue::isArray
clang::APValue::isStruct
clang::APValue::isUnion
clang::APValue::isMemberPointer
clang::APValue::isAddrLabelDiff
clang::APValue::dump
clang::APValue::dump
clang::APValue::printPretty
clang::APValue::getAsString
clang::APValue::getInt
clang::APValue::getInt
clang::APValue::toIntegralConstant
clang::APValue::getFloat
clang::APValue::getFloat
clang::APValue::getFixedPoint
clang::APValue::getFixedPoint
clang::APValue::getComplexIntReal
clang::APValue::getComplexIntReal
clang::APValue::getComplexIntImag
clang::APValue::getComplexIntImag
clang::APValue::getComplexFloatReal
clang::APValue::getComplexFloatReal
clang::APValue::getComplexFloatImag
clang::APValue::getComplexFloatImag
clang::APValue::getLValueBase
clang::APValue::getLValueOffset
clang::APValue::getLValueOffset
clang::APValue::isLValueOnePastTheEnd
clang::APValue::hasLValuePath
clang::APValue::getLValuePath
clang::APValue::getLValueCallIndex
clang::APValue::getLValueVersion
clang::APValue::isNullPointer
clang::APValue::getVectorElt
clang::APValue::getVectorElt
clang::APValue::getVectorLength
clang::APValue::getArrayInitializedElt
clang::APValue::getArrayInitializedElt
clang::APValue::hasArrayFiller
clang::APValue::getArrayFiller
clang::APValue::getArrayFiller
clang::APValue::getArrayInitializedElts
clang::APValue::getArraySize
clang::APValue::getStructNumBases
clang::APValue::getStructNumFields
clang::APValue::getStructBase
clang::APValue::getStructField
clang::APValue::getStructBase
clang::APValue::getStructField
clang::APValue::getUnionField
clang::APValue::getUnionValue
clang::APValue::getUnionValue
clang::APValue::getMemberPointerDecl
clang::APValue::isMemberPointerToDerivedMember
clang::APValue::getMemberPointerPath
clang::APValue::getAddrLabelDiffLHS
clang::APValue::getAddrLabelDiffRHS
clang::APValue::setInt
clang::APValue::setFloat
clang::APValue::setFixedPoint
clang::APValue::setVector
clang::APValue::setComplexInt
clang::APValue::setComplexFloat
clang::APValue::setLValue
clang::APValue::setLValue
clang::APValue::setUnion
clang::APValue::setAddrLabelDiff
clang::APValue::DestroyDataAndMakeUninit
clang::APValue::MakeUninit
clang::APValue::MakeInt
clang::APValue::MakeFloat
clang::APValue::MakeFixedPoint
clang::APValue::MakeVector
clang::APValue::MakeComplexInt
clang::APValue::MakeComplexFloat
clang::APValue::MakeLValue
clang::APValue::MakeArray
clang::APValue::MakeStruct
clang::APValue::MakeUnion
clang::APValue::MakeMemberPointer
clang::APValue::MakeAddrLabelDiff
llvm::DenseMapInfo::getEmptyKey
llvm::DenseMapInfo::getTombstoneKey
llvm::DenseMapInfo::getHashValue
llvm::DenseMapInfo::isEqual
clang::APValue::getAsString
llvm::DenseMapInfo::getEmptyKey
llvm::DenseMapInfo::getTombstoneKey
llvm::DenseMapInfo::getHashValue
llvm::DenseMapInfo::isEqual
clang::APValue::DataSize
clang::APValue::toIntegralConstant
clang::APValue::setInt
clang::APValue::setComplexInt