================ @@ -1825,6 +1825,37 @@ static ExprResult PointerAuthStringDiscriminator(Sema &S, CallExpr *Call) { return Call; } +static ExprResult GetVTablePointer(Sema &S, CallExpr *Call) { + if (S.checkArgCount(Call, 1)) + return ExprError(); + ExprResult ThisArg = S.DefaultFunctionArrayLvalueConversion(Call->getArg(0)); + if (ThisArg.isInvalid()) + return ExprError(); + Call->setArg(0, ThisArg.get()); + const Expr *Subject = Call->getArg(0); + QualType SubjectType = Subject->getType(); + const CXXRecordDecl *SubjectRecord = SubjectType->getPointeeCXXRecordDecl(); + if (!SubjectType->isPointerType() || !SubjectRecord) { + S.Diag(Subject->getBeginLoc(), diag::err_get_vtable_pointer_incorrect_type) + << 0 << SubjectType; + return ExprError(); + } + if (S.RequireCompleteType( + Subject->getBeginLoc(), SubjectType->getPointeeType(), + diag::err_get_vtable_pointer_requires_complete_type)) { + return ExprError(); + } + + if (!SubjectRecord->isPolymorphic()) { + S.Diag(Subject->getBeginLoc(), diag::err_get_vtable_pointer_incorrect_type) + << 1 << SubjectRecord; ---------------- cor3ntin wrote:
```suggestion << /* Polymorphic*/1 << SubjectRecord; ``` https://github.com/llvm/llvm-project/pull/139790 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits