assert(!isa<CXXDestructorDecl>(MD) &&
73 "Don't use MakeFunction with destructors!");
90assert(!isa<CXXDestructorDecl>(MD) &&
91 "Don't use MakeUnusedFunction with destructors!");
120assert(
isRTTIKind() &&
"Invalid component kind!");
155 "GlobalDecl can be created only from virtual function");
170llvm_unreachable(
"Only function pointers kinds");
172llvm_unreachable(
"Should already return");
189 returnComponentKind ==
CK_RTTI;
196assert(Offset.getQuantity() < (1LL << 56) &&
"Offset is too big!");
197assert(Offset.getQuantity() >= -(1LL << 56) &&
"Offset is too small!");
199 Value= (
uint64_t(Offset.getQuantity()) << 3) | ComponentKind;
204 "Invalid component kind!");
206assert((Ptr & 7) == 0 &&
"Pointer not sufficiently aligned!");
208 Value= Ptr | ComponentKind;
211CharUnits getOffset()
const{
220 "Invalid component kind!");
239 typedefllvm::DenseMap<BaseSubobject, AddressPointLocation>
273 returnVTableComponents;
281assert(AddressPoints.count(
Base) &&
"Did not find address point!");
282 returnAddressPoints.lookup(
Base);
286 returnAddressPoints;
290 returnAddressPointIndices;
294 if(VTableIndices.empty())
296 returnVTableIndices.size();
300 if(VTableIndices.empty()) {
304 returnVTableIndices[i];
308 if(VTableIndices.empty()) {
313 size_tthisIndex = VTableIndices[i];
314 size_tnextIndex = (i + 1 == VTableIndices.size())
316: VTableIndices[i + 1];
317 returnnextIndex - thisIndex;
330 typedefllvm::DenseMap<const CXXMethodDecl *, ThunkInfoVectorTy>
ThunksMapTy;
348ThunksMapTy::const_iterator I =
Thunks.find(MD);
365 typedefllvm::DenseMap<const CXXMethodDecl *, const CXXMethodDecl *>
372 typedefllvm::DenseMap<GlobalDecl, int64_t> MethodVTableIndicesTy;
373MethodVTableIndicesTy MethodVTableIndices;
376std::unique_ptr<const VTableLayout>>
378VTableLayoutMapTy VTableLayouts;
387 typedefllvm::DenseMap<ClassPairTy, CharUnits>
388VirtualBaseClassOffsetOffsetsMapTy;
389VirtualBaseClassOffsetOffsetsMapTy VirtualBaseClassOffsetOffsets;
395 voidcomputeVTableRelatedInformation(
const CXXRecordDecl*RD)
override;
412computeVTableRelatedInformation(RD);
413assert(VTableLayouts.count(RD) &&
"No layout for this record decl!");
415 return*VTableLayouts[RD];
420 boolMostDerivedClassIsVirtual,
const CXXRecordDecl*LayoutClass);
448OriginalMethodMap[Key] = Val;
454 returnOriginalMethodMap;
462 returnComponentLayout;
579 typedefllvm::DenseMap<GlobalDecl, MethodVFTableLocation>
580MethodVFTableLocationsTy;
581MethodVFTableLocationsTy MethodVFTableLocations;
583 typedefllvm::DenseMap<const CXXRecordDecl *, std::unique_ptr<VPtrInfoVector>>
585VFPtrLocationsMapTy VFPtrLocations;
587 typedefstd::pair<const CXXRecordDecl *, CharUnits> VFTableIdTy;
588 typedefllvm::DenseMap<VFTableIdTy, std::unique_ptr<const VTableLayout>>
590VFTableLayoutMapTy VFTableLayouts;
592llvm::DenseMap<const CXXRecordDecl *, std::unique_ptr<VirtualBaseInfo>>
595 voidcomputeVTableRelatedInformation(
const CXXRecordDecl*RD)
override;
598 constMethodVFTableLocationsTy &NewMethods,
604 voidcomputeVTablePaths(
boolForVBTables,
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.
CXXDtorType getDtorType() const
const Decl * getDecl() const
@ Relative
Components in the vtable are relative offsets between the vtable and the other structs/functions.
@ Pointer
Components in the vtable are pointers to other structs/functions.
bool isPointerLayout() const
const CXXMethodDecl * findOriginalMethodInMap(const CXXMethodDecl *MD) const
const OriginalMethodMapTy & getOriginalMethodMap()
This method is reserved for the implementation and shouldn't be used directly.
VTableComponentLayout getVTableComponentLayout() const
uint64_t getMethodVTableIndex(GlobalDecl GD)
Locate a virtual function in the vtable.
llvm::DenseMap< const CXXMethodDecl *, const CXXMethodDecl * > OriginalMethodMapTy
bool isRelativeLayout() const
std::unique_ptr< VTableLayout > createConstructionVTableLayout(const CXXRecordDecl *MostDerivedClass, CharUnits MostDerivedClassOffset, bool MostDerivedClassIsVirtual, const CXXRecordDecl *LayoutClass)
~ItaniumVTableContext() override
const VTableLayout & getVTableLayout(const CXXRecordDecl *RD)
CharUnits getVirtualBaseOffsetOffset(const CXXRecordDecl *RD, const CXXRecordDecl *VBase)
Return the offset in chars (relative to the vtable address point) where the offset of the virtual bas...
GlobalDecl findOriginalMethod(GlobalDecl GD)
Return the method that added the v-table slot that will be used to call the given method.
void setOriginalMethod(const CXXMethodDecl *Key, const CXXMethodDecl *Val)
static bool classof(const VTableContextBase *VT)
static bool classof(const VTableContextBase *VT)
const ThunkInfoVectorTy * getThunkInfo(GlobalDecl GD) override
MicrosoftVTableContext(ASTContext &Context)
unsigned getVBTableIndex(const CXXRecordDecl *Derived, const CXXRecordDecl *VBase)
Returns the index of VBase in the vbtable of Derived.
const VPtrInfoVector & enumerateVBTables(const CXXRecordDecl *RD)
MethodVFTableLocation getMethodVFTableLocation(GlobalDecl GD)
const VPtrInfoVector & getVFPtrOffsets(const CXXRecordDecl *RD)
const VTableLayout & getVFTableLayout(const CXXRecordDecl *RD, CharUnits VFPtrOffset)
~MicrosoftVTableContext() override
Represents a single component in a vtable.
VTableComponent()=default
static VTableComponent MakeCompleteDtor(const CXXDestructorDecl *DD)
static VTableComponent MakeRTTI(const CXXRecordDecl *RD)
GlobalDecl getGlobalDecl() const
const CXXMethodDecl * getUnusedFunctionDecl() const
static VTableComponent MakeOffsetToTop(CharUnits Offset)
bool isUsedFunctionPointerKind() const
bool isDestructorKind() const
CharUnits getVBaseOffset() const
static VTableComponent MakeUnusedFunction(const CXXMethodDecl *MD)
Kind getKind() const
Get the kind of this vtable component.
static VTableComponent MakeFunction(const CXXMethodDecl *MD)
@ CK_DeletingDtorPointer
A pointer to the deleting destructor.
@ CK_UnusedFunctionPointer
An entry that is never used.
@ CK_CompleteDtorPointer
A pointer to the complete destructor.
static VTableComponent MakeVBaseOffset(CharUnits Offset)
const CXXRecordDecl * getRTTIDecl() const
static VTableComponent MakeDeletingDtor(const CXXDestructorDecl *DD)
bool isFunctionPointerKind() const
CharUnits getOffsetToTop() const
const CXXMethodDecl * getFunctionDecl() const
static VTableComponent MakeVCallOffset(CharUnits Offset)
CharUnits getVCallOffset() const
const CXXDestructorDecl * getDestructorDecl() const
virtual const ThunkInfoVectorTy * getThunkInfo(GlobalDecl GD)
VTableContextBase(bool MS)
static bool hasVtableSlot(const CXXMethodDecl *MD)
Determine whether this function should be assigned a vtable slot.
virtual ~VTableContextBase()
virtual void computeVTableRelatedInformation(const CXXRecordDecl *RD)=0
Compute and store all vtable related information (vtable layout, vbase offset offsets,...
SmallVector< ThunkInfo, 1 > ThunkInfoVectorTy
llvm::DenseMap< const CXXMethodDecl *, ThunkInfoVectorTy > ThunksMapTy
ThunksMapTy Thunks
Contains all thunks that a given method decl will need.
const AddressPointsIndexMapTy & getAddressPointIndices() const
size_t getVTableOffset(size_t i) const
llvm::SmallVector< unsigned, 4 > AddressPointsIndexMapTy
llvm::DenseMap< BaseSubobject, AddressPointLocation > AddressPointsMapTy
AddressPointLocation getAddressPoint(BaseSubobject Base) const
std::pair< uint64_t, ThunkInfo > VTableThunkTy
ArrayRef< VTableComponent > vtable_components() const
size_t getNumVTables() const
ArrayRef< VTableThunkTy > vtable_thunks() const
const AddressPointsMapTy & getAddressPoints() const
size_t getVTableSize(size_t i) const
The JSON file list parser is used to communicate input to InstallAPI.
SmallVector< std::unique_ptr< VPtrInfo >, 2 > VPtrInfoVector
@ Dtor_Complete
Complete object dtor.
@ Dtor_Deleting
Deleting dtor.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
bool operator<(const MethodVFTableLocation &other) const
const CXXRecordDecl * VBase
If nonnull, holds the last vbase which contains the vfptr that the method definition is adjusted to.
MethodVFTableLocation(uint64_t VBTableIndex, const CXXRecordDecl *VBase, CharUnits VFPtrOffset, uint64_t Index)
CharUnits VFPtrOffset
This is the offset of the vfptr from the start of the last vbase, or the complete type if there are n...
uint64_t VBTableIndex
If nonzero, holds the vbtable index of the virtual base with the vfptr.
uint64_t Index
Method's index in the vftable.
Holds information about the inheritance path to a virtual base or function table pointer.
CharUnits NonVirtualOffset
IntroducingObject is at this offset from its containing complete object or virtual base.
CharUnits FullOffsetInMDC
Static offset from the top of the most derived class to this vfptr, including any virtual base offset...
const CXXRecordDecl * getVBaseWithVPtr() const
The vptr is stored inside the non-virtual component of this virtual base.
SmallVector< const CXXRecordDecl *, 1 > BasePath
VPtrInfo(const CXXRecordDecl *RD)
BasePath ContainingVBases
The set of possibly indirect vbases that contain this vbtable.
const CXXRecordDecl * IntroducingObject
This is the class that introduced the vptr by declaring new virtual methods or virtual bases.
BasePath MangledPath
The bases from the inheritance path that got used to mangle the vbtable name.
const CXXRecordDecl * NextBaseToMangle
The next base to push onto the mangled path if this path is ambiguous in a derived class.
BasePath PathToIntroducingObject
This holds the base classes path from the complete type to the first base with the given vfptr offset...
const CXXRecordDecl * ObjectWithVPtr
This is the most derived class that has this vptr at offset zero.
unsigned AddressPointIndex
All virtual base related information about a given record decl.
VPtrInfoVector VBPtrPaths
Information on all virtual base tables used when this record is the most derived class.
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...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4