@@ -4560,26 +4560,6 @@ class CodeGenFunction : public CodeGenTypeCache {
4560
4560
Address Loc);
4561
4561
4562
4562
public:
4563
- #ifndef NDEBUG
4564
- // Determine whether the given argument is an Objective-C method
4565
- // that may have type parameters in its signature.
4566
- static bool isObjCMethodWithTypeParams (const ObjCMethodDecl *method) {
4567
- const DeclContext *dc = method->getDeclContext ();
4568
- if (const ObjCInterfaceDecl *classDecl= dyn_cast<ObjCInterfaceDecl>(dc)) {
4569
- return classDecl->getTypeParamListAsWritten ();
4570
- }
4571
-
4572
- if (const ObjCCategoryDecl *catDecl = dyn_cast<ObjCCategoryDecl>(dc)) {
4573
- return catDecl->getTypeParamList ();
4574
- }
4575
-
4576
- return false ;
4577
- }
4578
-
4579
- template <typename T>
4580
- static bool isObjCMethodWithTypeParams (const T *) { return false ; }
4581
- #endif
4582
-
4583
4563
enum class EvaluationOrder {
4584
4564
// /! No language constraints on evaluation order.
4585
4565
Default,
@@ -4589,56 +4569,16 @@ class CodeGenFunction : public CodeGenTypeCache {
4589
4569
ForceRightToLeft
4590
4570
};
4591
4571
4592
- // / EmitCallArgs - Emit call arguments for a function.
4593
- template <typename T>
4594
- void EmitCallArgs (CallArgList &Args, const T *CallArgTypeInfo,
4595
- llvm::iterator_range<CallExpr::const_arg_iterator> ArgRange,
4596
- AbstractCallee AC = AbstractCallee(),
4597
- unsigned ParamsToSkip = 0,
4598
- EvaluationOrder Order = EvaluationOrder::Default) {
4599
- SmallVector<QualType, 16 > ArgTypes;
4600
- CallExpr::const_arg_iterator Arg = ArgRange.begin ();
4601
-
4602
- assert ((ParamsToSkip == 0 || CallArgTypeInfo) &&
4603
- " Can't skip parameters if type info is not provided" );
4604
- if (CallArgTypeInfo) {
4605
- #ifndef NDEBUG
4606
- bool isGenericMethod = isObjCMethodWithTypeParams (CallArgTypeInfo);
4607
- #endif
4608
-
4609
- // First, use the argument types that the type info knows about
4610
- for (auto I = CallArgTypeInfo->param_type_begin () + ParamsToSkip,
4611
- E = CallArgTypeInfo->param_type_end ();
4612
- I != E; ++I, ++Arg) {
4613
- assert (Arg != ArgRange.end () && " Running over edge of argument list!" );
4614
- assert ((isGenericMethod ||
4615
- ((*I)->isVariablyModifiedType () ||
4616
- (*I).getNonReferenceType ()->isObjCRetainableType () ||
4617
- getContext ()
4618
- .getCanonicalType ((*I).getNonReferenceType ())
4619
- .getTypePtr () ==
4620
- getContext ()
4621
- .getCanonicalType ((*Arg)->getType ())
4622
- .getTypePtr ())) &&
4623
- " type mismatch in call argument!" );
4624
- ArgTypes.push_back (*I);
4625
- }
4626
- }
4627
-
4628
- // Either we've emitted all the call args, or we have a call to variadic
4629
- // function.
4630
- assert ((Arg == ArgRange.end () || !CallArgTypeInfo ||
4631
- CallArgTypeInfo->isVariadic ()) &&
4632
- " Extra arguments in non-variadic function!" );
4633
-
4634
- // If we still have any arguments, emit them using the type of the argument.
4635
- for (auto *A : llvm::make_range (Arg, ArgRange.end ()))
4636
- ArgTypes.push_back (CallArgTypeInfo ? getVarArgType (A) : A->getType ());
4572
+ // Wrapper for function prototype sources. Wraps either a FunctionProtoType or
4573
+ // an ObjCMethodDecl.
4574
+ struct PrototypeWrapper {
4575
+ llvm::PointerUnion<const FunctionProtoType *, const ObjCMethodDecl *> P;
4637
4576
4638
- EmitCallArgs (Args, ArgTypes, ArgRange, AC, ParamsToSkip, Order);
4639
- }
4577
+ PrototypeWrapper (const FunctionProtoType *FT) : P(FT) {}
4578
+ PrototypeWrapper (const ObjCMethodDecl *MD) : P(MD) {}
4579
+ };
4640
4580
4641
- void EmitCallArgs (CallArgList &Args, ArrayRef<QualType> ArgTypes ,
4581
+ void EmitCallArgs (CallArgList &Args, PrototypeWrapper Prototype ,
4642
4582
llvm::iterator_range<CallExpr::const_arg_iterator> ArgRange,
4643
4583
AbstractCallee AC = AbstractCallee(),
4644
4584
unsigned ParamsToSkip = 0,
0 commit comments