diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -3698,12 +3698,18 @@ FunctionTy, nullptr, SC_Static, false, false); FunctionArgList args; - ImplicitParamDecl DstDecl(C, FD, SourceLocation(), /*Id=*/nullptr, DestTy, - ImplicitParamDecl::Other); - args.push_back(&DstDecl); - ImplicitParamDecl SrcDecl(C, FD, SourceLocation(), /*Id=*/nullptr, SrcTy, - ImplicitParamDecl::Other); - args.push_back(&SrcDecl); + ParmVarDecl *Params[2]; + ParmVarDecl *DstDecl = ParmVarDecl::Create( + C, FD, SourceLocation(), SourceLocation(), nullptr, DestTy, + C.getTrivialTypeSourceInfo(DestTy, SourceLocation()), SC_None, + /*DefArg=*/nullptr); + args.push_back(Params[0] = DstDecl); + ParmVarDecl *SrcDecl = ParmVarDecl::Create( + C, FD, SourceLocation(), SourceLocation(), nullptr, SrcTy, + C.getTrivialTypeSourceInfo(SrcTy, SourceLocation()), SC_None, + /*DefArg=*/nullptr); + args.push_back(Params[1] = SrcDecl); + FD->setParams(Params); const CGFunctionInfo &FI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(ReturnTy, args); @@ -3719,12 +3725,12 @@ StartFunction(FD, ReturnTy, Fn, FI, args); - DeclRefExpr DstExpr(C, &DstDecl, false, DestTy, VK_PRValue, SourceLocation()); + DeclRefExpr DstExpr(C, DstDecl, false, DestTy, VK_PRValue, SourceLocation()); UnaryOperator *DST = UnaryOperator::Create( C, &DstExpr, UO_Deref, DestTy->getPointeeType(), VK_LValue, OK_Ordinary, SourceLocation(), false, FPOptionsOverride()); - DeclRefExpr SrcExpr(C, &SrcDecl, false, SrcTy, VK_PRValue, SourceLocation()); + DeclRefExpr SrcExpr(C, SrcDecl, false, SrcTy, VK_PRValue, SourceLocation()); UnaryOperator *SRC = UnaryOperator::Create( C, &SrcExpr, UO_Deref, SrcTy->getPointeeType(), VK_LValue, OK_Ordinary, SourceLocation(), false, FPOptionsOverride()); @@ -3782,12 +3788,18 @@ FunctionTy, nullptr, SC_Static, false, false); FunctionArgList args; - ImplicitParamDecl DstDecl(C, FD, SourceLocation(), /*Id=*/nullptr, DestTy, - ImplicitParamDecl::Other); - args.push_back(&DstDecl); - ImplicitParamDecl SrcDecl(C, FD, SourceLocation(), /*Id=*/nullptr, SrcTy, - ImplicitParamDecl::Other); - args.push_back(&SrcDecl); + ParmVarDecl *Params[2]; + ParmVarDecl *DstDecl = ParmVarDecl::Create( + C, FD, SourceLocation(), SourceLocation(), nullptr, DestTy, + C.getTrivialTypeSourceInfo(DestTy, SourceLocation()), SC_None, + /*DefArg=*/nullptr); + args.push_back(Params[0] = DstDecl); + ParmVarDecl *SrcDecl = ParmVarDecl::Create( + C, FD, SourceLocation(), SourceLocation(), nullptr, SrcTy, + C.getTrivialTypeSourceInfo(SrcTy, SourceLocation()), SC_None, + /*DefArg=*/nullptr); + args.push_back(Params[1] = SrcDecl); + FD->setParams(Params); const CGFunctionInfo &FI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(ReturnTy, args); @@ -3802,7 +3814,7 @@ StartFunction(FD, ReturnTy, Fn, FI, args); - DeclRefExpr SrcExpr(getContext(), &SrcDecl, false, SrcTy, VK_PRValue, + DeclRefExpr SrcExpr(getContext(), SrcDecl, false, SrcTy, VK_PRValue, SourceLocation()); UnaryOperator *SRC = UnaryOperator::Create( @@ -3829,7 +3841,7 @@ CXXConstExpr->getConstructionKind(), SourceRange()); - DeclRefExpr DstExpr(getContext(), &DstDecl, false, DestTy, VK_PRValue, + DeclRefExpr DstExpr(getContext(), DstDecl, false, DestTy, VK_PRValue, SourceLocation()); RValue DV = EmitAnyExpr(&DstExpr);