@@ -1882,7 +1882,6 @@ namespace {
1882
1882
class MultiConformanceChecker {
1883
1883
ASTContext &Context;
1884
1884
llvm::SmallVector<ValueDecl*, 16 > UnsatisfiedReqs;
1885
- llvm::SmallVector<ConformanceChecker, 4 > AllUsedCheckers;
1886
1885
llvm::SmallVector<NormalProtocolConformance*, 4 > AllConformances;
1887
1886
llvm::SmallPtrSet<ValueDecl *, 8 > CoveredMembers;
1888
1887
@@ -1897,13 +1896,6 @@ class MultiConformanceChecker {
1897
1896
public:
1898
1897
MultiConformanceChecker (ASTContext &ctx) : Context(ctx) {}
1899
1898
1900
- ~MultiConformanceChecker () {
1901
- // Emit diagnostics at the very end.
1902
- for (auto &checker : AllUsedCheckers) {
1903
- emitDelayedDiags (checker.Conformance );
1904
- }
1905
- }
1906
-
1907
1899
ASTContext &getASTContext () const { return Context; }
1908
1900
1909
1901
// / Add a conformance into the batched checker.
@@ -1975,7 +1967,7 @@ static void diagnoseProtocolStubFixit(
1975
1967
ArrayRef<ASTContext::MissingWitness> missingWitnesses);
1976
1968
1977
1969
void MultiConformanceChecker::checkAllConformances () {
1978
- llvm::SetVector <ASTContext::MissingWitness> MissingWitnesses;
1970
+ llvm::SmallVector <ASTContext::MissingWitness, 2 > MissingWitnesses;
1979
1971
1980
1972
bool anyInvalid = false ;
1981
1973
for (auto *conformance : AllConformances) {
@@ -2000,7 +1992,7 @@ void MultiConformanceChecker::checkAllConformances() {
2000
1992
if (LocalMissing.empty ())
2001
1993
continue ;
2002
1994
2003
- MissingWitnesses.insert (LocalMissing.begin (), LocalMissing.end ());
1995
+ MissingWitnesses.append (LocalMissing.begin (), LocalMissing.end ());
2004
1996
2005
1997
// Diagnose the missing witnesses.
2006
1998
for (auto &Missing : LocalMissing) {
@@ -2022,19 +2014,21 @@ void MultiConformanceChecker::checkAllConformances() {
2022
2014
}
2023
2015
}
2024
2016
2025
- // If there were no missing witnesses, we're done.
2026
- if (MissingWitnesses.empty ())
2027
- return ;
2028
-
2029
- // Otherwise, backtrack to the last checker that has missing witnesses
2030
- // and diagnose missing witnesses from there.
2031
- for (auto *conformance : llvm::reverse (AllConformances)) {
2032
- if (Context.hasDelayedConformanceErrors (conformance)) {
2033
- diagnoseProtocolStubFixit (Context, conformance,
2034
- MissingWitnesses.getArrayRef ());
2035
- break ;
2017
+ // Emit missing witness fixits for all conformances in the batch.
2018
+ if (!MissingWitnesses.empty ()) {
2019
+ for (auto *conformance : llvm::reverse (AllConformances)) {
2020
+ if (Context.hasDelayedConformanceErrors (conformance)) {
2021
+ diagnoseProtocolStubFixit (Context, conformance,
2022
+ MissingWitnesses);
2023
+ break ;
2024
+ }
2036
2025
}
2037
2026
}
2027
+
2028
+ // Emit diagnostics at the very end.
2029
+ for (auto *conformance : AllConformances) {
2030
+ emitDelayedDiags (conformance);
2031
+ }
2038
2032
}
2039
2033
2040
2034
static void diagnoseConformanceImpliedByConditionalConformance (
@@ -2404,9 +2398,8 @@ checkIndividualConformance(NormalProtocolConformance *conformance) {
2404
2398
if (conformance->isComplete ())
2405
2399
return ;
2406
2400
2407
- // The conformance checker we're using.
2408
- AllUsedCheckers.emplace_back (getASTContext (), conformance);
2409
- AllUsedCheckers.back ().checkConformance ();
2401
+ ConformanceChecker checker (getASTContext (), conformance);
2402
+ checker.checkConformance ();
2410
2403
}
2411
2404
2412
2405
// / Add the next associated type deduction to the string representation
0 commit comments