@@ -2282,7 +2282,35 @@ getSILFunctionLanguage(SILFunctionTypeRepresentation rep) {
2282
2282
2283
2283
llvm_unreachable (" Unhandled SILFunctionTypeRepresentation in switch." );
2284
2284
}
2285
-
2285
+
2286
+ // / A call argument or parameter.
2287
+ struct CallArgParam {
2288
+ // / The type of the argument or parameter. For a variadic parameter,
2289
+ // / this is the element type.
2290
+ Type Ty;
2291
+
2292
+ // The label associated with the argument or parameter, if any.
2293
+ Identifier Label;
2294
+
2295
+ // / Whether the parameter has a default argument. Not valid for arguments.
2296
+ bool HasDefaultArgument = false ;
2297
+
2298
+ // / Parameter specific flags, not valid for arguments
2299
+ ParameterTypeFlags parameterFlags = {};
2300
+
2301
+ // / Whether the argument or parameter has a label.
2302
+ bool hasLabel () const { return !Label.empty (); }
2303
+
2304
+ // / Whether the parameter is varargs
2305
+ bool isVariadic () const { return parameterFlags.isVariadic (); }
2306
+
2307
+ // / Whether the parameter is autoclosure
2308
+ bool isAutoClosure () const { return parameterFlags.isAutoClosure (); }
2309
+
2310
+ // / Whether the parameter is escaping
2311
+ bool isEscaping () const { return parameterFlags.isEscaping (); }
2312
+ };
2313
+
2286
2314
// / AnyFunctionType - A function type has a single input and result, but
2287
2315
// / these types may be tuples, for example:
2288
2316
// / "(int) -> int" or "(a : int, b : int) -> (int, int)".
@@ -2295,7 +2323,8 @@ getSILFunctionLanguage(SILFunctionTypeRepresentation rep) {
2295
2323
// / be 'thin', indicating that a function value has no capture context and can be
2296
2324
// / represented at the binary level as a single function pointer.
2297
2325
class AnyFunctionType : public TypeBase {
2298
- const Type Input;
2326
+ const ArrayRef<CallArgParam> Input;
2327
+ const Type RawInput;
2299
2328
const Type Output;
2300
2329
2301
2330
public:
@@ -2441,15 +2470,13 @@ class AnyFunctionType : public TypeBase {
2441
2470
2442
2471
protected:
2443
2472
AnyFunctionType (TypeKind Kind, const ASTContext *CanTypeContext,
2444
- Type Input, Type Output, RecursiveTypeProperties properties,
2445
- const ExtInfo &Info)
2446
- : TypeBase(Kind, CanTypeContext, properties), Input(Input), Output(Output) {
2447
- AnyFunctionTypeBits.ExtInfo = Info.Bits ;
2448
- }
2473
+ ArrayRef<CallArgParam> Input, Type RawInput, Type Output,
2474
+ RecursiveTypeProperties properties,
2475
+ const ExtInfo &Info);
2449
2476
2450
2477
public:
2451
2478
2452
- Type getInput () const { return Input ; }
2479
+ Type getInput () const { return RawInput ; }
2453
2480
Type getResult () const { return Output; }
2454
2481
2455
2482
ExtInfo getExtInfo () const {
@@ -2533,41 +2560,14 @@ BEGIN_CAN_TYPE_WRAPPER(FunctionType, AnyFunctionType)
2533
2560
return CanFunctionType (cast<FunctionType>(getPointer ()->withExtInfo (info)));
2534
2561
}
2535
2562
END_CAN_TYPE_WRAPPER (FunctionType, AnyFunctionType)
2536
-
2537
- // / A call argument or parameter.
2538
- struct CallArgParam {
2539
- // / The type of the argument or parameter. For a variadic parameter,
2540
- // / this is the element type.
2541
- Type Ty;
2542
-
2543
- // The label associated with the argument or parameter, if any.
2544
- Identifier Label;
2545
-
2546
- // / Whether the parameter has a default argument. Not valid for arguments.
2547
- bool HasDefaultArgument = false ;
2548
-
2549
- // / Parameter specific flags, not valid for arguments
2550
- ParameterTypeFlags parameterFlags = {};
2551
-
2552
- // / Whether the argument or parameter has a label.
2553
- bool hasLabel () const { return !Label.empty (); }
2554
-
2555
- // / Whether the parameter is varargs
2556
- bool isVariadic () const { return parameterFlags.isVariadic (); }
2557
-
2558
- // / Whether the parameter is autoclosure
2559
- bool isAutoClosure () const { return parameterFlags.isAutoClosure (); }
2560
-
2561
- // / Whether the parameter is escaping
2562
- bool isEscaping () const { return parameterFlags.isEscaping (); }
2563
- };
2564
-
2563
+
2565
2564
// / Break an argument type into an array of \c CallArgParams.
2566
2565
// /
2567
2566
// / \param type The type to decompose.
2568
2567
// / \param argumentLabels The argument labels to use.
2569
2568
SmallVector<CallArgParam, 4>
2570
- decomposeArgType (Type type, ArrayRef<Identifier> argumentLabels);
2569
+ decomposeArgType(Type type, ArrayRef<Identifier> argumentLabels,
2570
+ bool inAnyFunctionType = false );
2571
2571
2572
2572
// / Break a parameter type into an array of \c CallArgParams.
2573
2573
// /
0 commit comments