13#ifndef LLVM_CLANG_LIB_CODEGEN_CGVTABLES_H
14#define LLVM_CLANG_LIB_CODEGEN_CGVTABLES_H
21#include "llvm/ADT/DenseMap.h"
22#include "llvm/IR/GlobalVariable.h"
29 class ConstantArrayBuilder;
30 class ConstantStructBuilder;
40 typedef std::pair<const CXXRecordDecl *, BaseSubobject> BaseSubobjectPairTy;
41 typedef llvm::DenseMap<BaseSubobjectPairTy, uint64_t> SubVTTIndicesMapTy;
44 SubVTTIndicesMapTy SubVTTIndices;
46 typedef llvm::DenseMap<BaseSubobjectPairTy, uint64_t>
47 SecondaryVirtualPointerIndicesMapTy;
51 SecondaryVirtualPointerIndicesMapTy SecondaryVirtualPointerIndices;
54 llvm::Constant *PureVirtualFn =
nullptr;
57 llvm::Constant *DeletedVirtualFn =
nullptr;
66 llvm::Constant *rtti,
unsigned &nextVTableThunkIndex,
67 unsigned vtableAddressPoint,
68 bool vtableHasLocalLinkage);
73 llvm::Constant *component,
74 unsigned vtableAddressPoint,
75 bool vtableHasLocalLinkage,
76 bool isCompleteDtor)
const;
78 bool useRelativeLayout()
const;
80 llvm::Type *getVTableComponentType()
const;
87 bool vtableHasLocalLinkage);
92 return *cast<ItaniumVTableContext>(VTContext);
96 return *cast<ItaniumVTableContext>(VTContext);
100 return *cast<MicrosoftVTableContext>(VTContext);
114 llvm::GlobalVariable *
117 llvm::GlobalVariable::LinkageTypes
Linkage,
118 VTableAddressPointsMapTy& AddressPoints);
126 llvm::GlobalVariable::LinkageTypes
Linkage,
150 llvm::StringRef AliasNameRef);
Enums/classes describing ABI related information about constructors, destructors and thunks.
Represents a C++ struct/union/class.
This class organizes the cross-function state that is used while generating LLVM code.
llvm::GlobalVariable * GetAddrOfVTT(const CXXRecordDecl *RD)
GetAddrOfVTT - Get the address of the VTT for the given record decl.
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.
const ItaniumVTableContext & getItaniumVTableContext() const
void GenerateClassData(const CXXRecordDecl *RD)
GenerateClassData - Generate all the class data required to be generated upon definition of a KeyFunc...
void GenerateRelativeVTableAlias(llvm::GlobalVariable *VTable, llvm::StringRef AliasNameRef)
Generate a public facing alias for the vtable and make the vtable either hidden or private.
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.
ItaniumVTableContext & getItaniumVTableContext()
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::Type * getVTableType(const VTableLayout &layout)
Returns the type of a vtable with the given layout.
uint64_t getSecondaryVirtualPointerIndex(const CXXRecordDecl *RD, BaseSubobject Base)
getSecondaryVirtualPointerIndex - Return the index in the VTT where the virtual pointer for the given...
bool isVTableExternal(const CXXRecordDecl *RD)
At this point in the translation unit, does it appear that can we rely on the vtable being defined el...
MicrosoftVTableContext & getMicrosoftVTableContext()
void RemoveHwasanMetadata(llvm::GlobalValue *GV) const
Specify a global should not be instrumented with hwasan.
void EmitThunks(GlobalDecl GD)
EmitThunks - Emit the associated thunks for the given global decl.
void EmitVTTDefinition(llvm::GlobalVariable *VTT, llvm::GlobalVariable::LinkageTypes Linkage, const CXXRecordDecl *RD)
EmitVTTDefinition - Emit the definition of the given vtable.
A helper class of ConstantInitBuilder, used for building constant array initializers.
A helper class of ConstantInitBuilder, used for building constant struct initializers.
GlobalDecl - represents a global declaration.
llvm::DenseMap< BaseSubobject, AddressPointLocation > AddressPointsMapTy
The JSON file list parser is used to communicate input to InstallAPI.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
The this pointer adjustment as well as an optional return adjustment for a thunk.