clang
3.9.0
|
#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) |
CreateVTableInitializer - Create a vtable initializer for the given record decl. More... | |
CodeGenVTables (CodeGenModule &CGM) | |
ItaniumVTableContext & | getItaniumVTableContext () |
MicrosoftVTableContext & | getMicrosoftVTableContext () |
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... | |
Definition at line 31 of file CGVTables.h.
CodeGenVTables::CodeGenVTables | ( | CodeGenModule & | CGM | ) |
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 523 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::CodeGen::CodeGenModule::getLangOpts(), clang::VTableComponent::getOffsetToTop(), clang::ASTContext::getPointerDiffType(), clang::CodeGen::CGCXXABI::GetPureVirtualCallName(), clang::CharUnits::getQuantity(), clang::CodeGen::CodeGenModule::getTypes(), clang::VTableComponent::getVBaseOffset(), clang::VTableComponent::getVCallOffset(), I, Inits, clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::CodeGen::Type, 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 504 of file CGVTables.cpp.
References clang::Dtor_Base, getCanonicalDecl(), 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::CodeGen::CodeGenModule::getModule(), clang::ItaniumVTableContext::getVTableLayout(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::CodeGen::CodeGenModule::setGlobalVisibility(), clang::CodeGen::CodeGenModule::supportsCOMDAT(), and clang::CodeGen::Type.
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 823 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 660 of file CGVTables.cpp.
References clang::CodeGen::CodeGenModule::CreateOrReplaceCXXRuntimeVariable(), CreateVTableInitializer(), clang::CodeGen::CodeGenModule::EmitVTableTypeMetadata(), 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, clang::Name, and clang::CodeGen::CodeGenModule::setGlobalVisibility().
Referenced by GetAddrOfVTTVTable().
llvm::GlobalVariable * CodeGenVTables::GetAddrOfVTT | ( | const CXXRecordDecl * | RD | ) |
GetAddrOfVTT - Get the address of the VTT for the given record decl.
Definition at line 104 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(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, and clang::Name.
Referenced by clang::CodeGen::CodeGenFunction::GetVTTParameter().
|
inline |
Definition at line 71 of file CGVTables.h.
Referenced by EmitVTTDefinition(), GenerateConstructionVTable(), and clang::CodeGen::CodeGenModule::getItaniumVTableContext().
|
inline |
Definition at line 75 of file CGVTables.h.
Referenced by clang::CodeGen::CodeGenModule::getMicrosoftVTableContext().
uint64_t CodeGenVTables::getSecondaryVirtualPointerIndex | ( | const CXXRecordDecl * | RD, |
BaseSubobject | Base | ||
) |
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 128 of file CGVTT.cpp.
References Builder, E, clang::CodeGen::CodeGenModule::getContext(), and I.
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 vtable definition when that vtable is defined strongly elsewhere. Otherwise, we'd just like to avoid emitting vtables when unnecessary.
Definition at line 843 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 shouldEmitVTableAtEndOfTranslationUnit(), and ShouldUseExternalRTTIDescriptor().