@@ -295,19 +295,6 @@ class alignas(8) Expr {
295
295
NumElements : 16
296
296
);
297
297
298
- SWIFT_INLINE_BITFIELD_FULL (ArgumentShuffleExpr, ImplicitConversionExpr, 2 +16 +16 +16 ,
299
- TypeImpact : 2 ,
300
- : NumPadBits,
301
- NumCallerDefaultArgs : 16 ,
302
- // / This contains an entry for each element in the Expr type. Each element
303
- // / specifies which index from the SubExpr that the destination element gets.
304
- // / If the element value is DefaultInitialize, then the destination value
305
- // / gets the default initializer for that tuple element value.
306
- NumElementMappings : 16 ,
307
- // / The arguments that are packed into the variadic element.
308
- NumVariadicArgs : 16
309
- );
310
-
311
298
SWIFT_INLINE_BITFIELD (ForceValueExpr, Expr, 1 ,
312
299
ForcedIUO : 1
313
300
);
@@ -3020,157 +3007,6 @@ class DestructureTupleExpr final : public ImplicitConversionExpr,
3020
3007
}
3021
3008
};
3022
3009
3023
- // / ArgumentShuffleExpr - This represents a "complex" argument list of an
3024
- // / ApplyExpr, with default arguments or varargs.
3025
- // /
3026
- // / If hasScalarSource() is true, the subexpression should be treated
3027
- // / as if it were implicitly injected into a single-element tuple
3028
- // / type. Otherwise, the subexpression is known to have a tuple type.
3029
- class ArgumentShuffleExpr final : public ImplicitConversionExpr,
3030
- private llvm::TrailingObjects<ArgumentShuffleExpr, Expr *, int , unsigned > {
3031
- friend TrailingObjects;
3032
-
3033
- size_t numTrailingObjects (OverloadToken<Expr *>) const {
3034
- return Bits.ArgumentShuffleExpr .NumCallerDefaultArgs ;
3035
- }
3036
- size_t numTrailingObjects (OverloadToken<int >) const {
3037
- return Bits.ArgumentShuffleExpr .NumElementMappings ;
3038
- }
3039
- size_t numTrailingObjects (OverloadToken<unsigned >) const {
3040
- return Bits.ArgumentShuffleExpr .NumVariadicArgs ;
3041
- }
3042
-
3043
- public:
3044
- enum : int {
3045
- // / The element mapping value indicating that a field of the destination
3046
- // / tuple should be default-initialized.
3047
- DefaultInitialize = -1 ,
3048
- // / The element mapping is part of the variadic field.
3049
- Variadic = -2 ,
3050
- // / The element mapping value indicating that the field of the
3051
- // / destination tuple should be default-initialized with an expression
3052
- // / provided by the caller.
3053
- // / FIXME: Yet another indication that ArgumentShuffleExpr uses the wrong
3054
- // / formulation.
3055
- CallerDefaultInitialize = -3
3056
- };
3057
-
3058
- enum TypeImpact {
3059
- // / The source value is a tuple which is destructured and modified to
3060
- // / create the result, which is a tuple.
3061
- // /
3062
- // / Example: (x: Int) => (x: Int, y: Int = 0).
3063
- TupleToTuple,
3064
-
3065
- // / The source value is a tuple which is destructured and modified to
3066
- // / create the result, which is a scalar because it has one element and
3067
- // / no labels.
3068
- // /
3069
- // / Example: () -> (_: Int = 0)
3070
- // / Another example: (Int, Int) => (_: Int...)
3071
- TupleToScalar,
3072
-
3073
- // / The source value is an individual value (possibly one with tuple
3074
- // / type) which is inserted into a particular position in the result,
3075
- // / which is a tuple.
3076
- // /
3077
- // / Example: (Int) -> (_: Int, y: Int = 0)
3078
- ScalarToTuple
3079
-
3080
- // (ArgumentShuffleExpr are never created for a scalar-to-scalar conversion.)
3081
- };
3082
-
3083
- private:
3084
- // / If we're doing a varargs shuffle, this is the array type to build.
3085
- Type VarargsArrayTy;
3086
-
3087
- // / If there are any default arguments, the owning function
3088
- // / declaration.
3089
- ConcreteDeclRef DefaultArgsOwner;
3090
-
3091
- ArgumentShuffleExpr (Expr *subExpr, ArrayRef<int > elementMapping,
3092
- TypeImpact typeImpact,
3093
- ConcreteDeclRef defaultArgsOwner,
3094
- ArrayRef<unsigned > VariadicArgs,
3095
- Type VarargsArrayTy,
3096
- ArrayRef<Expr *> CallerDefaultArgs,
3097
- Type ty)
3098
- : ImplicitConversionExpr(ExprKind::ArgumentShuffle, subExpr, ty),
3099
- VarargsArrayTy (VarargsArrayTy), DefaultArgsOwner(defaultArgsOwner) {
3100
- Bits.ArgumentShuffleExpr .TypeImpact = typeImpact;
3101
- Bits.ArgumentShuffleExpr .NumCallerDefaultArgs = CallerDefaultArgs.size ();
3102
- Bits.ArgumentShuffleExpr .NumElementMappings = elementMapping.size ();
3103
- Bits.ArgumentShuffleExpr .NumVariadicArgs = VariadicArgs.size ();
3104
- std::uninitialized_copy (CallerDefaultArgs.begin (), CallerDefaultArgs.end (),
3105
- getTrailingObjects<Expr*>());
3106
- std::uninitialized_copy (elementMapping.begin (), elementMapping.end (),
3107
- getTrailingObjects<int >());
3108
- std::uninitialized_copy (VariadicArgs.begin (), VariadicArgs.end (),
3109
- getTrailingObjects<unsigned >());
3110
- }
3111
-
3112
- public:
3113
- static ArgumentShuffleExpr *create (ASTContext &ctx, Expr *subExpr,
3114
- ArrayRef<int > elementMapping,
3115
- TypeImpact typeImpact,
3116
- ConcreteDeclRef defaultArgsOwner,
3117
- ArrayRef<unsigned > VariadicArgs,
3118
- Type VarargsArrayTy,
3119
- ArrayRef<Expr *> CallerDefaultArgs,
3120
- Type ty);
3121
-
3122
- ArrayRef<int > getElementMapping () const {
3123
- return {getTrailingObjects<int >(),
3124
- static_cast <size_t >(Bits.ArgumentShuffleExpr .NumElementMappings )};
3125
- }
3126
-
3127
- // / What is the type impact of this shuffle?
3128
- TypeImpact getTypeImpact () const {
3129
- return TypeImpact (Bits.ArgumentShuffleExpr .TypeImpact );
3130
- }
3131
-
3132
- bool isSourceScalar () const {
3133
- return getTypeImpact () == ScalarToTuple;
3134
- }
3135
-
3136
- bool isResultScalar () const {
3137
- return getTypeImpact () == TupleToScalar;
3138
- }
3139
-
3140
- Type getVarargsArrayType () const {
3141
- assert (!VarargsArrayTy.isNull ());
3142
- return VarargsArrayTy;
3143
- }
3144
- Type getVarargsArrayTypeOrNull () const {
3145
- return VarargsArrayTy;
3146
- }
3147
-
3148
- // / Retrieve the argument indices for the variadic arguments.
3149
- ArrayRef<unsigned > getVariadicArgs () const {
3150
- return {getTrailingObjects<unsigned >(),
3151
- static_cast <size_t >(Bits.ArgumentShuffleExpr .NumVariadicArgs )};
3152
- }
3153
-
3154
- // / Retrieve the owner of the default arguments.
3155
- ConcreteDeclRef getDefaultArgsOwner () const { return DefaultArgsOwner; }
3156
-
3157
- // / Retrieve the caller-defaulted arguments.
3158
- ArrayRef<Expr *> getCallerDefaultArgs () const {
3159
- return {getTrailingObjects<Expr*>(),
3160
- static_cast <size_t >(Bits.ArgumentShuffleExpr .NumCallerDefaultArgs )};
3161
- }
3162
-
3163
- // / Retrieve the caller-defaulted arguments.
3164
- MutableArrayRef<Expr *> getCallerDefaultArgs () {
3165
- return {getTrailingObjects<Expr*>(),
3166
- static_cast <size_t >(Bits.ArgumentShuffleExpr .NumCallerDefaultArgs )};
3167
- }
3168
-
3169
- static bool classof (const Expr *E) {
3170
- return E->getKind () == ExprKind::ArgumentShuffle;
3171
- }
3172
- };
3173
-
3174
3010
// / LoadExpr - Turn an l-value into an r-value by performing a "load"
3175
3011
// / operation. This operation may actually be a logical operation,
3176
3012
// / i.e. one implemented using a call to a potentially user-defined
@@ -4123,8 +3959,7 @@ class ApplyExpr : public Expr {
4123
3959
llvm::PointerIntPair<Expr *, 1 , bool > ArgAndIsSuper;
4124
3960
4125
3961
// / Returns true if \c e could be used as the call's argument. For most \c ApplyExpr
4126
- // / subclasses, this means it is a \c ParenExpr, \c TupleExpr, or
4127
- // / \c ArgumentShuffleExpr.
3962
+ // / subclasses, this means it is a \c ParenExpr or \c TupleExpr.
4128
3963
bool validateArg (Expr *e) const ;
4129
3964
4130
3965
protected:
@@ -5504,7 +5339,7 @@ inline bool ApplyExpr::validateArg(Expr *e) const {
5504
5339
else if (isa<BinaryExpr>(this ))
5505
5340
return isa<TupleExpr>(e);
5506
5341
else
5507
- return isa<ParenExpr>(e) || isa<TupleExpr>(e) || isa<ArgumentShuffleExpr>(e) ;
5342
+ return isa<ParenExpr>(e) || isa<TupleExpr>(e);
5508
5343
}
5509
5344
5510
5345
inline Expr *const *CollectionExpr::getTrailingObjectsPointer () const {
0 commit comments