[clang] [clang] Add builtin_get_vtable_pointer and virtual_member_address (PR #135469)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 15 13:33:29 PDT 2025
================
@@ -1782,6 +1782,92 @@ static ExprResult PointerAuthStringDiscriminator(Sema &S, CallExpr *Call) {
return Call;
}
+static ExprResult VirtualMemberAddress(Sema &S, CallExpr *Call) {
+ if (S.checkArgCount(Call, 2))
+ return ExprError();
+
+ for (int i = 0; i < 2; ++i) {
+ ExprResult ArgRValue =
+ S.DefaultFunctionArrayLvalueConversion(Call->getArg(1));
+ if (ArgRValue.isInvalid())
+ return ExprError();
+ Call->setArg(1, ArgRValue.get());
+ }
+
+ if (Call->getArg(0)->isTypeDependent() || Call->getArg(1)->isValueDependent())
+ return Call;
+
+ const Expr *ThisArg = Call->getArg(0);
+ QualType ThisTy = ThisArg->getType();
+ if (ThisTy->isPointerOrReferenceType())
----------------
ojhunt wrote:
I'll update this to make it warn on a reference parameter
https://github.com/llvm/llvm-project/pull/135469
More information about the cfe-commits
mailing list