clang  7.0.0svn
VTableBuilder.h
Go to the documentation of this file.
1 //===--- VTableBuilder.h - C++ vtable layout builder --------------*- 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 contains code dealing with generation of the layout of virtual tables.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_AST_VTABLEBUILDER_H
15 #define LLVM_CLANG_AST_VTABLEBUILDER_H
16 
19 #include "clang/AST/GlobalDecl.h"
20 #include "clang/AST/RecordLayout.h"
21 #include "clang/Basic/ABI.h"
22 #include "llvm/ADT/DenseMap.h"
23 #include <memory>
24 #include <utility>
25 
26 namespace clang {
27  class CXXRecordDecl;
28 
29 /// Represents a single component in a vtable.
31 public:
32  enum Kind {
38 
39  /// A pointer to the complete destructor.
41 
42  /// A pointer to the deleting destructor.
44 
45  /// An entry that is never used.
46  ///
47  /// In some cases, a vtable function pointer will end up never being
48  /// called. Such vtable function pointers are represented as a
49  /// CK_UnusedFunctionPointer.
51  };
52 
53  VTableComponent() = default;
54 
56  return VTableComponent(CK_VCallOffset, Offset);
57  }
58 
60  return VTableComponent(CK_VBaseOffset, Offset);
61  }
62 
64  return VTableComponent(CK_OffsetToTop, Offset);
65  }
66 
68  return VTableComponent(CK_RTTI, reinterpret_cast<uintptr_t>(RD));
69  }
70 
72  assert(!isa<CXXDestructorDecl>(MD) &&
73  "Don't use MakeFunction with destructors!");
74 
76  reinterpret_cast<uintptr_t>(MD));
77  }
78 
81  reinterpret_cast<uintptr_t>(DD));
82  }
83 
86  reinterpret_cast<uintptr_t>(DD));
87  }
88 
90  assert(!isa<CXXDestructorDecl>(MD) &&
91  "Don't use MakeUnusedFunction with destructors!");
93  reinterpret_cast<uintptr_t>(MD));
94  }
95 
97  return VTableComponent(I);
98  }
99 
100  /// Get the kind of this vtable component.
101  Kind getKind() const {
102  return (Kind)(Value & 0x7);
103  }
104 
106  assert(getKind() == CK_VCallOffset && "Invalid component kind!");
107 
108  return getOffset();
109  }
110 
112  assert(getKind() == CK_VBaseOffset && "Invalid component kind!");
113 
114  return getOffset();
115  }
116 
118  assert(getKind() == CK_OffsetToTop && "Invalid component kind!");
119 
120  return getOffset();
121  }
122 
123  const CXXRecordDecl *getRTTIDecl() const {
124  assert(isRTTIKind() && "Invalid component kind!");
125  return reinterpret_cast<CXXRecordDecl *>(getPointer());
126  }
127 
129  assert(isFunctionPointerKind() && "Invalid component kind!");
130  if (isDestructorKind())
131  return getDestructorDecl();
132  return reinterpret_cast<CXXMethodDecl *>(getPointer());
133  }
134 
136  assert(isDestructorKind() && "Invalid component kind!");
137  return reinterpret_cast<CXXDestructorDecl *>(getPointer());
138  }
139 
141  assert(getKind() == CK_UnusedFunctionPointer && "Invalid component kind!");
142  return reinterpret_cast<CXXMethodDecl *>(getPointer());
143  }
144 
145  bool isDestructorKind() const { return isDestructorKind(getKind()); }
146 
149  }
150 
151  bool isFunctionPointerKind() const {
152  return isFunctionPointerKind(getKind());
153  }
154 
155  bool isRTTIKind() const { return isRTTIKind(getKind()); }
156 
158  assert(isUsedFunctionPointerKind() &&
159  "GlobalDecl can be created only from virtual function");
160 
161  auto *DtorDecl = dyn_cast<CXXDestructorDecl>(getFunctionDecl());
162  switch (getKind()) {
163  case CK_FunctionPointer:
164  return GlobalDecl(getFunctionDecl());
166  return GlobalDecl(DtorDecl, CXXDtorType::Dtor_Complete);
168  return GlobalDecl(DtorDecl, CXXDtorType::Dtor_Deleting);
169  case CK_VCallOffset:
170  case CK_VBaseOffset:
171  case CK_OffsetToTop:
172  case CK_RTTI:
174  llvm_unreachable("Only function pointers kinds");
175  }
176  llvm_unreachable("Should already return");
177  }
178 
179 private:
180  static bool isFunctionPointerKind(Kind ComponentKind) {
181  return isUsedFunctionPointerKind(ComponentKind) ||
182  ComponentKind == CK_UnusedFunctionPointer;
183  }
184  static bool isUsedFunctionPointerKind(Kind ComponentKind) {
185  return ComponentKind == CK_FunctionPointer ||
186  isDestructorKind(ComponentKind);
187  }
188  static bool isDestructorKind(Kind ComponentKind) {
189  return ComponentKind == CK_CompleteDtorPointer ||
190  ComponentKind == CK_DeletingDtorPointer;
191  }
192  static bool isRTTIKind(Kind ComponentKind) {
193  return ComponentKind == CK_RTTI;
194  }
195 
196  VTableComponent(Kind ComponentKind, CharUnits Offset) {
197  assert((ComponentKind == CK_VCallOffset ||
198  ComponentKind == CK_VBaseOffset ||
199  ComponentKind == CK_OffsetToTop) && "Invalid component kind!");
200  assert(Offset.getQuantity() < (1LL << 56) && "Offset is too big!");
201  assert(Offset.getQuantity() >= -(1LL << 56) && "Offset is too small!");
202 
203  Value = (uint64_t(Offset.getQuantity()) << 3) | ComponentKind;
204  }
205 
206  VTableComponent(Kind ComponentKind, uintptr_t Ptr) {
207  assert((isRTTIKind(ComponentKind) || isFunctionPointerKind(ComponentKind)) &&
208  "Invalid component kind!");
209 
210  assert((Ptr & 7) == 0 && "Pointer not sufficiently aligned!");
211 
212  Value = Ptr | ComponentKind;
213  }
214 
215  CharUnits getOffset() const {
216  assert((getKind() == CK_VCallOffset || getKind() == CK_VBaseOffset ||
217  getKind() == CK_OffsetToTop) && "Invalid component kind!");
218 
219  return CharUnits::fromQuantity(Value >> 3);
220  }
221 
222  uintptr_t getPointer() const {
223  assert((getKind() == CK_RTTI || isFunctionPointerKind()) &&
224  "Invalid component kind!");
225 
226  return static_cast<uintptr_t>(Value & ~7ULL);
227  }
228 
229  explicit VTableComponent(uint64_t Value)
230  : Value(Value) { }
231 
232  /// The kind is stored in the lower 3 bits of the value. For offsets, we
233  /// make use of the facts that classes can't be larger than 2^55 bytes,
234  /// so we store the offset in the lower part of the 61 bits that remain.
235  /// (The reason that we're not simply using a PointerIntPair here is that we
236  /// need the offsets to be 64-bit, even when on a 32-bit machine).
237  int64_t Value;
238 };
239 
241 public:
242  typedef std::pair<uint64_t, ThunkInfo> VTableThunkTy;
244  unsigned VTableIndex, AddressPointIndex;
245  };
246  typedef llvm::DenseMap<BaseSubobject, AddressPointLocation>
248 
249 private:
250  // Stores the component indices of the first component of each virtual table in
251  // the virtual table group. To save a little memory in the common case where
252  // the vtable group contains a single vtable, an empty vector here represents
253  // the vector {0}.
254  OwningArrayRef<size_t> VTableIndices;
255 
256  OwningArrayRef<VTableComponent> VTableComponents;
257 
258  /// Contains thunks needed by vtables, sorted by indices.
259  OwningArrayRef<VTableThunkTy> VTableThunks;
260 
261  /// Address points for all vtables.
262  AddressPointsMapTy AddressPoints;
263 
264 public:
265  VTableLayout(ArrayRef<size_t> VTableIndices,
266  ArrayRef<VTableComponent> VTableComponents,
267  ArrayRef<VTableThunkTy> VTableThunks,
268  const AddressPointsMapTy &AddressPoints);
269  ~VTableLayout();
270 
272  return VTableComponents;
273  }
274 
276  return VTableThunks;
277  }
278 
280  assert(AddressPoints.count(Base) && "Did not find address point!");
281  return AddressPoints.find(Base)->second;
282  }
283 
285  return AddressPoints;
286  }
287 
288  size_t getNumVTables() const {
289  if (VTableIndices.empty())
290  return 1;
291  return VTableIndices.size();
292  }
293 
294  size_t getVTableOffset(size_t i) const {
295  if (VTableIndices.empty()) {
296  assert(i == 0);
297  return 0;
298  }
299  return VTableIndices[i];
300  }
301 
302  size_t getVTableSize(size_t i) const {
303  if (VTableIndices.empty()) {
304  assert(i == 0);
305  return vtable_components().size();
306  }
307 
308  size_t thisIndex = VTableIndices[i];
309  size_t nextIndex = (i + 1 == VTableIndices.size())
310  ? vtable_components().size()
311  : VTableIndices[i + 1];
312  return nextIndex - thisIndex;
313  }
314 };
315 
317 public:
319 
320  bool isMicrosoft() const { return IsMicrosoftABI; }
321 
322  virtual ~VTableContextBase() {}
323 
324 protected:
325  typedef llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy> ThunksMapTy;
326 
327  /// Contains all thunks that a given method decl will need.
328  ThunksMapTy Thunks;
329 
330  /// Compute and store all vtable related information (vtable layout, vbase
331  /// offset offsets, thunks etc) for the given record decl.
332  virtual void computeVTableRelatedInformation(const CXXRecordDecl *RD) = 0;
333 
334  VTableContextBase(bool MS) : IsMicrosoftABI(MS) {}
335 
336 public:
337  virtual const ThunkInfoVectorTy *getThunkInfo(GlobalDecl GD) {
338  const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl()->getCanonicalDecl());
339  computeVTableRelatedInformation(MD->getParent());
340 
341  // This assumes that all the destructors present in the vtable
342  // use exactly the same set of thunks.
343  ThunksMapTy::const_iterator I = Thunks.find(MD);
344  if (I == Thunks.end()) {
345  // We did not find a thunk for this method.
346  return nullptr;
347  }
348 
349  return &I->second;
350  }
351 
353 };
354 
356 private:
357 
358  /// Contains the index (relative to the vtable address point)
359  /// where the function pointer for a virtual function is stored.
360  typedef llvm::DenseMap<GlobalDecl, int64_t> MethodVTableIndicesTy;
361  MethodVTableIndicesTy MethodVTableIndices;
362 
363  typedef llvm::DenseMap<const CXXRecordDecl *,
364  std::unique_ptr<const VTableLayout>>
365  VTableLayoutMapTy;
366  VTableLayoutMapTy VTableLayouts;
367 
368  typedef std::pair<const CXXRecordDecl *,
369  const CXXRecordDecl *> ClassPairTy;
370 
371  /// vtable offsets for offsets of virtual bases of a class.
372  ///
373  /// Contains the vtable offset (relative to the address point) in chars
374  /// where the offsets for virtual bases of a class are stored.
375  typedef llvm::DenseMap<ClassPairTy, CharUnits>
376  VirtualBaseClassOffsetOffsetsMapTy;
377  VirtualBaseClassOffsetOffsetsMapTy VirtualBaseClassOffsetOffsets;
378 
379  void computeVTableRelatedInformation(const CXXRecordDecl *RD) override;
380 
381 public:
383  ~ItaniumVTableContext() override;
384 
385  const VTableLayout &getVTableLayout(const CXXRecordDecl *RD) {
386  computeVTableRelatedInformation(RD);
387  assert(VTableLayouts.count(RD) && "No layout for this record decl!");
388 
389  return *VTableLayouts[RD];
390  }
391 
392  std::unique_ptr<VTableLayout> createConstructionVTableLayout(
393  const CXXRecordDecl *MostDerivedClass, CharUnits MostDerivedClassOffset,
394  bool MostDerivedClassIsVirtual, const CXXRecordDecl *LayoutClass);
395 
396  /// Locate a virtual function in the vtable.
397  ///
398  /// Return the index (relative to the vtable address point) where the
399  /// function pointer for the given virtual function is stored.
400  uint64_t getMethodVTableIndex(GlobalDecl GD);
401 
402  /// Return the offset in chars (relative to the vtable address point) where
403  /// the offset of the virtual base that contains the given base is stored,
404  /// otherwise, if no virtual base contains the given class, return 0.
405  ///
406  /// Base must be a virtual base class or an unambiguous base.
407  CharUnits getVirtualBaseOffsetOffset(const CXXRecordDecl *RD,
408  const CXXRecordDecl *VBase);
409 
410  static bool classof(const VTableContextBase *VT) {
411  return !VT->isMicrosoft();
412  }
413 };
414 
415 /// Holds information about the inheritance path to a virtual base or function
416 /// table pointer. A record may contain as many vfptrs or vbptrs as there are
417 /// base subobjects.
418 struct VPtrInfo {
420 
422  : ObjectWithVPtr(RD), IntroducingObject(RD), NextBaseToMangle(RD) {}
423 
424  /// This is the most derived class that has this vptr at offset zero. When
425  /// single inheritance is used, this is always the most derived class. If
426  /// multiple inheritance is used, it may be any direct or indirect base.
428 
429  /// This is the class that introduced the vptr by declaring new virtual
430  /// methods or virtual bases.
432 
433  /// IntroducingObject is at this offset from its containing complete object or
434  /// virtual base.
436 
437  /// The bases from the inheritance path that got used to mangle the vbtable
438  /// name. This is not really a full path like a CXXBasePath. It holds the
439  /// subset of records that need to be mangled into the vbtable symbol name in
440  /// order to get a unique name.
441  BasePath MangledPath;
442 
443  /// The next base to push onto the mangled path if this path is ambiguous in a
444  /// derived class. If it's null, then it's already been pushed onto the path.
446 
447  /// The set of possibly indirect vbases that contain this vbtable. When a
448  /// derived class indirectly inherits from the same vbase twice, we only keep
449  /// vtables and their paths from the first instance.
451 
452  /// This holds the base classes path from the complete type to the first base
453  /// with the given vfptr offset, in the base-to-derived order. Only used for
454  /// vftables.
456 
457  /// Static offset from the top of the most derived class to this vfptr,
458  /// including any virtual base offset. Only used for vftables.
460 
461  /// The vptr is stored inside the non-virtual component of this virtual base.
463  return ContainingVBases.empty() ? nullptr : ContainingVBases.front();
464  }
465 };
466 
468 
469 /// All virtual base related information about a given record decl. Includes
470 /// information on all virtual base tables and the path components that are used
471 /// to mangle them.
473  /// A map from virtual base to vbtable index for doing a conversion from the
474  /// the derived class to the a base.
475  llvm::DenseMap<const CXXRecordDecl *, unsigned> VBTableIndices;
476 
477  /// Information on all virtual base tables used when this record is the most
478  /// derived class.
479  VPtrInfoVector VBPtrPaths;
480 };
481 
483  /// If nonzero, holds the vbtable index of the virtual base with the vfptr.
484  uint64_t VBTableIndex;
485 
486  /// If nonnull, holds the last vbase which contains the vfptr that the
487  /// method definition is adjusted to.
489 
490  /// This is the offset of the vfptr from the start of the last vbase, or the
491  /// complete type if there are no virtual bases.
493 
494  /// Method's index in the vftable.
495  uint64_t Index;
496 
498  : VBTableIndex(0), VBase(nullptr), VFPtrOffset(CharUnits::Zero()),
499  Index(0) {}
500 
501  MethodVFTableLocation(uint64_t VBTableIndex, const CXXRecordDecl *VBase,
502  CharUnits VFPtrOffset, uint64_t Index)
503  : VBTableIndex(VBTableIndex), VBase(VBase), VFPtrOffset(VFPtrOffset),
504  Index(Index) {}
505 
506  bool operator<(const MethodVFTableLocation &other) const {
507  if (VBTableIndex != other.VBTableIndex) {
508  assert(VBase != other.VBase);
509  return VBTableIndex < other.VBTableIndex;
510  }
511  return std::tie(VFPtrOffset, Index) <
512  std::tie(other.VFPtrOffset, other.Index);
513  }
514 };
515 
517 public:
518 
519 private:
520  ASTContext &Context;
521 
522  typedef llvm::DenseMap<GlobalDecl, MethodVFTableLocation>
523  MethodVFTableLocationsTy;
524  MethodVFTableLocationsTy MethodVFTableLocations;
525 
526  typedef llvm::DenseMap<const CXXRecordDecl *, std::unique_ptr<VPtrInfoVector>>
527  VFPtrLocationsMapTy;
528  VFPtrLocationsMapTy VFPtrLocations;
529 
530  typedef std::pair<const CXXRecordDecl *, CharUnits> VFTableIdTy;
531  typedef llvm::DenseMap<VFTableIdTy, std::unique_ptr<const VTableLayout>>
532  VFTableLayoutMapTy;
533  VFTableLayoutMapTy VFTableLayouts;
534 
535  llvm::DenseMap<const CXXRecordDecl *, std::unique_ptr<VirtualBaseInfo>>
536  VBaseInfo;
537 
538  void enumerateVFPtrs(const CXXRecordDecl *ForClass, VPtrInfoVector &Result);
539 
540  void computeVTableRelatedInformation(const CXXRecordDecl *RD) override;
541 
542  void dumpMethodLocations(const CXXRecordDecl *RD,
543  const MethodVFTableLocationsTy &NewMethods,
544  raw_ostream &);
545 
546  const VirtualBaseInfo &
547  computeVBTableRelatedInformation(const CXXRecordDecl *RD);
548 
549  void computeVTablePaths(bool ForVBTables, const CXXRecordDecl *RD,
550  VPtrInfoVector &Paths);
551 
552 public:
554  : VTableContextBase(/*MS=*/true), Context(Context) {}
555 
556  ~MicrosoftVTableContext() override;
557 
558  const VPtrInfoVector &getVFPtrOffsets(const CXXRecordDecl *RD);
559 
560  const VTableLayout &getVFTableLayout(const CXXRecordDecl *RD,
561  CharUnits VFPtrOffset);
562 
563  MethodVFTableLocation getMethodVFTableLocation(GlobalDecl GD);
564 
566  // Complete destructors don't have a slot in a vftable, so no thunks needed.
567  if (isa<CXXDestructorDecl>(GD.getDecl()) &&
568  GD.getDtorType() == Dtor_Complete)
569  return nullptr;
571  }
572 
573  /// Returns the index of VBase in the vbtable of Derived.
574  /// VBase must be a morally virtual base of Derived.
575  /// The vbtable is an array of i32 offsets. The first entry is a self entry,
576  /// and the rest are offsets from the vbptr to virtual bases.
577  unsigned getVBTableIndex(const CXXRecordDecl *Derived,
578  const CXXRecordDecl *VBase);
579 
580  const VPtrInfoVector &enumerateVBTables(const CXXRecordDecl *RD);
581 
582  static bool classof(const VTableContextBase *VT) { return VT->isMicrosoft(); }
583 };
584 
585 } // namespace clang
586 
587 #endif
size_t getNumVTables() const
bool isFunctionPointerKind() const
const AddressPointsMapTy & getAddressPoints() const
CXXDtorType getDtorType() const
Definition: GlobalDecl.h:71
static VTableComponent MakeRTTI(const CXXRecordDecl *RD)
Definition: VTableBuilder.h:67
const CXXMethodDecl * getFunctionDecl() const
VPtrInfoVector VBPtrPaths
Information on all virtual base tables used when this record is the most derived class.
virtual const ThunkInfoVectorTy * getThunkInfo(GlobalDecl GD)
CharUnits VFPtrOffset
This is the offset of the vfptr from the start of the last vbase, or the complete type if there are n...
AddressPointLocation getAddressPoint(BaseSubobject Base) const
bool isUsedFunctionPointerKind() const
BasePath MangledPath
The bases from the inheritance path that got used to mangle the vbtable name.
static VTableComponent MakeUnusedFunction(const CXXMethodDecl *MD)
Definition: VTableBuilder.h:89
const CXXMethodDecl * getUnusedFunctionDecl() const
const CXXRecordDecl * VBase
If nonnull, holds the last vbase which contains the vfptr that the method definition is adjusted to...
static VTableComponent getFromOpaqueInteger(uint64_t I)
Definition: VTableBuilder.h:96
static VTableComponent MakeVCallOffset(CharUnits Offset)
Definition: VTableBuilder.h:55
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:150
static VTableComponent MakeCompleteDtor(const CXXDestructorDecl *DD)
Definition: VTableBuilder.h:79
llvm::DenseMap< const CXXRecordDecl *, unsigned > VBTableIndices
A map from virtual base to vbtable index for doing a conversion from the the derived class to the a b...
const CXXRecordDecl * NextBaseToMangle
The next base to push onto the mangled path if this path is ambiguous in a derived class...
ArrayRef< VTableComponent > vtable_components() const
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
llvm::DenseMap< const CXXMethodDecl *, ThunkInfoVectorTy > ThunksMapTy
uint32_t Offset
Definition: CacheTokens.cpp:43
const CXXRecordDecl * IntroducingObject
This is the class that introduced the vptr by declaring new virtual methods or virtual bases...
Deleting dtor.
Definition: ABI.h:35
SmallVector< std::unique_ptr< VPtrInfo >, 2 > VPtrInfoVector
Enums/classes describing ABI related information about constructors, destructors and thunks...
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:875
static VTableComponent MakeDeletingDtor(const CXXDestructorDecl *DD)
Definition: VTableBuilder.h:84
BasePath ContainingVBases
The set of possibly indirect vbases that contain this vbtable.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Definition: CharUnits.h:179
SmallVector< ThunkInfo, 1 > ThunkInfoVectorTy
static bool classof(const VTableContextBase *VT)
Kind getKind() const
Get the kind of this vtable component.
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2671
CharUnits getOffsetToTop() const
CharUnits getVCallOffset() const
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Definition: CharUnits.h:63
bool isDestructorKind() const
const CXXDestructorDecl * getDestructorDecl() const
MethodVFTableLocation(uint64_t VBTableIndex, const CXXRecordDecl *VBase, CharUnits VFPtrOffset, uint64_t Index)
The result type of a method or function.
SmallVector< const CXXRecordDecl *, 1 > BasePath
const ThunkInfoVectorTy * getThunkInfo(GlobalDecl GD) override
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Definition: opencl-c.h:82
GlobalDecl - represents a global declaration.
Definition: GlobalDecl.h:35
ArrayRef< VTableThunkTy > vtable_thunks() const
uint64_t VBTableIndex
If nonzero, holds the vbtable index of the virtual base with the vfptr.
bool operator<(const MethodVFTableLocation &other) const
const Decl * getDecl() const
Definition: GlobalDecl.h:64
Represents a single component in a vtable.
Definition: VTableBuilder.h:30
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2016
const CXXRecordDecl * ObjectWithVPtr
This is the most derived class that has this vptr at offset zero.
Complete object dtor.
Definition: ABI.h:36
MicrosoftVTableContext(ASTContext &Context)
const CXXRecordDecl * getRTTIDecl() const
static VTableComponent MakeVBaseOffset(CharUnits Offset)
Definition: VTableBuilder.h:59
Dataflow Directional Tag Classes.
uint64_t Index
Method&#39;s index in the vftable.
ThunksMapTy Thunks
Contains all thunks that a given method decl will need.
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
Definition: DeclCXX.h:2136
VPtrInfo(const CXXRecordDecl *RD)
CharUnits NonVirtualOffset
IntroducingObject is at this offset from its containing complete object or virtual base...
All virtual base related information about a given record decl.
const CXXRecordDecl * getVBaseWithVPtr() const
The vptr is stored inside the non-virtual component of this virtual base.
const VTableLayout & getVTableLayout(const CXXRecordDecl *RD)
llvm::DenseMap< BaseSubobject, AddressPointLocation > AddressPointsMapTy
Represents a C++ struct/union/class.
Definition: DeclCXX.h:300
size_t getVTableSize(size_t i) const
std::pair< uint64_t, ThunkInfo > VTableThunkTy
CharUnits FullOffsetInMDC
Static offset from the top of the most derived class to this vfptr, including any virtual base offset...
A pointer to the deleting destructor.
Definition: VTableBuilder.h:43
static VTableComponent MakeFunction(const CXXMethodDecl *MD)
Definition: VTableBuilder.h:71
Holds information about the inheritance path to a virtual base or function table pointer.
GlobalDecl getGlobalDecl() const
#define true
Definition: stdbool.h:32
CharUnits getVBaseOffset() const
BasePath PathToIntroducingObject
This holds the base classes path from the complete type to the first base with the given vfptr offset...
A pointer to the complete destructor.
Definition: VTableBuilder.h:40
size_t getVTableOffset(size_t i) const
static bool classof(const VTableContextBase *VT)
static VTableComponent MakeOffsetToTop(CharUnits Offset)
Definition: VTableBuilder.h:63