@@ -199,15 +199,17 @@ static void appendParameterTypes(const CodeGenTypes &CGT,
199199 prefix.size ());
200200}
201201
202+ using ExtParameterInfoList =
203+ SmallVector<FunctionProtoType::ExtParameterInfo, 16 >;
204+
202205// / Arrange the LLVM function layout for a value of the given function
203206// / type, on top of any implicit parameters already stored.
204207static const CGFunctionInfo &
205208arrangeLLVMFunctionInfo (CodeGenTypes &CGT, bool instanceMethod,
206209 SmallVectorImpl<CanQualType> &prefix,
207210 CanQual<FunctionProtoType> FTP) {
208- SmallVector<FunctionProtoType::ExtParameterInfo, 16 > paramInfos;
211+ ExtParameterInfoList paramInfos;
209212 RequiredArgs Required = RequiredArgs::forPrototypePlus (FTP, prefix.size ());
210- // FIXME: Kill copy.
211213 appendParameterTypes (CGT, prefix, paramInfos, FTP);
212214 CanQualType resultType = FTP->getReturnType ().getUnqualifiedType ();
213215
@@ -217,11 +219,13 @@ arrangeLLVMFunctionInfo(CodeGenTypes &CGT, bool instanceMethod,
217219 FTP->getExtInfo (), paramInfos, Required);
218220}
219221
222+ using CanQualTypeList = SmallVector<CanQualType, 16 >;
223+
220224// / Arrange the argument and result information for a value of the
221225// / given freestanding function type.
222226const CGFunctionInfo &
223227CodeGenTypes::arrangeFreeFunctionType (CanQual<FunctionProtoType> FTP) {
224- SmallVector<CanQualType, 16 > argTypes;
228+ CanQualTypeList argTypes;
225229 return ::arrangeLLVMFunctionInfo (*this , /* instanceMethod=*/ false , argTypes,
226230 FTP);
227231}
@@ -319,7 +323,7 @@ const CGFunctionInfo &
319323CodeGenTypes::arrangeCXXMethodType (const CXXRecordDecl *RD,
320324 const FunctionProtoType *FTP,
321325 const CXXMethodDecl *MD) {
322- SmallVector<CanQualType, 16 > argTypes;
326+ CanQualTypeList argTypes;
323327
324328 // Add the 'this' pointer.
325329 argTypes.push_back (DeriveThisType (RD, MD));
@@ -375,8 +379,8 @@ const CGFunctionInfo &
375379CodeGenTypes::arrangeCXXStructorDeclaration (GlobalDecl GD) {
376380 auto *MD = cast<CXXMethodDecl>(GD.getDecl ());
377381
378- SmallVector<CanQualType, 16 > argTypes;
379- SmallVector<FunctionProtoType::ExtParameterInfo, 16 > paramInfos;
382+ CanQualTypeList argTypes;
383+ ExtParameterInfoList paramInfos;
380384
381385 const CXXRecordDecl *ThisType = getCXXABI ().getThisArgumentTypeForMethod (GD);
382386 argTypes.push_back (DeriveThisType (ThisType, MD));
@@ -421,26 +425,26 @@ CodeGenTypes::arrangeCXXStructorDeclaration(GlobalDecl GD) {
421425 argTypes, extInfo, paramInfos, required);
422426}
423427
424- static SmallVector<CanQualType, 16 >
425- getArgTypesForCall (ASTContext &ctx, const CallArgList &args) {
426- SmallVector<CanQualType, 16 > argTypes;
428+ static CanQualTypeList getArgTypesForCall (ASTContext &ctx,
429+ const CallArgList &args) {
430+ CanQualTypeList argTypes;
427431 for (auto &arg : args)
428432 argTypes.push_back (ctx.getCanonicalParamType (arg.Ty ));
429433 return argTypes;
430434}
431435
432- static SmallVector<CanQualType, 16 >
433- getArgTypesForDeclaration (ASTContext &ctx, const FunctionArgList &args) {
434- SmallVector<CanQualType, 16 > argTypes;
436+ static CanQualTypeList getArgTypesForDeclaration (ASTContext &ctx,
437+ const FunctionArgList &args) {
438+ CanQualTypeList argTypes;
435439 for (auto &arg : args)
436440 argTypes.push_back (ctx.getCanonicalParamType (arg->getType ()));
437441 return argTypes;
438442}
439443
440- static llvm::SmallVector<FunctionProtoType::ExtParameterInfo, 16 >
441- getExtParameterInfosForCall (const FunctionProtoType *proto,
442- unsigned prefixArgs, unsigned totalArgs) {
443- llvm::SmallVector<FunctionProtoType::ExtParameterInfo, 16 > result;
444+ static ExtParameterInfoList
445+ getExtParameterInfosForCall (const FunctionProtoType *proto, unsigned prefixArgs,
446+ unsigned totalArgs) {
447+ ExtParameterInfoList result;
444448 if (proto->hasExtParameterInfos ()) {
445449 addExtParameterInfosForCall (result, proto, prefixArgs, totalArgs);
446450 }
@@ -462,8 +466,7 @@ CodeGenTypes::arrangeCXXConstructorCall(const CallArgList &args,
462466 unsigned ExtraPrefixArgs,
463467 unsigned ExtraSuffixArgs,
464468 bool PassProtoArgs) {
465- // FIXME: Kill copy.
466- SmallVector<CanQualType, 16 > ArgTypes;
469+ CanQualTypeList ArgTypes;
467470 for (const auto &Arg : args)
468471 ArgTypes.push_back (Context.getCanonicalParamType (Arg.Ty ));
469472
@@ -483,7 +486,7 @@ CodeGenTypes::arrangeCXXConstructorCall(const CallArgList &args,
483486 : Context.VoidTy ;
484487
485488 FunctionType::ExtInfo Info = FPT->getExtInfo ();
486- llvm::SmallVector<FunctionProtoType::ExtParameterInfo, 16 > ParamInfos;
489+ ExtParameterInfoList ParamInfos;
487490 // If the prototype args are elided, we should only have ABI-specific args,
488491 // which never have param info.
489492 if (PassProtoArgs && FPT->hasExtParameterInfos ()) {
@@ -546,13 +549,11 @@ CodeGenTypes::arrangeObjCMethodDeclaration(const ObjCMethodDecl *MD) {
546549const CGFunctionInfo &
547550CodeGenTypes::arrangeObjCMessageSendSignature (const ObjCMethodDecl *MD,
548551 QualType receiverType) {
549- SmallVector<CanQualType, 16 > argTys;
550- SmallVector<FunctionProtoType::ExtParameterInfo, 4 > extParamInfos (
551- MD->isDirectMethod () ? 1 : 2 );
552+ CanQualTypeList argTys;
553+ ExtParameterInfoList extParamInfos (MD->isDirectMethod () ? 1 : 2 );
552554 argTys.push_back (Context.getCanonicalParamType (receiverType));
553555 if (!MD->isDirectMethod ())
554556 argTys.push_back (Context.getCanonicalParamType (Context.getObjCSelType ()));
555- // FIXME: Kill copy?
556557 for (const auto *I : MD->parameters ()) {
557558 argTys.push_back (Context.getCanonicalParamType (I->getType ()));
558559 auto extParamInfo = FunctionProtoType::ExtParameterInfo ().withIsNoEscape (
@@ -579,7 +580,7 @@ CodeGenTypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD,
579580const CGFunctionInfo &
580581CodeGenTypes::arrangeUnprototypedObjCMessageSend (QualType returnType,
581582 const CallArgList &args) {
582- auto argTypes = getArgTypesForCall (Context, args);
583+ CanQualTypeList argTypes = getArgTypesForCall (Context, args);
583584 FunctionType::ExtInfo einfo;
584585
585586 return arrangeLLVMFunctionInfo (GetReturnType (returnType), FnInfoOpts::None,
@@ -641,7 +642,7 @@ arrangeFreeFunctionLikeCall(CodeGenTypes &CGT,
641642 bool chainCall) {
642643 assert (args.size () >= numExtraRequiredArgs);
643644
644- llvm::SmallVector<FunctionProtoType::ExtParameterInfo, 16 > paramInfos;
645+ ExtParameterInfoList paramInfos;
645646
646647 // In most cases, there are no optional arguments.
647648 RequiredArgs required = RequiredArgs::All;
@@ -666,8 +667,7 @@ arrangeFreeFunctionLikeCall(CodeGenTypes &CGT,
666667 required = RequiredArgs (args.size ());
667668 }
668669
669- // FIXME: Kill copy.
670- SmallVector<CanQualType, 16 > argTypes;
670+ CanQualTypeList argTypes;
671671 for (const auto &arg : args)
672672 argTypes.push_back (CGT.getContext ().getCanonicalParamType (arg.Ty ));
673673 FnInfoOpts opts = chainCall ? FnInfoOpts::IsChainCall : FnInfoOpts::None;
@@ -700,8 +700,9 @@ CodeGenTypes::arrangeBlockFunctionCall(const CallArgList &args,
700700const CGFunctionInfo &
701701CodeGenTypes::arrangeBlockFunctionDeclaration (const FunctionProtoType *proto,
702702 const FunctionArgList ¶ms) {
703- auto paramInfos = getExtParameterInfosForCall (proto, 1 , params.size ());
704- auto argTypes = getArgTypesForDeclaration (Context, params);
703+ ExtParameterInfoList paramInfos =
704+ getExtParameterInfosForCall (proto, 1 , params.size ());
705+ CanQualTypeList argTypes = getArgTypesForDeclaration (Context, params);
705706
706707 return arrangeLLVMFunctionInfo (GetReturnType (proto->getReturnType ()),
707708 FnInfoOpts::None, argTypes,
@@ -712,8 +713,7 @@ CodeGenTypes::arrangeBlockFunctionDeclaration(const FunctionProtoType *proto,
712713const CGFunctionInfo &
713714CodeGenTypes::arrangeBuiltinFunctionCall (QualType resultType,
714715 const CallArgList &args) {
715- // FIXME: Kill copy.
716- SmallVector<CanQualType, 16 > argTypes;
716+ CanQualTypeList argTypes;
717717 for (const auto &Arg : args)
718718 argTypes.push_back (Context.getCanonicalParamType (Arg.Ty ));
719719 return arrangeLLVMFunctionInfo (GetReturnType (resultType), FnInfoOpts::None,
@@ -724,7 +724,7 @@ CodeGenTypes::arrangeBuiltinFunctionCall(QualType resultType,
724724const CGFunctionInfo &
725725CodeGenTypes::arrangeBuiltinFunctionDeclaration (QualType resultType,
726726 const FunctionArgList &args) {
727- auto argTypes = getArgTypesForDeclaration (Context, args);
727+ CanQualTypeList argTypes = getArgTypesForDeclaration (Context, args);
728728
729729 return arrangeLLVMFunctionInfo (GetReturnType (resultType), FnInfoOpts::None,
730730 argTypes, FunctionType::ExtInfo (), {},
@@ -752,11 +752,10 @@ CodeGenTypes::arrangeCXXMethodCall(const CallArgList &args,
752752 " Emitting a call with less args than the required prefix?" );
753753 // Add one to account for `this`. It's a bit awkward here, but we don't count
754754 // `this` in similar places elsewhere.
755- auto paramInfos =
756- getExtParameterInfosForCall (proto, numPrefixArgs + 1 , args.size ());
755+ ExtParameterInfoList paramInfos =
756+ getExtParameterInfosForCall (proto, numPrefixArgs + 1 , args.size ());
757757
758- // FIXME: Kill copy.
759- auto argTypes = getArgTypesForCall (Context, args);
758+ CanQualTypeList argTypes = getArgTypesForCall (Context, args);
760759
761760 FunctionType::ExtInfo info = proto->getExtInfo ();
762761 return arrangeLLVMFunctionInfo (GetReturnType (proto->getReturnType ()),
@@ -777,14 +776,14 @@ CodeGenTypes::arrangeCall(const CGFunctionInfo &signature,
777776 if (signature.arg_size () == args.size ())
778777 return signature;
779778
780- SmallVector<FunctionProtoType::ExtParameterInfo, 16 > paramInfos;
779+ ExtParameterInfoList paramInfos;
781780 auto sigParamInfos = signature.getExtParameterInfos ();
782781 if (!sigParamInfos.empty ()) {
783782 paramInfos.append (sigParamInfos.begin (), sigParamInfos.end ());
784783 paramInfos.resize (args.size ());
785784 }
786785
787- auto argTypes = getArgTypesForCall (Context, args);
786+ CanQualTypeList argTypes = getArgTypesForCall (Context, args);
788787
789788 assert (signature.getRequiredArgs ().allowsOptionalArgs ());
790789 FnInfoOpts opts = FnInfoOpts::None;
0 commit comments