@@ -7254,9 +7254,10 @@ class GenericTypeParamType : public SubstitutableType,
7254
7254
Identifier Name;
7255
7255
};
7256
7256
7257
- unsigned Depth : 15 ;
7258
7257
unsigned IsDecl : 1 ;
7259
- unsigned Index : 16 ;
7258
+ unsigned Depth : 15 ;
7259
+ unsigned Weight : 1 ;
7260
+ unsigned Index : 15 ;
7260
7261
7261
7262
// / The kind of generic type parameter this is.
7262
7263
GenericTypeParamKind ParamKind;
@@ -7281,15 +7282,21 @@ class GenericTypeParamType : public SubstitutableType,
7281
7282
Type valueType, const ASTContext &ctx);
7282
7283
7283
7284
// / Retrieve a canonical generic type parameter with the given kind, depth,
7284
- // / index, and optional value type.
7285
+ // / index, weight, and optional value type.
7285
7286
static GenericTypeParamType *get (GenericTypeParamKind paramKind,
7286
- unsigned depth, unsigned index,
7287
+ unsigned depth, unsigned index, unsigned weight,
7287
7288
Type valueType, const ASTContext &ctx);
7288
7289
7289
- // / Retrieve a canonical generic type parameter at the given depth and index.
7290
+ // / Retrieve a canonical generic type parameter at the given depth and index,
7291
+ // / with weight 0.
7290
7292
static GenericTypeParamType *getType (unsigned depth, unsigned index,
7291
7293
const ASTContext &ctx);
7292
7294
7295
+ // / Retrieve a canonical generic type parameter at the given depth and index
7296
+ // / for an opaque result type, so with weight 1.
7297
+ static GenericTypeParamType *getOpaqueResultType (unsigned depth, unsigned index,
7298
+ const ASTContext &ctx);
7299
+
7293
7300
// / Retrieve a canonical generic parameter pack at the given depth and index.
7294
7301
static GenericTypeParamType *getPack (unsigned depth, unsigned index,
7295
7302
const ASTContext &ctx);
@@ -7345,6 +7352,14 @@ class GenericTypeParamType : public SubstitutableType,
7345
7352
return Index;
7346
7353
}
7347
7354
7355
+ // / The weight of this generic parameter in the type parameter order.
7356
+ // /
7357
+ // / Opaque result types have weight 1, while all other generic parameters
7358
+ // / have weight 0.
7359
+ unsigned getWeight () const {
7360
+ return Weight;
7361
+ }
7362
+
7348
7363
// / Returns \c true if this type parameter is declared as a pack.
7349
7364
// /
7350
7365
// / \code
@@ -7366,20 +7381,24 @@ class GenericTypeParamType : public SubstitutableType,
7366
7381
7367
7382
Type getValueType () const ;
7368
7383
7384
+ GenericTypeParamType *withDepth (unsigned depth) const ;
7385
+
7369
7386
void Profile (llvm::FoldingSetNodeID &ID) {
7370
7387
// Note: We explicitly don't use 'getName()' because for canonical forms
7371
7388
// which don't store an identifier we'll go create a tau based form. We
7372
7389
// really want to just plumb down the null Identifier because that's what's
7373
7390
// inside the cache.
7374
- Profile (ID, getParamKind (), getDepth (), getIndex (), getValueType (),
7375
- Name);
7391
+ Profile (ID, getParamKind (), getDepth (), getIndex (), getWeight (),
7392
+ getValueType (), Name);
7376
7393
}
7377
7394
static void Profile (llvm::FoldingSetNodeID &ID,
7378
7395
GenericTypeParamKind paramKind, unsigned depth,
7379
- unsigned index, Type valueType, Identifier name) {
7396
+ unsigned index, unsigned weight, Type valueType,
7397
+ Identifier name) {
7380
7398
ID.AddInteger ((uint8_t )paramKind);
7381
7399
ID.AddInteger (depth);
7382
7400
ID.AddInteger (index);
7401
+ ID.AddInteger (weight);
7383
7402
ID.AddPointer (valueType.getPointer ());
7384
7403
ID.AddPointer (name.get ());
7385
7404
}
@@ -7402,7 +7421,7 @@ class GenericTypeParamType : public SubstitutableType,
7402
7421
const ASTContext &ctx);
7403
7422
7404
7423
explicit GenericTypeParamType (GenericTypeParamKind paramKind, unsigned depth,
7405
- unsigned index, Type valueType,
7424
+ unsigned index, unsigned weight, Type valueType,
7406
7425
RecursiveTypeProperties props,
7407
7426
const ASTContext &ctx);
7408
7427
};
@@ -7412,6 +7431,11 @@ static CanGenericTypeParamType getType(unsigned depth, unsigned index,
7412
7431
return CanGenericTypeParamType (
7413
7432
GenericTypeParamType::getType (depth, index, C));
7414
7433
}
7434
+ static CanGenericTypeParamType getOpaqueResultType (unsigned depth, unsigned index,
7435
+ const ASTContext &C) {
7436
+ return CanGenericTypeParamType (
7437
+ GenericTypeParamType::getOpaqueResultType (depth, index, C));
7438
+ }
7415
7439
END_CAN_TYPE_WRAPPER (GenericTypeParamType, SubstitutableType)
7416
7440
7417
7441
// / A type that refers to a member type of some type that is dependent on a
0 commit comments