@@ -7254,9 +7254,10 @@ class GenericTypeParamType : public SubstitutableType,
72547254 Identifier Name;
72557255 };
72567256
7257- unsigned Depth : 15 ;
72587257 unsigned IsDecl : 1 ;
7259- unsigned Index : 16 ;
7258+ unsigned Depth : 15 ;
7259+ unsigned Weight : 1 ;
7260+ unsigned Index : 15 ;
72607261
72617262 // / The kind of generic type parameter this is.
72627263 GenericTypeParamKind ParamKind;
@@ -7281,15 +7282,21 @@ class GenericTypeParamType : public SubstitutableType,
72817282 Type valueType, const ASTContext &ctx);
72827283
72837284 // / Retrieve a canonical generic type parameter with the given kind, depth,
7284- // / index, and optional value type.
7285+ // / index, weight, and optional value type.
72857286 static GenericTypeParamType *get (GenericTypeParamKind paramKind,
7286- unsigned depth, unsigned index,
7287+ unsigned depth, unsigned index, unsigned weight,
72877288 Type valueType, const ASTContext &ctx);
72887289
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.
72907292 static GenericTypeParamType *getType (unsigned depth, unsigned index,
72917293 const ASTContext &ctx);
72927294
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+
72937300 // / Retrieve a canonical generic parameter pack at the given depth and index.
72947301 static GenericTypeParamType *getPack (unsigned depth, unsigned index,
72957302 const ASTContext &ctx);
@@ -7345,6 +7352,14 @@ class GenericTypeParamType : public SubstitutableType,
73457352 return Index;
73467353 }
73477354
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+
73487363 // / Returns \c true if this type parameter is declared as a pack.
73497364 // /
73507365 // / \code
@@ -7366,20 +7381,24 @@ class GenericTypeParamType : public SubstitutableType,
73667381
73677382 Type getValueType () const ;
73687383
7384+ GenericTypeParamType *withDepth (unsigned depth) const ;
7385+
73697386 void Profile (llvm::FoldingSetNodeID &ID) {
73707387 // Note: We explicitly don't use 'getName()' because for canonical forms
73717388 // which don't store an identifier we'll go create a tau based form. We
73727389 // really want to just plumb down the null Identifier because that's what's
73737390 // inside the cache.
7374- Profile (ID, getParamKind (), getDepth (), getIndex (), getValueType (),
7375- Name);
7391+ Profile (ID, getParamKind (), getDepth (), getIndex (), getWeight (),
7392+ getValueType (), Name);
73767393 }
73777394 static void Profile (llvm::FoldingSetNodeID &ID,
73787395 GenericTypeParamKind paramKind, unsigned depth,
7379- unsigned index, Type valueType, Identifier name) {
7396+ unsigned index, unsigned weight, Type valueType,
7397+ Identifier name) {
73807398 ID.AddInteger ((uint8_t )paramKind);
73817399 ID.AddInteger (depth);
73827400 ID.AddInteger (index);
7401+ ID.AddInteger (weight);
73837402 ID.AddPointer (valueType.getPointer ());
73847403 ID.AddPointer (name.get ());
73857404 }
@@ -7402,7 +7421,7 @@ class GenericTypeParamType : public SubstitutableType,
74027421 const ASTContext &ctx);
74037422
74047423 explicit GenericTypeParamType (GenericTypeParamKind paramKind, unsigned depth,
7405- unsigned index, Type valueType,
7424+ unsigned index, unsigned weight, Type valueType,
74067425 RecursiveTypeProperties props,
74077426 const ASTContext &ctx);
74087427};
@@ -7412,6 +7431,11 @@ static CanGenericTypeParamType getType(unsigned depth, unsigned index,
74127431 return CanGenericTypeParamType (
74137432 GenericTypeParamType::getType (depth, index, C));
74147433}
7434+ static CanGenericTypeParamType getOpaqueResultType (unsigned depth, unsigned index,
7435+ const ASTContext &C) {
7436+ return CanGenericTypeParamType (
7437+ GenericTypeParamType::getOpaqueResultType (depth, index, C));
7438+ }
74157439END_CAN_TYPE_WRAPPER (GenericTypeParamType, SubstitutableType)
74167440
74177441// / A type that refers to a member type of some type that is dependent on a
0 commit comments