[ModulePrint] Add the initial implementation for printing synthesized extensions.

For a concrete type, members from its conforming protocols' extensions can be hard
to manually surface. In this commit, when printing Swift modules, we start to replicate these
extensions and synthesize them as if they are the concrete type's native extensions.

Credit to Doug for suggesting this practice.
This commit is contained in:
Xi Ge
2016-01-27 13:45:29 -08:00
parent 35bce55e62
commit ae60159816
9 changed files with 353 additions and 66 deletions

View File

@@ -40,13 +40,15 @@ typedef OptionSet<ModuleTraversal> ModuleTraversalOptions;
void printModuleInterface(ModuleDecl *M,
ModuleTraversalOptions TraversalOptions,
ASTPrinter &Printer, const PrintOptions &Options);
ASTPrinter &Printer, const PrintOptions &Options,
const bool PrintSynthesizedExtensions);
// FIXME: this API should go away when Swift can represent Clang submodules as
// 'swift::Module *' objects.
void printSubmoduleInterface(ModuleDecl *M, ArrayRef<StringRef> FullModuleName,
ModuleTraversalOptions TraversalOptions,
ASTPrinter &Printer, const PrintOptions &Options);
ASTPrinter &Printer, const PrintOptions &Options,
const bool PrintSynthesizedExtensions);
/// Print the interface for a header that has been imported via the implicit
/// objc header importing feature.