[clang] Remove getPointerElementType() in EmitVTableTypeCheckedLoad()

This commit is contained in:
Arthur Eubanks 2022-02-23 09:37:53 -08:00
parent 87753cebf5
commit 6eec483584
4 changed files with 8 additions and 5 deletions

View File

@ -2829,7 +2829,8 @@ bool CodeGenFunction::ShouldEmitVTableTypeCheckedLoad(const CXXRecordDecl *RD) {
}
llvm::Value *CodeGenFunction::EmitVTableTypeCheckedLoad(
const CXXRecordDecl *RD, llvm::Value *VTable, uint64_t VTableByteOffset) {
const CXXRecordDecl *RD, llvm::Value *VTable, llvm::Type *VTableTy,
uint64_t VTableByteOffset) {
SanitizerScope SanScope(this);
EmitSanitizerStatReport(llvm::SanStat_CFI_VCall);
@ -2854,7 +2855,7 @@ llvm::Value *CodeGenFunction::EmitVTableTypeCheckedLoad(
}
return Builder.CreateBitCast(Builder.CreateExtractValue(CheckedLoad, 0),
VTable->getType()->getPointerElementType());
VTableTy);
}
void CodeGenFunction::EmitForwardingCallToLambda(

View File

@ -2322,7 +2322,9 @@ public:
bool ShouldEmitVTableTypeCheckedLoad(const CXXRecordDecl *RD);
/// Emit a type checked load from the given vtable.
llvm::Value *EmitVTableTypeCheckedLoad(const CXXRecordDecl *RD, llvm::Value *VTable,
llvm::Value *EmitVTableTypeCheckedLoad(const CXXRecordDecl *RD,
llvm::Value *VTable,
llvm::Type *VTableTy,
uint64_t VTableByteOffset);
/// EnterDtorCleanups - Enter the cleanups necessary to complete the

View File

@ -1925,7 +1925,7 @@ CGCallee ItaniumCXXABI::getVirtualFunctionPointer(CodeGenFunction &CGF,
llvm::Value *VFunc;
if (CGF.ShouldEmitVTableTypeCheckedLoad(MethodDecl->getParent())) {
VFunc = CGF.EmitVTableTypeCheckedLoad(
MethodDecl->getParent(), VTable,
MethodDecl->getParent(), VTable, TyPtr,
VTableIndex * CGM.getContext().getTargetInfo().getPointerWidth(0) / 8);
} else {
CGF.EmitTypeMetadataCodeForVCall(MethodDecl->getParent(), VTable, Loc);

View File

@ -1947,7 +1947,7 @@ CGCallee MicrosoftCXXABI::getVirtualFunctionPointer(CodeGenFunction &CGF,
llvm::Value *VFunc;
if (CGF.ShouldEmitVTableTypeCheckedLoad(MethodDecl->getParent())) {
VFunc = CGF.EmitVTableTypeCheckedLoad(
getObjectWithVPtr(), VTable,
getObjectWithVPtr(), VTable, Ty,
ML.Index * CGM.getContext().getTargetInfo().getPointerWidth(0) / 8);
} else {
if (CGM.getCodeGenOpts().PrepareForLTO)