@@ -1832,30 +1832,30 @@ static ExprResult PointerAuthStringDiscriminator(Sema &S, CallExpr *Call) {
18321832static ExprResult GetVTablePointer(Sema &S, CallExpr *Call) {
18331833 if (S.checkArgCount(Call, 1))
18341834 return ExprError();
1835- Expr *ThisArg = Call->getArg(0);
1836- ExprResult ThisValue = S.DefaultFunctionArrayLvalueConversion(ThisArg );
1837- if (ThisValue .isInvalid())
1835+ Expr *FirstArg = Call->getArg(0);
1836+ ExprResult FirstValue = S.DefaultFunctionArrayLvalueConversion(FirstArg );
1837+ if (FirstValue .isInvalid())
18381838 return ExprError();
1839- Call->setArg(0, ThisValue .get());
1840- QualType ThisType = ThisArg ->getType();
1841- if (ThisType ->canDecayToPointerType() && ThisType ->isArrayType())
1842- ThisType = S.Context.getDecayedType(ThisType );
1843-
1844- const CXXRecordDecl *SubjectRecord = ThisType ->getPointeeCXXRecordDecl();
1845- if (!SubjectRecord ) {
1846- S.Diag(ThisArg ->getBeginLoc(), diag::err_get_vtable_pointer_incorrect_type)
1847- << /*isPolymorphic=*/0 << ThisType ;
1839+ Call->setArg(0, FirstValue .get());
1840+ QualType FirstArgType = FirstArg ->getType();
1841+ if (FirstArgType ->canDecayToPointerType() && FirstArgType ->isArrayType())
1842+ FirstArgType = S.Context.getDecayedType(FirstArgType );
1843+
1844+ const CXXRecordDecl *FirstArgRecord = FirstArgType ->getPointeeCXXRecordDecl();
1845+ if (!FirstArgRecord ) {
1846+ S.Diag(FirstArg ->getBeginLoc(), diag::err_get_vtable_pointer_incorrect_type)
1847+ << /*isPolymorphic=*/0 << FirstArgType ;
18481848 return ExprError();
18491849 }
18501850 if (S.RequireCompleteType(
1851- ThisArg ->getBeginLoc(), ThisType ->getPointeeType(),
1851+ FirstArg ->getBeginLoc(), FirstArgType ->getPointeeType(),
18521852 diag::err_get_vtable_pointer_requires_complete_type)) {
18531853 return ExprError();
18541854 }
18551855
1856- if (!SubjectRecord ->isPolymorphic()) {
1857- S.Diag(ThisArg ->getBeginLoc(), diag::err_get_vtable_pointer_incorrect_type)
1858- << /*isPolymorphic=*/1 << SubjectRecord ;
1856+ if (!FirstArgRecord ->isPolymorphic()) {
1857+ S.Diag(FirstArg ->getBeginLoc(), diag::err_get_vtable_pointer_incorrect_type)
1858+ << /*isPolymorphic=*/1 << FirstArgRecord ;
18591859 return ExprError();
18601860 }
18611861 QualType ReturnType = S.Context.getPointerType(S.Context.VoidTy.withConst());
0 commit comments