@@ -199,15 +199,17 @@ static void appendParameterTypes(const CodeGenTypes &CGT,
199
199
prefix.size ());
200
200
}
201
201
202
+ using ExtParameterInfoList =
203
+ SmallVector<FunctionProtoType::ExtParameterInfo, 16 >;
204
+
202
205
// / Arrange the LLVM function layout for a value of the given function
203
206
// / type, on top of any implicit parameters already stored.
204
207
static const CGFunctionInfo &
205
208
arrangeLLVMFunctionInfo (CodeGenTypes &CGT, bool instanceMethod,
206
209
SmallVectorImpl<CanQualType> &prefix,
207
210
CanQual<FunctionProtoType> FTP) {
208
- SmallVector<FunctionProtoType::ExtParameterInfo, 16 > paramInfos;
211
+ ExtParameterInfoList paramInfos;
209
212
RequiredArgs Required = RequiredArgs::forPrototypePlus (FTP, prefix.size ());
210
- // FIXME: Kill copy.
211
213
appendParameterTypes (CGT, prefix, paramInfos, FTP);
212
214
CanQualType resultType = FTP->getReturnType ().getUnqualifiedType ();
213
215
@@ -217,11 +219,13 @@ arrangeLLVMFunctionInfo(CodeGenTypes &CGT, bool instanceMethod,
217
219
FTP->getExtInfo (), paramInfos, Required);
218
220
}
219
221
222
+ using CanQualTypeList = SmallVector<CanQualType, 16 >;
223
+
220
224
// / Arrange the argument and result information for a value of the
221
225
// / given freestanding function type.
222
226
const CGFunctionInfo &
223
227
CodeGenTypes::arrangeFreeFunctionType (CanQual<FunctionProtoType> FTP) {
224
- SmallVector<CanQualType, 16 > argTypes;
228
+ CanQualTypeList argTypes;
225
229
return ::arrangeLLVMFunctionInfo (*this , /* instanceMethod=*/ false , argTypes,
226
230
FTP);
227
231
}
@@ -319,7 +323,7 @@ const CGFunctionInfo &
319
323
CodeGenTypes::arrangeCXXMethodType (const CXXRecordDecl *RD,
320
324
const FunctionProtoType *FTP,
321
325
const CXXMethodDecl *MD) {
322
- SmallVector<CanQualType, 16 > argTypes;
326
+ CanQualTypeList argTypes;
323
327
324
328
// Add the 'this' pointer.
325
329
argTypes.push_back (DeriveThisType (RD, MD));
@@ -375,8 +379,8 @@ const CGFunctionInfo &
375
379
CodeGenTypes::arrangeCXXStructorDeclaration (GlobalDecl GD) {
376
380
auto *MD = cast<CXXMethodDecl>(GD.getDecl ());
377
381
378
- SmallVector<CanQualType, 16 > argTypes;
379
- SmallVector<FunctionProtoType::ExtParameterInfo, 16 > paramInfos;
382
+ CanQualTypeList argTypes;
383
+ ExtParameterInfoList paramInfos;
380
384
381
385
const CXXRecordDecl *ThisType = getCXXABI ().getThisArgumentTypeForMethod (GD);
382
386
argTypes.push_back (DeriveThisType (ThisType, MD));
@@ -421,26 +425,26 @@ CodeGenTypes::arrangeCXXStructorDeclaration(GlobalDecl GD) {
421
425
argTypes, extInfo, paramInfos, required);
422
426
}
423
427
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;
427
431
for (auto &arg : args)
428
432
argTypes.push_back (ctx.getCanonicalParamType (arg.Ty ));
429
433
return argTypes;
430
434
}
431
435
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;
435
439
for (auto &arg : args)
436
440
argTypes.push_back (ctx.getCanonicalParamType (arg->getType ()));
437
441
return argTypes;
438
442
}
439
443
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;
444
448
if (proto->hasExtParameterInfos ()) {
445
449
addExtParameterInfosForCall (result, proto, prefixArgs, totalArgs);
446
450
}
@@ -462,8 +466,7 @@ CodeGenTypes::arrangeCXXConstructorCall(const CallArgList &args,
462
466
unsigned ExtraPrefixArgs,
463
467
unsigned ExtraSuffixArgs,
464
468
bool PassProtoArgs) {
465
- // FIXME: Kill copy.
466
- SmallVector<CanQualType, 16 > ArgTypes;
469
+ CanQualTypeList ArgTypes;
467
470
for (const auto &Arg : args)
468
471
ArgTypes.push_back (Context.getCanonicalParamType (Arg.Ty ));
469
472
@@ -483,7 +486,7 @@ CodeGenTypes::arrangeCXXConstructorCall(const CallArgList &args,
483
486
: Context.VoidTy ;
484
487
485
488
FunctionType::ExtInfo Info = FPT->getExtInfo ();
486
- llvm::SmallVector<FunctionProtoType::ExtParameterInfo, 16 > ParamInfos;
489
+ ExtParameterInfoList ParamInfos;
487
490
// If the prototype args are elided, we should only have ABI-specific args,
488
491
// which never have param info.
489
492
if (PassProtoArgs && FPT->hasExtParameterInfos ()) {
@@ -546,13 +549,11 @@ CodeGenTypes::arrangeObjCMethodDeclaration(const ObjCMethodDecl *MD) {
546
549
const CGFunctionInfo &
547
550
CodeGenTypes::arrangeObjCMessageSendSignature (const ObjCMethodDecl *MD,
548
551
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 );
552
554
argTys.push_back (Context.getCanonicalParamType (receiverType));
553
555
if (!MD->isDirectMethod ())
554
556
argTys.push_back (Context.getCanonicalParamType (Context.getObjCSelType ()));
555
- // FIXME: Kill copy?
556
557
for (const auto *I : MD->parameters ()) {
557
558
argTys.push_back (Context.getCanonicalParamType (I->getType ()));
558
559
auto extParamInfo = FunctionProtoType::ExtParameterInfo ().withIsNoEscape (
@@ -579,7 +580,7 @@ CodeGenTypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD,
579
580
const CGFunctionInfo &
580
581
CodeGenTypes::arrangeUnprototypedObjCMessageSend (QualType returnType,
581
582
const CallArgList &args) {
582
- auto argTypes = getArgTypesForCall (Context, args);
583
+ CanQualTypeList argTypes = getArgTypesForCall (Context, args);
583
584
FunctionType::ExtInfo einfo;
584
585
585
586
return arrangeLLVMFunctionInfo (GetReturnType (returnType), FnInfoOpts::None,
@@ -641,7 +642,7 @@ arrangeFreeFunctionLikeCall(CodeGenTypes &CGT,
641
642
bool chainCall) {
642
643
assert (args.size () >= numExtraRequiredArgs);
643
644
644
- llvm::SmallVector<FunctionProtoType::ExtParameterInfo, 16 > paramInfos;
645
+ ExtParameterInfoList paramInfos;
645
646
646
647
// In most cases, there are no optional arguments.
647
648
RequiredArgs required = RequiredArgs::All;
@@ -666,8 +667,7 @@ arrangeFreeFunctionLikeCall(CodeGenTypes &CGT,
666
667
required = RequiredArgs (args.size ());
667
668
}
668
669
669
- // FIXME: Kill copy.
670
- SmallVector<CanQualType, 16 > argTypes;
670
+ CanQualTypeList argTypes;
671
671
for (const auto &arg : args)
672
672
argTypes.push_back (CGT.getContext ().getCanonicalParamType (arg.Ty ));
673
673
FnInfoOpts opts = chainCall ? FnInfoOpts::IsChainCall : FnInfoOpts::None;
@@ -700,8 +700,9 @@ CodeGenTypes::arrangeBlockFunctionCall(const CallArgList &args,
700
700
const CGFunctionInfo &
701
701
CodeGenTypes::arrangeBlockFunctionDeclaration (const FunctionProtoType *proto,
702
702
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);
705
706
706
707
return arrangeLLVMFunctionInfo (GetReturnType (proto->getReturnType ()),
707
708
FnInfoOpts::None, argTypes,
@@ -712,8 +713,7 @@ CodeGenTypes::arrangeBlockFunctionDeclaration(const FunctionProtoType *proto,
712
713
const CGFunctionInfo &
713
714
CodeGenTypes::arrangeBuiltinFunctionCall (QualType resultType,
714
715
const CallArgList &args) {
715
- // FIXME: Kill copy.
716
- SmallVector<CanQualType, 16 > argTypes;
716
+ CanQualTypeList argTypes;
717
717
for (const auto &Arg : args)
718
718
argTypes.push_back (Context.getCanonicalParamType (Arg.Ty ));
719
719
return arrangeLLVMFunctionInfo (GetReturnType (resultType), FnInfoOpts::None,
@@ -724,7 +724,7 @@ CodeGenTypes::arrangeBuiltinFunctionCall(QualType resultType,
724
724
const CGFunctionInfo &
725
725
CodeGenTypes::arrangeBuiltinFunctionDeclaration (QualType resultType,
726
726
const FunctionArgList &args) {
727
- auto argTypes = getArgTypesForDeclaration (Context, args);
727
+ CanQualTypeList argTypes = getArgTypesForDeclaration (Context, args);
728
728
729
729
return arrangeLLVMFunctionInfo (GetReturnType (resultType), FnInfoOpts::None,
730
730
argTypes, FunctionType::ExtInfo (), {},
@@ -752,11 +752,10 @@ CodeGenTypes::arrangeCXXMethodCall(const CallArgList &args,
752
752
" Emitting a call with less args than the required prefix?" );
753
753
// Add one to account for `this`. It's a bit awkward here, but we don't count
754
754
// `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 ());
757
757
758
- // FIXME: Kill copy.
759
- auto argTypes = getArgTypesForCall (Context, args);
758
+ CanQualTypeList argTypes = getArgTypesForCall (Context, args);
760
759
761
760
FunctionType::ExtInfo info = proto->getExtInfo ();
762
761
return arrangeLLVMFunctionInfo (GetReturnType (proto->getReturnType ()),
@@ -777,14 +776,14 @@ CodeGenTypes::arrangeCall(const CGFunctionInfo &signature,
777
776
if (signature.arg_size () == args.size ())
778
777
return signature;
779
778
780
- SmallVector<FunctionProtoType::ExtParameterInfo, 16 > paramInfos;
779
+ ExtParameterInfoList paramInfos;
781
780
auto sigParamInfos = signature.getExtParameterInfos ();
782
781
if (!sigParamInfos.empty ()) {
783
782
paramInfos.append (sigParamInfos.begin (), sigParamInfos.end ());
784
783
paramInfos.resize (args.size ());
785
784
}
786
785
787
- auto argTypes = getArgTypesForCall (Context, args);
786
+ CanQualTypeList argTypes = getArgTypesForCall (Context, args);
788
787
789
788
assert (signature.getRequiredArgs ().allowsOptionalArgs ());
790
789
FnInfoOpts opts = FnInfoOpts::None;
0 commit comments