================ @@ -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); ---------------- ahatanak wrote:
The prototype is only needed to build the attribute list for the call (see the call to `getCalleeFunctionProtoType` in `CodeGenModule::ConstructAttributeList`), so it's fine to pass null to `CGCalleeInfo`'s constructor here. Note that there's an existing line passing null to the constructor of `CGCalleeInfo` near the end of `CodeGenFunction::EmitCallee`. 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