Skip to content

Commit 33b548f

Browse files
committed
AST: Remove SourceFile::UsedConformances
Sema no longer adds conformances to a per-SourceFile list that it thinks are going to be "used" by SILGen, IRGen and the runtime. Instead, previous commits already ensure that SILGen determines the set of conformances to be emitted, triggering conformance checking as needed.
1 parent 6c04a7a commit 33b548f

File tree

5 files changed

+0
-29
lines changed

5 files changed

+0
-29
lines changed

include/swift/AST/Module.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -983,10 +983,6 @@ class SourceFile final : public FileUnit {
983983
/// If not, we can fast-path module checks.
984984
bool HasImplementationOnlyImports = false;
985985

986-
/// The list of protocol conformances that were "used" within this
987-
/// source file.
988-
llvm::SetVector<NormalProtocolConformance *> UsedConformances;
989-
990986
/// The scope map that describes this source file.
991987
ASTScope *Scope = nullptr;
992988

@@ -1146,17 +1142,6 @@ class SourceFile final : public FileUnit {
11461142

11471143
virtual bool walk(ASTWalker &walker) override;
11481144

1149-
/// Note that the given conformance was used by this source file.
1150-
void addUsedConformance(NormalProtocolConformance *conformance) {
1151-
UsedConformances.insert(conformance);
1152-
}
1153-
1154-
/// Retrieve the set of conformances that were used in this source
1155-
/// file.
1156-
ArrayRef<NormalProtocolConformance *> getUsedConformances() const {
1157-
return UsedConformances.getArrayRef();
1158-
}
1159-
11601145
/// @{
11611146

11621147
/// Look up the given operator in this file.

include/swift/Basic/Statistics.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@ FRONTEND_STATISTIC(AST, NumPrefixOperators)
141141
/// Number of precedence groups in the AST context.
142142
FRONTEND_STATISTIC(AST, NumPrecedenceGroups)
143143

144-
/// Number of conformances used by code processed by this frontend job.
145-
FRONTEND_STATISTIC(AST, NumUsedConformances)
146-
147144
/// Number of full function bodies parsed.
148145
FRONTEND_STATISTIC(Parse, NumFunctionsParsed)
149146

lib/FrontendTool/FrontendTool.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,6 @@ static void countStatsOfSourceFile(UnifiedStatsReporter &Stats,
478478
C.NumPostfixOperators += SF->PostfixOperators.size();
479479
C.NumPrefixOperators += SF->PrefixOperators.size();
480480
C.NumPrecedenceGroups += SF->PrecedenceGroups.size();
481-
C.NumUsedConformances += SF->getUsedConformances().size();
482481

483482
auto bufID = SF->getBufferID();
484483
if (bufID.hasValue()) {

lib/SILGen/SILGen.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,10 +1688,6 @@ void SILGenModule::emitSourceFile(SourceFile *sf) {
16881688
FrontendStatsTracer StatsTracer(getASTContext().Stats, "SILgen-tydecl", D);
16891689
visit(D);
16901690
}
1691-
1692-
// Mark any conformances as "used".
1693-
for (auto conformance : sf->getUsedConformances())
1694-
useConformance(ProtocolConformanceRef(conformance));
16951691
}
16961692

16971693
//===----------------------------------------------------------------------===//

lib/Sema/TypeCheckProtocol.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4289,12 +4289,6 @@ void TypeChecker::markConformanceUsed(ProtocolConformanceRef conformance,
42894289
// Make sure that the type checker completes this conformance.
42904290
if (normalConformance->isIncomplete())
42914291
UsedConformances.insert(normalConformance);
4292-
4293-
// Record the usage of this conformance in the enclosing source
4294-
// file.
4295-
if (auto sf = dc->getParentSourceFile()) {
4296-
sf->addUsedConformance(normalConformance);
4297-
}
42984292
}
42994293
}
43004294

0 commit comments

Comments
 (0)