mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
ModuleInterface: move -user-module-version to a new field
Titled as "// swift-module-flags-ignorable:", this new field contains new frontend arguments that can be safely ignored by the older version of the compiler. For compilers that don't know the field at all, all arguments in it are ignored. rdar://78233352
This commit is contained in:
@@ -355,14 +355,26 @@ static void SaveModuleInterfaceArgs(ModuleInterfaceOptions &Opts,
|
||||
if (!FOpts.InputsAndOutputs.hasModuleInterfaceOutputPath())
|
||||
return;
|
||||
ArgStringList RenderedArgs;
|
||||
ArgStringList RenderedArgsIgnorable;
|
||||
for (auto A : Args) {
|
||||
if (A->getOption().hasFlag(options::ModuleInterfaceOption))
|
||||
if (A->getOption().hasFlag(options::ModuleInterfaceOptionIgnorable)) {
|
||||
A->render(Args, RenderedArgsIgnorable);
|
||||
} else if (A->getOption().hasFlag(options::ModuleInterfaceOption)) {
|
||||
A->render(Args, RenderedArgs);
|
||||
}
|
||||
}
|
||||
{
|
||||
llvm::raw_string_ostream OS(Opts.Flags);
|
||||
interleave(RenderedArgs,
|
||||
[&](const char *Argument) { PrintArg(OS, Argument, StringRef()); },
|
||||
[&] { OS << " "; });
|
||||
}
|
||||
{
|
||||
llvm::raw_string_ostream OS(Opts.IgnorableFlags);
|
||||
interleave(RenderedArgsIgnorable,
|
||||
[&](const char *Argument) { PrintArg(OS, Argument, StringRef()); },
|
||||
[&] { OS << " "; });
|
||||
}
|
||||
llvm::raw_string_ostream OS(Opts.Flags);
|
||||
interleave(RenderedArgs,
|
||||
[&](const char *Argument) { PrintArg(OS, Argument, StringRef()); },
|
||||
[&] { OS << " "; });
|
||||
}
|
||||
|
||||
static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
|
||||
Reference in New Issue
Block a user