[AST] Lazily compute ProtocolDecl::getKnownProtocolKind()

Rather than eagerly doing a bunch of name lookups to establish the known
protocol kind, lazily match the ProtocolDecl to the list of known
protocols as-needed. This eliminates a bunch of up-front unqualified
name lookups when spinning up a type checker.
This commit is contained in:
Doug Gregor
2019-02-04 20:30:23 -08:00
parent 1b4b7390ba
commit d19d2f2490
6 changed files with 27 additions and 42 deletions

View File

@@ -803,11 +803,6 @@ void CompilerInstance::parseAndCheckTypesUpTo(
options.SwitchCheckingInvocationThreshold);
});
// Even if there were no source files, we should still record known
// protocols.
if (auto *stdlib = Context->getStdlibModule())
Context->recordKnownProtocols(stdlib);
if (Invocation.isCodeCompletion()) {
performDelayedParsing(MainModule, PersistentState,
Invocation.getCodeCompletionFactory());