clang 20.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
clang::ItaniumVTableContext Class Reference

#include "clang/AST/VTableBuilder.h"

Inheritance diagram for clang::ItaniumVTableContext:
Inheritance graph
[legend]

Public Types

enum  VTableComponentLayout { Pointer , Relative }
 
typedef llvm::DenseMap< const CXXMethodDecl *, const CXXMethodDecl * > OriginalMethodMapTy
 
- Public Types inherited from clang::VTableContextBase
typedef SmallVector< ThunkInfo, 1 > ThunkInfoVectorTy
 

Public Member Functions

 ItaniumVTableContext (ASTContext &Context, VTableComponentLayout ComponentLayout=Pointer)
 
 ~ItaniumVTableContext () override
 
const VTableLayoutgetVTableLayout (const CXXRecordDecl *RD)
 
std::unique_ptr< VTableLayoutcreateConstructionVTableLayout (const CXXRecordDecl *MostDerivedClass, CharUnits MostDerivedClassOffset, bool MostDerivedClassIsVirtual, const CXXRecordDecl *LayoutClass)
 
uint64_t getMethodVTableIndex (GlobalDecl GD)
 Locate a virtual function in the vtable.
 
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 base that contains the given base is stored, otherwise, if no virtual base contains the given class, return 0.
 
GlobalDecl findOriginalMethod (GlobalDecl GD)
 Return the method that added the v-table slot that will be used to call the given method.
 
const CXXMethodDeclfindOriginalMethodInMap (const CXXMethodDecl *MD) const
 
void setOriginalMethod (const CXXMethodDecl *Key, const CXXMethodDecl *Val)
 
const OriginalMethodMapTygetOriginalMethodMap ()
 This method is reserved for the implementation and shouldn't be used directly.
 
VTableComponentLayout getVTableComponentLayout () const
 
bool isPointerLayout () const
 
bool isRelativeLayout () const
 
- Public Member Functions inherited from clang::VTableContextBase
bool isMicrosoft () const
 
virtual ~VTableContextBase ()
 
virtual const ThunkInfoVectorTygetThunkInfo (GlobalDecl GD)
 

Static Public Member Functions

static bool classof (const VTableContextBase *VT)
 
- Static Public Member Functions inherited from clang::VTableContextBase
static bool hasVtableSlot (const CXXMethodDecl *MD)
 Determine whether this function should be assigned a vtable slot.
 

Additional Inherited Members

- Public Attributes inherited from clang::VTableContextBase
bool IsMicrosoftABI
 
- Protected Types inherited from clang::VTableContextBase
typedef llvm::DenseMap< const CXXMethodDecl *, ThunkInfoVectorTyThunksMapTy
 
- Protected Member Functions inherited from clang::VTableContextBase
virtual void computeVTableRelatedInformation (const CXXRecordDecl *RD)=0
 Compute and store all vtable related information (vtable layout, vbase offset offsets, thunks etc) for the given record decl.
 
 VTableContextBase (bool MS)
 
- Protected Attributes inherited from clang::VTableContextBase
ThunksMapTy Thunks
 Contains all thunks that a given method decl will need.
 

Detailed Description

Definition at line 363 of file VTableBuilder.h.

Member Typedef Documentation

◆ OriginalMethodMapTy

Definition at line 366 of file VTableBuilder.h.

Member Enumeration Documentation

◆ VTableComponentLayout

Enumerator
Pointer 

Components in the vtable are pointers to other structs/functions.

Relative 

Components in the vtable are relative offsets between the vtable and the other structs/functions.

Definition at line 398 of file VTableBuilder.h.

Constructor & Destructor Documentation

◆ ItaniumVTableContext()

ItaniumVTableContext::ItaniumVTableContext ( ASTContext Context,
VTableComponentLayout  ComponentLayout = Pointer 
)

Definition at line 2332 of file VTableBuilder.cpp.

◆ ~ItaniumVTableContext()

ItaniumVTableContext::~ItaniumVTableContext ( )
override

Definition at line 2336 of file VTableBuilder.cpp.

Member Function Documentation

◆ classof()

static bool clang::ItaniumVTableContext::classof ( const VTableContextBase VT)
inlinestatic

Definition at line 457 of file VTableBuilder.h.

References clang::VTableContextBase::isMicrosoft().

◆ createConstructionVTableLayout()

std::unique_ptr< VTableLayout > ItaniumVTableContext::createConstructionVTableLayout ( const CXXRecordDecl MostDerivedClass,
CharUnits  MostDerivedClassOffset,
bool  MostDerivedClassIsVirtual,
const CXXRecordDecl LayoutClass 
)

Definition at line 2459 of file VTableBuilder.cpp.

References CreateVTableLayout().

◆ findOriginalMethod()

GlobalDecl ItaniumVTableContext::findOriginalMethod ( GlobalDecl  GD)

Return the method that added the v-table slot that will be used to call the given method.

In the Itanium ABI, where overrides always cause methods to be added to the primary v-table if they're not already there, this will be the first declaration in the primary base class chain for which the return type adjustment is trivial.

Definition at line 2381 of file VTableBuilder.cpp.

References findOriginalMethodInMap(), clang::GlobalDecl::getDecl(), and clang::GlobalDecl::getDtorType().

Referenced by BuildAppleKextVirtualCall().

◆ findOriginalMethodInMap()

const CXXMethodDecl * ItaniumVTableContext::findOriginalMethodInMap ( const CXXMethodDecl MD) const

Definition at line 2392 of file VTableBuilder.cpp.

Referenced by findOriginalMethod().

◆ getMethodVTableIndex()

uint64_t ItaniumVTableContext::getMethodVTableIndex ( GlobalDecl  GD)

Locate a virtual function in the vtable.

Return the index (relative to the vtable address point) where the function pointer for the given virtual function is stored.

Definition at line 2338 of file VTableBuilder.cpp.

References clang::GlobalDecl::getCanonicalDecl(), clang::GlobalDecl::getDecl(), and clang::DeclContext::getParent().

Referenced by BuildAppleKextVirtualCall().

◆ getOriginalMethodMap()

const OriginalMethodMapTy & clang::ItaniumVTableContext::getOriginalMethodMap ( )
inline

This method is reserved for the implementation and shouldn't be used directly.

Definition at line 453 of file VTableBuilder.h.

◆ getVirtualBaseOffsetOffset()

CharUnits ItaniumVTableContext::getVirtualBaseOffsetOffset ( const CXXRecordDecl RD,
const CXXRecordDecl VBase 
)

Return the offset in chars (relative to the vtable address point) where the offset of the virtual base that contains the given base is stored, otherwise, if no virtual base contains the given class, return 0.

Base must be a virtual base class or an unambiguous base.

Definition at line 2354 of file VTableBuilder.cpp.

References clang::CharUnits::Zero().

◆ getVTableComponentLayout()

VTableComponentLayout clang::ItaniumVTableContext::getVTableComponentLayout ( ) const
inline

Definition at line 461 of file VTableBuilder.h.

◆ getVTableLayout()

const VTableLayout & clang::ItaniumVTableContext::getVTableLayout ( const CXXRecordDecl RD)
inline

◆ isPointerLayout()

bool clang::ItaniumVTableContext::isPointerLayout ( ) const
inline

Definition at line 465 of file VTableBuilder.h.

References Pointer.

◆ isRelativeLayout()

bool clang::ItaniumVTableContext::isRelativeLayout ( ) const
inline

◆ setOriginalMethod()

void clang::ItaniumVTableContext::setOriginalMethod ( const CXXMethodDecl Key,
const CXXMethodDecl Val 
)
inline

Definition at line 447 of file VTableBuilder.h.


The documentation for this class was generated from the following files: