clang API Documentation

Public Member Functions
clang::CodeGen::CodeGenVTables Class Reference

#include <CGVTables.h>

List of all members.

Public Member Functions

llvm::Constant * CreateVTableInitializer (const CXXRecordDecl *RD, const VTableComponent *Components, unsigned NumComponents, const VTableLayout::VTableThunkTy *VTableThunks, unsigned NumVTableThunks, llvm::Constant *RTTI)
 CodeGenVTables (CodeGenModule &CGM)
ItaniumVTableContextgetItaniumVTableContext ()
MicrosoftVTableContextgetMicrosoftVTableContext ()
uint64_t getSubVTTIndex (const CXXRecordDecl *RD, BaseSubobject Base)
uint64_t getSecondaryVirtualPointerIndex (const CXXRecordDecl *RD, BaseSubobject Base)
uint64_t getAddressPoint (BaseSubobject Base, const CXXRecordDecl *RD)
llvm::GlobalVariable * GenerateConstructionVTable (const CXXRecordDecl *RD, const BaseSubobject &Base, bool BaseIsVirtual, llvm::GlobalVariable::LinkageTypes Linkage, VTableAddressPointsMapTy &AddressPoints)
llvm::GlobalVariable * GetAddrOfVTT (const CXXRecordDecl *RD)
 GetAddrOfVTT - Get the address of the VTT for the given record decl.
void EmitVTTDefinition (llvm::GlobalVariable *VTT, llvm::GlobalVariable::LinkageTypes Linkage, const CXXRecordDecl *RD)
 EmitVTTDefinition - Emit the definition of the given vtable.
void EmitThunks (GlobalDecl GD)
 EmitThunks - Emit the associated thunks for the given global decl.
void GenerateClassData (const CXXRecordDecl *RD)
bool isVTableExternal (const CXXRecordDecl *RD)

Detailed Description

Definition at line 31 of file CGVTables.h.


Constructor & Destructor Documentation

Definition at line 32 of file CGVTables.cpp.


Member Function Documentation

llvm::Constant * CodeGenVTables::CreateVTableInitializer ( const CXXRecordDecl RD,
const VTableComponent Components,
unsigned  NumComponents,
const VTableLayout::VTableThunkTy VTableThunks,
unsigned  NumVTableThunks,
llvm::Constant *  RTTI 
)

CreateVTableInitializer - Create a vtable initializer for the given record decl.

Parameters:
Components- The vtable components; this is really an array of VTableComponents.

Definition at line 505 of file CGVTables.cpp.

References clang::VTableComponent::CK_CompleteDtorPointer, clang::VTableComponent::CK_DeletingDtorPointer, clang::VTableComponent::CK_FunctionPointer, clang::VTableComponent::CK_OffsetToTop, clang::VTableComponent::CK_RTTI, clang::VTableComponent::CK_UnusedFunctionPointer, clang::VTableComponent::CK_VBaseOffset, clang::VTableComponent::CK_VCallOffset, clang::CodeGen::CodeGenTypes::ConvertType(), clang::CodeGen::CodeGenModule::CreateRuntimeFunction(), clang::Dtor_Complete, clang::Dtor_Deleting, clang::CodeGen::CodeGenModule::GetAddrOfFunction(), clang::CodeGen::CodeGenModule::GetAddrOfThunk(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::GlobalDecl::getDecl(), clang::CodeGen::CGCXXABI::GetDeletedVirtualCallName(), clang::VTableComponent::getDestructorDecl(), clang::VTableComponent::getFunctionDecl(), clang::CodeGen::CodeGenTypes::GetFunctionTypeForVTable(), clang::VTableComponent::getKind(), clang::VTableComponent::getOffsetToTop(), clang::ASTContext::getPointerDiffType(), clang::CodeGen::CGCXXABI::GetPureVirtualCallName(), clang::CharUnits::getQuantity(), clang::CodeGen::CodeGenModule::getTypes(), clang::VTableComponent::getVBaseOffset(), clang::VTableComponent::getVCallOffset(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, and clang::CodeGen::CodeGenTypeCache::VoidTy.

Referenced by GenerateConstructionVTable().

EmitThunks - Emit the associated thunks for the given global decl.

Definition at line 486 of file CGVTables.cpp.

References clang::Dtor_Base, clang::GlobalDecl::getDecl(), clang::GlobalDecl::getDtorType(), and clang::VTableContextBase::getThunkInfo().

Referenced by emitCXXDestructor().

void CodeGenVTables::EmitVTTDefinition ( llvm::GlobalVariable *  VTT,
llvm::GlobalVariable::LinkageTypes  Linkage,
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 771 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 clang::CodeGen::CodeGenModule::EmitVTable().

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

getAddressPoint - Get the address point of the given subobject in the class decl.

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

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

Definition at line 152 of file CGVTT.cpp.

References Builder, and clang::CodeGen::CodeGenModule::getContext().

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 126 of file CGVTT.cpp.

References Builder, and clang::CodeGen::CodeGenModule::getContext().

Referenced by clang::CodeGen::CodeGenFunction::GetVTTParameter().

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 v-table definition when that v-table is defined strongly elsewhere. Otherwise, we'd just like to avoid emitting v-tables when unnecessary.

Definition at line 791 of file CGVTables.cpp.

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

Referenced by shouldEmitVTableAtEndOfTranslationUnit(), and ShouldUseExternalRTTIDescriptor().


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