[ModuleInterface] Print alias for module names in swiftinterface files

Ambiguities are introduced in generated swiftinterfaces when a type
shares a name with a module (i.e. XCTest). This workaround uses the
module-alias feature to avoid these ambiguities. Writing module
references with a distinguishable prefix should allow normal
type-checking to avoid the usual ambiguities.

We should still aim for a proper fully-qualified named syntax, but this
may help in the mean time.

rdar://101969500
This commit is contained in:
Alexis Laferrière
2022-11-04 11:55:13 -07:00
parent 6d5e1b26fa
commit 66586b5f63
7 changed files with 121 additions and 5 deletions

View File

@@ -33,6 +33,10 @@ struct ModuleInterfaceOptions {
/// interface, or should we fully-qualify them?
bool PreserveTypesAsWritten = false;
/// Use aliases when printing references to modules to avoid ambiguities
/// with types sharing a name with a module.
bool AliasModuleNames = false;
/// See \ref FrontendOptions.PrintFullConvention.
/// [TODO: Clang-type-plumbing] This check should go away.
bool PrintFullConvention = false;