[ModuleInterface] Allow falling back to prefer TypeReprs

There are still cases (a module with a type that's the same name as the
module) where we cannot fully qualify all types. In those cases, allow
them to remain unqualified with a flag, `-Xfrontend
-preserve-types-as-written-in-module-interface`.
This commit is contained in:
Harlan Haskins
2019-06-12 18:51:27 -07:00
parent a480404573
commit 889e43076f
7 changed files with 57 additions and 4 deletions

View File

@@ -197,6 +197,14 @@ static void PrintArg(raw_ostream &OS, const char *Arg, StringRef TempDir) {
OS << '"';
}
static void ParseParseableInterfaceArgs(ParseableInterfaceOptions &Opts,
ArgList &Args) {
using namespace options;
Opts.PreserveTypesAsWrittenInModuleInterface |=
Args.hasArg(OPT_preserve_types_as_written_in_module_interface);
}
/// Save a copy of any flags marked as ModuleInterfaceOption, if running
/// in a mode that is going to emit a .swiftinterface file.
static void SaveParseableInterfaceArgs(ParseableInterfaceOptions &Opts,
@@ -1305,6 +1313,7 @@ bool CompilerInvocation::parseArgs(
return true;
}
ParseParseableInterfaceArgs(ParseableInterfaceOpts, ParsedArgs);
SaveParseableInterfaceArgs(ParseableInterfaceOpts, FrontendOpts,
ParsedArgs, Diags);