clang 20.0.0git
|
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/CodeGen/CGVTables.h"
Public Member Functions | |
void | createVTableInitializer (ConstantStructBuilder &builder, const VTableLayout &layout, llvm::Constant *rtti, bool vtableHasLocalLinkage) |
Add vtable components for the given vtable layout to the given global initializer. | |
CodeGenVTables (CodeGenModule &CGM) | |
ItaniumVTableContext & | getItaniumVTableContext () |
const ItaniumVTableContext & | getItaniumVTableContext () const |
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. | |
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. | |
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. | |
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) |
GenerateClassData - Generate all the class data required to be generated upon definition of a KeyFunction. | |
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? | |
llvm::Type * | getVTableType (const VTableLayout &layout) |
Returns the type of a vtable with the given layout. | |
void | GenerateRelativeVTableAlias (llvm::GlobalVariable *VTable, llvm::StringRef AliasNameRef) |
Generate a public facing alias for the vtable and make the vtable either hidden or private. | |
void | RemoveHwasanMetadata (llvm::GlobalValue *GV) const |
Specify a global should not be instrumented with hwasan. | |
Definition at line 32 of file CGVTables.h.
CodeGenVTables::CodeGenVTables | ( | CodeGenModule & | CGM | ) |
Definition at line 32 of file CGVTables.cpp.
void CodeGenVTables::createVTableInitializer | ( | ConstantStructBuilder & | builder, |
const VTableLayout & | layout, | ||
llvm::Constant * | rtti, | ||
bool | vtableHasLocalLinkage | ||
) |
Add vtable components for the given vtable layout to the given global initializer.
Definition at line 895 of file CGVTables.cpp.
References clang::CodeGen::ConstantAggregateBuilderTemplateBase< Impl, Traits >::beginArray(), clang::VTableLayout::getAddressPointIndices(), clang::VTableLayout::getNumVTables(), clang::VTableLayout::getVTableOffset(), and clang::VTableLayout::getVTableSize().
Referenced by GenerateConstructionVTable().
void CodeGenVTables::EmitThunks | ( | GlobalDecl | GD | ) |
EmitThunks - Emit the associated thunks for the given global decl.
Definition at line 625 of file CGVTables.cpp.
References clang::Dtor_Base, clang::CXXMethodDecl::getCanonicalDecl(), clang::GlobalDecl::getDecl(), clang::GlobalDecl::getDtorType(), and clang::VTableContextBase::getThunkInfo().
void CodeGenVTables::EmitVTTDefinition | ( | llvm::GlobalVariable * | VTT, |
llvm::GlobalVariable::LinkageTypes | Linkage, | ||
const CXXRecordDecl * | RD | ||
) |
EmitVTTDefinition - Emit the definition of the given vtable.
Definition at line 41 of file CGVTT.cpp.
References clang::VTableLayout::AddressPointLocation::AddressPointIndex, clang::PointerAuthOptions::CXXVTTVTablePointers, clang::VTableLayout::getAddressPoint(), GetAddrOfVTTVTable(), clang::VTTVTable::getBase(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getConstantSignedPointer(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getDataLayout(), getItaniumVTableContext(), clang::CodeGen::CodeGenModule::getModule(), clang::ItaniumVTableContext::getVTableLayout(), clang::CodeGen::CodeGenTypeCache::GlobalsInt8PtrTy, clang::Init, clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGenOptions::PointerAuth, clang::CodeGen::CodeGenModule::setGVProperties(), clang::CodeGen::CodeGenModule::supportsCOMDAT(), and clang::VTableLayout::AddressPointLocation::VTableIndex.
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 1191 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 919 of file CGVTables.cpp.
References clang::CodeGen::ConstantInitBuilderTemplateBase< Traits >::beginStruct(), clang::CodeGen::CodeGenModule::CreateOrReplaceCXXRuntimeVariable(), createVTableInitializer(), clang::CodeGen::CodeGenModule::EmitVTableTypeMetadata(), GenerateRelativeVTableAlias(), clang::CodeGen::CodeGenModule::GetAddrOfRTTIDescriptor(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::CodeGen::CodeGenModule::getDataLayout(), getItaniumVTableContext(), clang::CodeGen::CGCXXABI::getMangleContext(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getModuleDebugInfo(), clang::ASTContext::getTagDeclType(), getVTableType(), clang::ItaniumVTableContext::isRelativeLayout(), RemoveHwasanMetadata(), and clang::CodeGen::CodeGenModule::setGVProperties().
Referenced by GetAddrOfVTTVTable().
void CodeGenVTables::GenerateRelativeVTableAlias | ( | llvm::GlobalVariable * | VTable, |
llvm::StringRef | AliasNameRef | ||
) |
Generate a public facing alias for the vtable and make the vtable either hidden or private.
The alias will have the original linkage and visibility of the vtable. This is used for cases under the relative vtables ABI when a vtable may not be dso_local.
Definition at line 1018 of file CGVTables.cpp.
References getItaniumVTableContext(), and clang::CodeGen::CodeGenModule::getModule().
Referenced by GenerateConstructionVTable().
llvm::GlobalVariable * CodeGenVTables::GetAddrOfVTT | ( | const CXXRecordDecl * | RD | ) |
GetAddrOfVTT - Get the address of the VTT for the given record decl.
Definition at line 117 of file CGVTT.cpp.
References clang::CodeGen::CodeGenModule::CreateOrReplaceCXXRuntimeVariable(), clang::CodeGen::CGCXXABI::getAddrOfVTable(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::CodeGen::CodeGenModule::getDataLayout(), clang::CodeGen::CGCXXABI::getMangleContext(), clang::CXXRecordDecl::getNumVBases(), clang::CodeGen::CodeGenTypeCache::GlobalsInt8PtrTy, and clang::CodeGen::CodeGenModule::setGVProperties().
|
inline |
Definition at line 91 of file CGVTables.h.
Referenced by EmitVTTDefinition(), GenerateConstructionVTable(), GenerateRelativeVTableAlias(), and clang::CodeGen::CodeGenModule::getItaniumVTableContext().
|
inline |
Definition at line 95 of file CGVTables.h.
|
inline |
Definition at line 99 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 169 of file CGVTT.cpp.
References E, 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 142 of file CGVTT.cpp.
References E, and clang::CodeGen::CodeGenModule::getContext().
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 886 of file CGVTables.cpp.
References clang::CodeGen::CodeGenModule::getLLVMContext(), clang::VTableLayout::getNumVTables(), and clang::VTableLayout::getVTableSize().
Referenced by GenerateConstructionVTable().
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 1211 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::Decl::isInNamedModule(), clang::TargetCXXABI::isMicrosoft(), clang::Decl::shouldEmitInExternalSource(), clang::TSK_ExplicitInstantiationDeclaration, clang::TSK_ExplicitInstantiationDefinition, and clang::TSK_ImplicitInstantiation.
Referenced by setVTableSelectiveDLLImportExport(), shouldEmitVTableAtEndOfTranslationUnit(), and ShouldUseExternalRTTIDescriptor().
void CodeGenVTables::RemoveHwasanMetadata | ( | llvm::GlobalValue * | GV | ) | const |
Specify a global should not be instrumented with hwasan.
Definition at line 1002 of file CGVTables.cpp.
References clang::CodeGen::CodeGenModule::getLangOpts(), clang::SanitizerSet::has(), and clang::LangOptions::Sanitize.
Referenced by GenerateConstructionVTable().