File tree Expand file tree Collapse file tree 3 files changed +7
-13
lines changed Expand file tree Collapse file tree 3 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -4107,10 +4107,6 @@ class ProtocolDecl final : public NominalTypeDecl {
4107
4107
// / with the Objective-C runtime.
4108
4108
StringRef getObjCRuntimeName (llvm::SmallVectorImpl<char > &buffer) const ;
4109
4109
4110
- // / Create the implicit generic parameter list for a protocol or
4111
- // / extension thereof.
4112
- GenericParamList *createGenericParams (DeclContext *dc);
4113
-
4114
4110
// / Create the generic parameters of this protocol if the haven't been
4115
4111
// / created yet.
4116
4112
void createGenericParamsIfMissing ();
Original file line number Diff line number Diff line change @@ -4297,14 +4297,17 @@ StringRef ProtocolDecl::getObjCRuntimeName(
4297
4297
return mangleObjCRuntimeName (this , buffer);
4298
4298
}
4299
4299
4300
- GenericParamList *ProtocolDecl::createGenericParams (DeclContext *dc) {
4300
+ void ProtocolDecl::createGenericParamsIfMissing () {
4301
+ if (getGenericParams ())
4302
+ return ;
4303
+
4301
4304
auto *outerGenericParams = getParent ()->getGenericParamsOfContext ();
4302
4305
4303
4306
// The generic parameter 'Self'.
4304
4307
auto &ctx = getASTContext ();
4305
4308
auto selfId = ctx.Id_Self ;
4306
4309
auto selfDecl = new (ctx) GenericTypeParamDecl (
4307
- dc , selfId,
4310
+ this , selfId,
4308
4311
SourceLoc (),
4309
4312
GenericTypeParamDecl::InvalidDepth, /* index=*/ 0 );
4310
4313
auto protoType = getDeclaredType ();
@@ -4316,12 +4319,7 @@ GenericParamList *ProtocolDecl::createGenericParams(DeclContext *dc) {
4316
4319
auto result = GenericParamList::create (ctx, SourceLoc (), selfDecl,
4317
4320
SourceLoc ());
4318
4321
result->setOuterParameters (outerGenericParams);
4319
- return result;
4320
- }
4321
-
4322
- void ProtocolDecl::createGenericParamsIfMissing () {
4323
- if (!getGenericParams ())
4324
- setGenericParams (createGenericParams (this ));
4322
+ setGenericParams (result);
4325
4323
}
4326
4324
4327
4325
void ProtocolDecl::computeRequirementSignature () {
Original file line number Diff line number Diff line change @@ -8053,7 +8053,7 @@ ClangImporter::Implementation::importDeclContextOf(
8053
8053
ext->setMemberLoader (this , reinterpret_cast <uintptr_t >(declSubmodule));
8054
8054
8055
8055
if (auto protoDecl = ext->getExtendedProtocolDecl ()) {
8056
- ext->setGenericParams (protoDecl-> createGenericParams (ext) );
8056
+ ext->createGenericParamsIfMissing (protoDecl);
8057
8057
8058
8058
auto *env = buildGenericEnvironment (ext->getGenericParams (), ext);
8059
8059
ext->setGenericEnvironment (env);
You can’t perform that action at this time.
0 commit comments