Commits

Slava Pestov committed 9bdb7d377d0
Clean up handling of external declarations, NFC This is the first in a series of patches that fixes some resilience-related issues with synthesized accessors and materializeForSet. Previously we maintained two lists of external declarations encountered while type checking: - ASTContext::ExternalDefinitions - TypeChecker::implicitlyDefinedFunctions The former contained the following: - Imported nominal types from Clang, so that SILGen can emit witness tables - Functions and variables with Clang decls, so that IRGen can instruct Clang to emit them - Synthesized accessors The latter contained synthesized functions for derived conformances. Since the second list was not visible outside Sema, we relied on the Clang importer to add the type that contained the declaration to the ExternalDefinitions list. In practice, we only synthesized members of enums in this manner. Because of this, SILGenModule::emitExternalDefinitions() had special logic to skip members of enums, since it would visit them when visiting the enum itself. Instead, it appears that we can remove implicitlyDefinedFunctions completely, changing usage sites to add the decl to ExternalDefinitions instead, and simplify SILGenModule::emitExternalDefinition() a bit in the process. Also, it looks like we never had Modules appear in ExternalDefinitions, so assert if those come up instead of skipping them.