@@ -913,8 +913,7 @@ static VarDecl *getPointeeProperty(VarDecl *&cache,
913913 NominalTypeDecl *nominal = (ctx.*getNominal)();
914914 if (!nominal) return nullptr ;
915915 auto sig = nominal->getGenericSignature ();
916- if (!sig) return nullptr ;
917- if (sig->getGenericParams ().size () != 1 ) return nullptr ;
916+ if (sig.getGenericParams ().size () != 1 ) return nullptr ;
918917
919918 // There must be a property named "pointee".
920919 auto identifier = ctx.getIdentifier (" pointee" );
@@ -924,7 +923,7 @@ static VarDecl *getPointeeProperty(VarDecl *&cache,
924923 // The property must have type T.
925924 auto *property = dyn_cast<VarDecl>(results[0 ]);
926925 if (!property) return nullptr ;
927- if (!property->getInterfaceType ()->isEqual (sig-> getGenericParams ()[0 ]))
926+ if (!property->getInterfaceType ()->isEqual (sig. getGenericParams ()[0 ]))
928927 return nullptr ;
929928
930929 cache = property;
@@ -1776,8 +1775,8 @@ static AllocationArena getArena(GenericSignature genericSig) {
17761775 if (!genericSig)
17771776 return AllocationArena::Permanent;
17781777
1779- if (genericSig-> hasTypeVariable ()) {
1780- assert (false && " What's going on " );
1778+ if (genericSig. hasTypeVariable ()) {
1779+ assert (false && " Unsubstituted type variable leaked into generic signature " );
17811780 return AllocationArena::ConstraintSolver;
17821781 }
17831782
@@ -1844,13 +1843,13 @@ GenericSignatureBuilder *ASTContext::getOrCreateGenericSignatureBuilder(
18441843 reprocessedSig->print (llvm::errs ());
18451844 llvm::errs () << " \n " ;
18461845
1847- if (sig-> getGenericParams ().size () ==
1848- reprocessedSig-> getGenericParams ().size () &&
1849- sig-> getRequirements ().size () ==
1850- reprocessedSig-> getRequirements ().size ()) {
1851- for (unsigned i : indices (sig-> getRequirements ())) {
1852- auto sigReq = sig-> getRequirements ()[i];
1853- auto reprocessedReq = reprocessedSig-> getRequirements ()[i];
1846+ if (sig. getGenericParams ().size () ==
1847+ reprocessedSig. getGenericParams ().size () &&
1848+ sig. getRequirements ().size () ==
1849+ reprocessedSig. getRequirements ().size ()) {
1850+ for (unsigned i : indices (sig. getRequirements ())) {
1851+ auto sigReq = sig. getRequirements ()[i];
1852+ auto reprocessedReq = reprocessedSig. getRequirements ()[i];
18541853 if (sigReq.getKind () != reprocessedReq.getKind ()) {
18551854 llvm::errs () << " Requirement mismatch:\n " ;
18561855 llvm::errs () << " Original: " ;
@@ -1895,7 +1894,7 @@ GenericSignatureBuilder *ASTContext::getOrCreateGenericSignatureBuilder(
18951894
18961895RequirementMachine *ASTContext::getOrCreateRequirementMachine (
18971896 CanGenericSignature sig) {
1898- assert (!sig-> hasTypeVariable ());
1897+ assert (!sig. hasTypeVariable ());
18991898
19001899 auto &rewriteCtx = getImpl ().TheRewriteContext ;
19011900 if (!rewriteCtx)
@@ -3608,12 +3607,12 @@ GenericTypeParamType *GenericTypeParamType::get(unsigned depth, unsigned index,
36083607
36093608TypeArrayView<GenericTypeParamType>
36103609GenericFunctionType::getGenericParams () const {
3611- return Signature-> getGenericParams ();
3610+ return Signature. getGenericParams ();
36123611}
36133612
36143613// / Retrieve the requirements of this polymorphic function type.
36153614ArrayRef<Requirement> GenericFunctionType::getRequirements () const {
3616- return Signature-> getRequirements ();
3615+ return Signature. getRequirements ();
36173616}
36183617
36193618void SILFunctionType::Profile (
@@ -3747,7 +3746,7 @@ SILFunctionType::SILFunctionType(
37473746 " If all generic parameters are concrete, SILFunctionType should "
37483747 " not have a generic signature at all" );
37493748
3750- for (auto gparam : genericSig-> getGenericParams ()) {
3749+ for (auto gparam : genericSig. getGenericParams ()) {
37513750 (void )gparam;
37523751 assert (gparam->isCanonical () && " generic signature is not canonicalized" );
37533752 }
@@ -4123,7 +4122,7 @@ OpaqueTypeArchetypeType::get(OpaqueTypeDecl *Decl,
41234122 // Same-type-constrain the arguments in the outer signature to their
41244123 // replacements in the substitution map.
41254124 if (auto outerSig = Decl->getGenericSignature ()) {
4126- for (auto outerParam : outerSig-> getGenericParams ()) {
4125+ for (auto outerParam : outerSig. getGenericParams ()) {
41274126 auto boundType = Type (outerParam).subst (Substitutions);
41284127 newRequirements.push_back (
41294128 Requirement (RequirementKind::SameType, Type (outerParam), boundType));
@@ -4138,7 +4137,7 @@ OpaqueTypeArchetypeType::get(OpaqueTypeDecl *Decl,
41384137 (void )newRequirements;
41394138# ifndef NDEBUG
41404139 for (auto reqt :
4141- Decl->getOpaqueInterfaceGenericSignature ()-> getRequirements ()) {
4140+ Decl->getOpaqueInterfaceGenericSignature (). getRequirements ()) {
41424141 auto reqtBase = reqt.getFirstType ()->getRootGenericParam ();
41434142 if (reqtBase->isEqual (Decl->getUnderlyingInterfaceType ())) {
41444143 assert (reqt.getKind () != RequirementKind::SameType
@@ -4261,7 +4260,7 @@ GenericEnvironment *OpenedArchetypeType::getGenericEnvironment() const {
42614260 // Create a generic environment to represent the opened type.
42624261 auto signature = ctx.getOpenedArchetypeSignature (Opened);
42634262 auto *env = GenericEnvironment::getIncomplete (signature);
4264- env->addMapping (signature-> getGenericParams ()[ 0 ] , thisType);
4263+ env->addMapping (signature. getGenericParams (). front (). getPointer () , thisType);
42654264 Environment = env;
42664265
42674266 return env;
@@ -4419,7 +4418,7 @@ GenericEnvironment *GenericEnvironment::getIncomplete(
44194418 auto &ctx = signature->getASTContext ();
44204419
44214420 // Allocate and construct the new environment.
4422- unsigned numGenericParams = signature-> getGenericParams ().size ();
4421+ unsigned numGenericParams = signature. getGenericParams ().size ();
44234422 size_t bytes = totalSizeToAlloc<Type>(numGenericParams);
44244423 void *mem = ctx.Allocate (bytes, alignof (GenericEnvironment));
44254424 return new (mem) GenericEnvironment (signature);
@@ -4913,7 +4912,7 @@ CanGenericSignature ASTContext::getOpenedArchetypeSignature(Type type) {
49134912 // The opened archetype signature for a protocol type is identical
49144913 // to the protocol's own canonical generic signature.
49154914 if (const auto protoTy = dyn_cast<ProtocolType>(existential)) {
4916- return protoTy->getDecl ()->getGenericSignature ()-> getCanonicalSignature ();
4915+ return protoTy->getDecl ()->getGenericSignature (). getCanonicalSignature ();
49174916 }
49184917
49194918 auto found = getImpl ().ExistentialSignatures .find (existential);
@@ -4982,9 +4981,9 @@ ASTContext::getOverrideGenericSignature(const ValueDecl *base,
49824981 unsigned derivedDepth = 0 ;
49834982 unsigned baseDepth = 0 ;
49844983 if (derivedClassSig)
4985- derivedDepth = derivedClassSig-> getGenericParams ().back ()->getDepth () + 1 ;
4984+ derivedDepth = derivedClassSig. getGenericParams ().back ()->getDepth () + 1 ;
49864985 if (const auto baseClassSig = baseClass->getGenericSignature ())
4987- baseDepth = baseClassSig-> getGenericParams ().back ()->getDepth () + 1 ;
4986+ baseDepth = baseClassSig. getGenericParams ().back ()->getDepth () + 1 ;
49884987
49894988 SmallVector<GenericTypeParamType *, 2 > addedGenericParams;
49904989 if (const auto *gpList = derived->getAsGenericContext ()->getGenericParams ()) {
@@ -5018,7 +5017,7 @@ ASTContext::getOverrideGenericSignature(const ValueDecl *base,
50185017 };
50195018
50205019 SmallVector<Requirement, 2 > addedRequirements;
5021- for (auto reqt : baseGenericSig-> getRequirements ()) {
5020+ for (auto reqt : baseGenericSig. getRequirements ()) {
50225021 if (auto substReqt = reqt.subst (substFn, lookupConformanceFn)) {
50235022 addedRequirements.push_back (*substReqt);
50245023 }
@@ -5116,7 +5115,7 @@ CanSILBoxType SILBoxType::get(ASTContext &C,
51165115CanSILBoxType SILBoxType::get (CanType boxedType) {
51175116 auto &ctx = boxedType->getASTContext ();
51185117 auto singleGenericParamSignature = ctx.getSingleGenericParameterSignature ();
5119- auto genericParam = singleGenericParamSignature-> getGenericParams ()[0 ];
5118+ auto genericParam = singleGenericParamSignature. getGenericParams ()[0 ];
51205119 auto layout = SILLayout::get (ctx, singleGenericParamSignature,
51215120 SILField (CanType (genericParam),
51225121 /* mutable*/ true ));
@@ -5274,9 +5273,7 @@ AutoDiffDerivativeFunctionIdentifier *AutoDiffDerivativeFunctionIdentifier::get(
52745273 llvm::FoldingSetNodeID id;
52755274 id.AddInteger ((unsigned )kind);
52765275 id.AddPointer (parameterIndices);
5277- CanGenericSignature derivativeCanGenSig;
5278- if (derivativeGenericSignature)
5279- derivativeCanGenSig = derivativeGenericSignature->getCanonicalSignature ();
5276+ auto derivativeCanGenSig = derivativeGenericSignature.getCanonicalSignature ();
52805277 id.AddPointer (derivativeCanGenSig.getPointer ());
52815278
52825279 void *insertPos;
0 commit comments