clang  6.0.0svn
Public Member Functions | List of all members
clang::CodeGen::CodeGenVTables Class Reference

#include "/opt/doxygen-docs/src/llvm/tools/clang/lib/CodeGen/CGVTables.h"

Public Member Functions

void createVTableInitializer (ConstantStructBuilder &builder, const VTableLayout &layout, llvm::Constant *rtti)
 Add vtable components for the given vtable layout to the given global initializer. More...
 
 CodeGenVTables (CodeGenModule &CGM)
 
ItaniumVTableContextgetItaniumVTableContext ()
 
MicrosoftVTableContextgetMicrosoftVTableContext ()
 
uint64_t getSubVTTIndex (const CXXRecordDecl *RD, BaseSubobject Base)
 getSubVTTIndex - Return the index of the sub-VTT for the base class of the given record decl. More...
 
uint64_t getSecondaryVirtualPointerIndex (const CXXRecordDecl *RD, BaseSubobject Base)
 getSecondaryVirtualPointerIndex - Return the index in the VTT where the virtual pointer for the given subobject is located. More...
 
llvm::GlobalVariable * GenerateConstructionVTable (const CXXRecordDecl *RD, const BaseSubobject &Base, bool BaseIsVirtual, llvm::GlobalVariable::LinkageTypes Linkage, VTableAddressPointsMapTy &AddressPoints)
 GenerateConstructionVTable - Generate a construction vtable for the given base subobject. More...
 
llvm::GlobalVariable * GetAddrOfVTT (const CXXRecordDecl *RD)
 GetAddrOfVTT - Get the address of the VTT for the given record decl. More...
 
void EmitVTTDefinition (llvm::GlobalVariable *VTT, llvm::GlobalVariable::LinkageTypes Linkage, const CXXRecordDecl *RD)
 EmitVTTDefinition - Emit the definition of the given vtable. More...
 
void EmitThunks (GlobalDecl GD)
 EmitThunks - Emit the associated thunks for the given global decl. More...
 
void GenerateClassData (const CXXRecordDecl *RD)
 GenerateClassData - Generate all the class data required to be generated upon definition of a KeyFunction. More...
 
bool isVTableExternal (const CXXRecordDecl *RD)
 At this point in the translation unit, does it appear that can we rely on the vtable being defined elsewhere in the program? More...
 
llvm::TypegetVTableType (const VTableLayout &layout)
 Returns the type of a vtable with the given layout. More...
 

Detailed Description

Definition at line 33 of file CGVTables.h.

Constructor & Destructor Documentation

◆ CodeGenVTables()

CodeGenVTables::CodeGenVTables ( CodeGenModule CGM)

Definition at line 31 of file CGVTables.cpp.

Member Function Documentation

◆ createVTableInitializer()

void CodeGenVTables::createVTableInitializer ( ConstantStructBuilder builder,
const VTableLayout layout,
llvm::Constant *  rtti 
)

◆ EmitThunks()

void CodeGenVTables::EmitThunks ( GlobalDecl  GD)

◆ EmitVTTDefinition()

void CodeGenVTables::EmitVTTDefinition ( llvm::GlobalVariable *  VTT,
llvm::GlobalVariable::LinkageTypes  Linkage,
const CXXRecordDecl RD 
)

EmitVTTDefinition - Emit the definition of the given vtable.

Definition at line 42 of file CGVTT.cpp.

Referenced by getMicrosoftVTableContext().

◆ GenerateClassData()

void CodeGenVTables::GenerateClassData ( const CXXRecordDecl RD)

GenerateClassData - Generate all the class data required to be generated upon definition of a KeyFunction.

This includes the vtable, the RTTI data structure (if RTTI is enabled) and the VTT (if the class has virtual bases).

Definition at line 859 of file CGVTables.cpp.

References clang::CodeGen::CGCXXABI::emitVirtualInheritanceTables(), clang::CodeGen::CGCXXABI::emitVTableDefinitions(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::CodeGen::CodeGenModule::getModuleDebugInfo(), and clang::CXXRecordDecl::getNumVBases().

Referenced by getMicrosoftVTableContext().

◆ GenerateConstructionVTable()

llvm::GlobalVariable * CodeGenVTables::GenerateConstructionVTable ( const CXXRecordDecl RD,
const BaseSubobject Base,
bool  BaseIsVirtual,
llvm::GlobalVariable::LinkageTypes  Linkage,
VTableAddressPointsMapTy &  AddressPoints 
)

◆ GetAddrOfVTT()

llvm::GlobalVariable * CodeGenVTables::GetAddrOfVTT ( const CXXRecordDecl RD)

GetAddrOfVTT - Get the address of the VTT for the given record decl.

Definition at line 106 of file CGVTT.cpp.

References clang::CodeGen::CodeGenModule::getCXXABI(), clang::CodeGen::CGCXXABI::getMangleContext(), and clang::CXXRecordDecl::getNumVBases().

Referenced by getMicrosoftVTableContext().

◆ getItaniumVTableContext()

ItaniumVTableContext& clang::CodeGen::CodeGenVTables::getItaniumVTableContext ( )
inline

◆ getMicrosoftVTableContext()

MicrosoftVTableContext& clang::CodeGen::CodeGenVTables::getMicrosoftVTableContext ( )
inline

◆ getSecondaryVirtualPointerIndex()

uint64_t CodeGenVTables::getSecondaryVirtualPointerIndex ( const CXXRecordDecl RD,
BaseSubobject  Base 
)

getSecondaryVirtualPointerIndex - Return the index in the VTT where the virtual pointer for the given subobject is located.

Definition at line 156 of file CGVTT.cpp.

Referenced by getMicrosoftVTableContext().

◆ getSubVTTIndex()

uint64_t CodeGenVTables::getSubVTTIndex ( const CXXRecordDecl RD,
BaseSubobject  Base 
)

getSubVTTIndex - Return the index of the sub-VTT for the base class of the given record decl.

Definition at line 130 of file CGVTT.cpp.

Referenced by getMicrosoftVTableContext().

◆ getVTableType()

llvm::Type * CodeGenVTables::getVTableType ( const VTableLayout layout)

Returns the type of a vtable with the given layout.

Normally a struct of arrays of pointers, with one struct element for each vtable in the vtable group.

Definition at line 672 of file CGVTables.cpp.

References clang::CodeGen::CodeGenModule::getLLVMContext(), clang::VTableLayout::getNumVTables(), clang::VTableLayout::getVTableSize(), and clang::CodeGen::CodeGenTypeCache::Int8PtrTy.

Referenced by getMicrosoftVTableContext().

◆ isVTableExternal()

bool CodeGenVTables::isVTableExternal ( const CXXRecordDecl RD)

At this point in the translation unit, does it appear that can we rely on the vtable being defined elsewhere in the program?

The response is really only definitive when called at the end of the translation unit.

The only semantic restriction here is that the object file should not contain a vtable definition when that vtable is defined strongly elsewhere. Otherwise, we'd just like to avoid emitting vtables when unnecessary.

Definition at line 879 of file CGVTables.cpp.

References clang::CodeGen::CodeGenModule::getContext(), clang::ASTContext::getCurrentKeyFunction(), clang::TargetInfo::getCXXABI(), clang::CodeGen::CodeGenModule::getTarget(), clang::CXXRecordDecl::getTemplateSpecializationKind(), clang::FunctionDecl::hasBody(), clang::CXXRecordDecl::isDynamicClass(), clang::TargetCXXABI::isMicrosoft(), clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ExplicitInstantiationDefinition, and clang::TSK_ImplicitInstantiation.

Referenced by getMicrosoftVTableContext(), and shouldEmitVTableAtEndOfTranslationUnit().


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