@@ -4606,26 +4606,6 @@ class CodeGenFunction : public CodeGenTypeCache {
4606
4606
Address Loc);
4607
4607
4608
4608
public:
4609
- #ifndef NDEBUG
4610
- // Determine whether the given argument is an Objective-C method
4611
- // that may have type parameters in its signature.
4612
- static bool isObjCMethodWithTypeParams (const ObjCMethodDecl *method) {
4613
- const DeclContext *dc = method->getDeclContext ();
4614
- if (const ObjCInterfaceDecl *classDecl= dyn_cast<ObjCInterfaceDecl>(dc)) {
4615
- return classDecl->getTypeParamListAsWritten ();
4616
- }
4617
-
4618
- if (const ObjCCategoryDecl *catDecl = dyn_cast<ObjCCategoryDecl>(dc)) {
4619
- return catDecl->getTypeParamList ();
4620
- }
4621
-
4622
- return false ;
4623
- }
4624
-
4625
- template <typename T>
4626
- static bool isObjCMethodWithTypeParams (const T *) { return false ; }
4627
- #endif
4628
-
4629
4609
enum class EvaluationOrder {
4630
4610
// /! No language constraints on evaluation order.
4631
4611
Default,
@@ -4635,56 +4615,16 @@ class CodeGenFunction : public CodeGenTypeCache {
4635
4615
ForceRightToLeft
4636
4616
};
4637
4617
4638
- // / EmitCallArgs - Emit call arguments for a function.
4639
- template <typename T>
4640
- void EmitCallArgs (CallArgList &Args, const T *CallArgTypeInfo,
4641
- llvm::iterator_range<CallExpr::const_arg_iterator> ArgRange,
4642
- AbstractCallee AC = AbstractCallee(),
4643
- unsigned ParamsToSkip = 0,
4644
- EvaluationOrder Order = EvaluationOrder::Default) {
4645
- SmallVector<QualType, 16 > ArgTypes;
4646
- CallExpr::const_arg_iterator Arg = ArgRange.begin ();
4647
-
4648
- assert ((ParamsToSkip == 0 || CallArgTypeInfo) &&
4649
- " Can't skip parameters if type info is not provided" );
4650
- if (CallArgTypeInfo) {
4651
- #ifndef NDEBUG
4652
- bool isGenericMethod = isObjCMethodWithTypeParams (CallArgTypeInfo);
4653
- #endif
4654
-
4655
- // First, use the argument types that the type info knows about
4656
- for (auto I = CallArgTypeInfo->param_type_begin () + ParamsToSkip,
4657
- E = CallArgTypeInfo->param_type_end ();
4658
- I != E; ++I, ++Arg) {
4659
- assert (Arg != ArgRange.end () && " Running over edge of argument list!" );
4660
- assert ((isGenericMethod ||
4661
- ((*I)->isVariablyModifiedType () ||
4662
- (*I).getNonReferenceType ()->isObjCRetainableType () ||
4663
- getContext ()
4664
- .getCanonicalType ((*I).getNonReferenceType ())
4665
- .getTypePtr () ==
4666
- getContext ()
4667
- .getCanonicalType ((*Arg)->getType ())
4668
- .getTypePtr ())) &&
4669
- " type mismatch in call argument!" );
4670
- ArgTypes.push_back (*I);
4671
- }
4672
- }
4673
-
4674
- // Either we've emitted all the call args, or we have a call to variadic
4675
- // function.
4676
- assert ((Arg == ArgRange.end () || !CallArgTypeInfo ||
4677
- CallArgTypeInfo->isVariadic ()) &&
4678
- " Extra arguments in non-variadic function!" );
4679
-
4680
- // If we still have any arguments, emit them using the type of the argument.
4681
- for (auto *A : llvm::make_range (Arg, ArgRange.end ()))
4682
- ArgTypes.push_back (CallArgTypeInfo ? getVarArgType (A) : A->getType ());
4618
+ // Wrapper for function prototype sources. Wraps either a FunctionProtoType or
4619
+ // an ObjCMethodDecl.
4620
+ struct PrototypeWrapper {
4621
+ llvm::PointerUnion<const FunctionProtoType *, const ObjCMethodDecl *> P;
4683
4622
4684
- EmitCallArgs (Args, ArgTypes, ArgRange, AC, ParamsToSkip, Order);
4685
- }
4623
+ PrototypeWrapper (const FunctionProtoType *FT) : P(FT) {}
4624
+ PrototypeWrapper (const ObjCMethodDecl *MD) : P(MD) {}
4625
+ };
4686
4626
4687
- void EmitCallArgs (CallArgList &Args, ArrayRef<QualType> ArgTypes ,
4627
+ void EmitCallArgs (CallArgList &Args, PrototypeWrapper Prototype ,
4688
4628
llvm::iterator_range<CallExpr::const_arg_iterator> ArgRange,
4689
4629
AbstractCallee AC = AbstractCallee(),
4690
4630
unsigned ParamsToSkip = 0,
0 commit comments