clang API Documentation
#include <CGVTables.h>
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) | |
ItaniumVTableContext & | getItaniumVTableContext () |
MicrosoftVTableContext & | getMicrosoftVTableContext () |
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) |
Definition at line 31 of file CGVTables.h.
Definition at line 32 of file CGVTables.cpp.
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.
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().
void CodeGenVTables::EmitThunks | ( | GlobalDecl | GD | ) |
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 | ||
) |
EmitVTTDefinition - Emit the definition of the given vtable.
Definition at line 42 of file CGVTT.cpp.
References Builder, clang::VTableLayout::getAddressPoint(), GetAddrOfVTTVTable(), clang::VTTVTable::getBase(), clang::CodeGen::CodeGenModule::getContext(), getItaniumVTableContext(), clang::ItaniumVTableContext::getVTableLayout(), clang::CodeGen::CodeGenTypeCache::Int64Ty, clang::CodeGen::CodeGenTypeCache::Int8PtrTy, and clang::CodeGen::CodeGenModule::setGlobalVisibility().
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 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 | ||
) |
GenerateConstructionVTable - Generate a construction vtable for the given base subobject.
Definition at line 620 of file CGVTables.cpp.
References clang::CodeGen::CodeGenModule::CreateOrReplaceCXXRuntimeVariable(), CreateVTableInitializer(), clang::CodeGen::CodeGenModule::GetAddrOfRTTIDescriptor(), clang::BaseSubobject::getBase(), clang::BaseSubobject::getBaseOffset(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getCXXABI(), getItaniumVTableContext(), clang::CodeGen::CGCXXABI::getMangleContext(), clang::CodeGen::CodeGenModule::getModuleDebugInfo(), clang::CharUnits::getQuantity(), clang::ASTContext::getTagDeclType(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::InternalLinkage, and clang::CodeGen::CodeGenModule::setGlobalVisibility().
Referenced by GetAddrOfVTTVTable().
uint64_t clang::CodeGen::CodeGenVTables::getAddressPoint | ( | BaseSubobject | Base, |
const CXXRecordDecl * | RD | ||
) |
getAddressPoint - Get the address point of the given subobject in the class decl.
llvm::GlobalVariable * CodeGenVTables::GetAddrOfVTT | ( | const CXXRecordDecl * | RD | ) |
GetAddrOfVTT - Get the address of the VTT for the given record decl.
Definition at line 101 of file CGVTT.cpp.
References Builder, clang::CodeGen::CodeGenModule::CreateOrReplaceCXXRuntimeVariable(), clang::ExternalLinkage, clang::CodeGen::CGCXXABI::getAddrOfVTable(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::CodeGen::CGCXXABI::getMangleContext(), clang::CXXRecordDecl::getNumVBases(), and clang::CodeGen::CodeGenTypeCache::Int8PtrTy.
Referenced by clang::CodeGen::CodeGenFunction::GetVTTParameter().
Definition at line 71 of file CGVTables.h.
Referenced by EmitVTTDefinition(), GenerateConstructionVTable(), and clang::CodeGen::CodeGenModule::getItaniumVTableContext().
Definition at line 75 of file CGVTables.h.
Referenced by clang::CodeGen::CodeGenModule::getMicrosoftVTableContext().
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 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().
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 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().