Skip to content

Commit 624570d

Browse files
committed
Improve naming of the isResilientConformance flag that disables optimizations
Thank you, Arnold, for talking through this with me.
1 parent 21b2f09 commit 624570d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/IRGen/GenProto.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -960,11 +960,11 @@ namespace {
960960
/// Return true if the witness table requires runtime instantiation to
961961
/// handle resiliently-added requirements with default implementations.
962962
///
963-
/// If ignoreGenericity is true, skip the optimization for non-generic
964-
/// conformances are considered non-resilient.
963+
/// If disableOptimizations is true, skip optimizations that treat
964+
/// formally-resilient conformances as non-resilient.
965965
bool IRGenModule::isResilientConformance(
966966
const NormalProtocolConformance *conformance,
967-
bool ignoreGenericity
967+
bool disableOptimizations
968968
) {
969969
// If the protocol is not resilient, the conformance is not resilient
970970
// either.
@@ -998,17 +998,17 @@ bool IRGenModule::isResilientConformance(
998998
// resiliently become dependent.
999999
if (!conformance->getDeclContext()->isGenericContext() &&
10001000
conformanceModule == conformance->getProtocol()->getParentModule() &&
1001-
!ignoreGenericity)
1001+
!disableOptimizations)
10021002
return false;
10031003

10041004
// We have a resilient conformance.
10051005
return true;
10061006
}
10071007

10081008
bool IRGenModule::isResilientConformance(const RootProtocolConformance *root,
1009-
bool ignoreGenericity) {
1009+
bool disableOptimizations) {
10101010
if (auto normal = dyn_cast<NormalProtocolConformance>(root))
1011-
return isResilientConformance(normal, ignoreGenericity);
1011+
return isResilientConformance(normal, disableOptimizations);
10121012
// Self-conformances never require this.
10131013
return false;
10141014
}
@@ -1193,7 +1193,7 @@ bool IRGenModule::isDependentConformance(
11931193
llvm::SmallPtrSet<const NormalProtocolConformance *, 4> visited;
11941194
return ::isDependentConformance(
11951195
*this, conformance,
1196-
isResilientConformance(conformance, /*ignoreGenericity=*/true),
1196+
isResilientConformance(conformance, /*disableOptimizations=*/true),
11971197
visited);
11981198
}
11991199

lib/IRGen/IRGenModule.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,9 +1120,9 @@ class IRGenModule {
11201120
TypeExpansionContext getMaximalTypeExpansionContext() const;
11211121

11221122
bool isResilientConformance(const NormalProtocolConformance *conformance,
1123-
bool ignoreGenericity = false);
1123+
bool disableOptimizations = false);
11241124
bool isResilientConformance(const RootProtocolConformance *root,
1125-
bool ignoreGenericity = false);
1125+
bool disableOptimizations = false);
11261126
bool isDependentConformance(const RootProtocolConformance *conformance);
11271127

11281128
Alignment getCappedAlignment(Alignment alignment);

0 commit comments

Comments
 (0)