13#ifndef LLVM_CLANG_AST_VTABLEBUILDER_H
14#define LLVM_CLANG_AST_VTABLEBUILDER_H
22#include "llvm/ADT/DenseMap.h"
72 assert(!isa<CXXDestructorDecl>(MD) &&
73 "Don't use MakeFunction with destructors!");
90 assert(!isa<CXXDestructorDecl>(MD) &&
91 "Don't use MakeUnusedFunction with destructors!");
120 assert(
isRTTIKind() &&
"Invalid component kind!");
155 "GlobalDecl can be created only from virtual function");
170 llvm_unreachable(
"Only function pointers kinds");
172 llvm_unreachable(
"Should already return");
189 return ComponentKind ==
CK_RTTI;
196 assert(Offset.getQuantity() < (1LL << 56) &&
"Offset is too big!");
197 assert(Offset.getQuantity() >= -(1LL << 56) &&
"Offset is too small!");
199 Value = (
uint64_t(Offset.getQuantity()) << 3) | ComponentKind;
204 "Invalid component kind!");
206 assert((Ptr & 7) == 0 &&
"Pointer not sufficiently aligned!");
208 Value = Ptr | ComponentKind;
211 CharUnits getOffset()
const {
220 "Invalid component kind!");
239 typedef llvm::DenseMap<BaseSubobject, AddressPointLocation>
273 return VTableComponents;
281 assert(AddressPoints.count(
Base) &&
"Did not find address point!");
282 return AddressPoints.lookup(
Base);
286 return AddressPoints;
290 return AddressPointIndices;
294 if (VTableIndices.empty())
296 return VTableIndices.size();
300 if (VTableIndices.empty()) {
304 return VTableIndices[i];
308 if (VTableIndices.empty()) {
313 size_t thisIndex = VTableIndices[i];
314 size_t nextIndex = (i + 1 == VTableIndices.size())
316 : VTableIndices[i + 1];
317 return nextIndex - thisIndex;
330 typedef llvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy>
ThunksMapTy;
348 ThunksMapTy::const_iterator I =
Thunks.find(MD);
365 typedef llvm::DenseMap<const CXXMethodDecl *, const CXXMethodDecl *>
372 typedef llvm::DenseMap<GlobalDecl, int64_t> MethodVTableIndicesTy;
373 MethodVTableIndicesTy MethodVTableIndices;
376 std::unique_ptr<const VTableLayout>>
378 VTableLayoutMapTy VTableLayouts;
387 typedef llvm::DenseMap<ClassPairTy, CharUnits>
388 VirtualBaseClassOffsetOffsetsMapTy;
389 VirtualBaseClassOffsetOffsetsMapTy VirtualBaseClassOffsetOffsets;
395 void computeVTableRelatedInformation(
const CXXRecordDecl *RD)
override;
412 computeVTableRelatedInformation(RD);
413 assert(VTableLayouts.count(RD) &&
"No layout for this record decl!");
415 return *VTableLayouts[RD];
420 bool MostDerivedClassIsVirtual,
const CXXRecordDecl *LayoutClass);
448 OriginalMethodMap[Key] = Val;
454 return OriginalMethodMap;
462 return ComponentLayout;
579 typedef llvm::DenseMap<GlobalDecl, MethodVFTableLocation>
580 MethodVFTableLocationsTy;
581 MethodVFTableLocationsTy MethodVFTableLocations;
583 typedef llvm::DenseMap<const CXXRecordDecl *, std::unique_ptr<VPtrInfoVector>>
585 VFPtrLocationsMapTy VFPtrLocations;
587 typedef std::pair<const CXXRecordDecl *, CharUnits> VFTableIdTy;
588 typedef llvm::DenseMap<VFTableIdTy, std::unique_ptr<const VTableLayout>>
590 VFTableLayoutMapTy VFTableLayouts;
592 llvm::DenseMap<const CXXRecordDecl *, std::unique_ptr<VirtualBaseInfo>>
595 void computeVTableRelatedInformation(
const CXXRecordDecl *RD)
override;
598 const MethodVFTableLocationsTy &NewMethods,
604 void computeVTablePaths(
bool ForVBTables,
const CXXRecordDecl *RD,
622 if (isa<CXXDestructorDecl>(GD.
getDecl()) &&
Enums/classes describing ABI related information about constructors, destructors and thunks.
Enums/classes describing THUNK related information about constructors, destructors and thunks.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a C++ destructor within a class.
Represents a static or instance method of a struct/union/class.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
Represents a C++ struct/union/class.
CharUnits - This is an opaque type for sizes expressed in character units.
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
GlobalDecl - represents a global declaration.