================ @@ -5708,6 +5732,27 @@ CGCallee CodeGenFunction::EmitCallee(const Expr *E) { return EmitCallee(ICE->getSubExpr()); } + // Try to remember the original __ptrauth qualifier for loads of + // function pointers. + if (ICE->getCastKind() == CK_LValueToRValue) { + const auto *SubExpr = ICE->getSubExpr(); + if (const auto *PtrType = SubExpr->getType()->getAs<PointerType>()) { + auto Result = EmitOrigPointerRValue(E); + + QualType FunctionType = PtrType->getPointeeType(); + assert(FunctionType->isFunctionType()); + + GlobalDecl GD; + if (const auto *VD = + dyn_cast_or_null<VarDecl>(E->getReferencedDeclOfCallee())) { + GD = GlobalDecl(VD); + } + CGCalleeInfo CalleeInfo(FunctionType->getAs<FunctionProtoType>(), GD); ---------------- AaronBallman wrote:
I don't see any code which prohibits use on K&R C functions, so this `getAs` can return null. Should we prohibit such a use in Sema or fix the use here and add test coverage? https://github.com/llvm/llvm-project/pull/100830 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits