mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Drop package-name if needed in SaveModuleInterfaceArgs
This commit is contained in:
@@ -485,6 +485,13 @@ static bool ShouldIncludeModuleInterfaceArg(const Arg *A) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ShouldIncludeArgInPackageInterfaceOnly(const Arg *A,
|
||||
ArgList &Args) {
|
||||
return A->getOption().matches(options::OPT_package_name) &&
|
||||
Args.hasArg(
|
||||
options::OPT_disable_print_package_name_for_non_package_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 SaveModuleInterfaceArgs(ModuleInterfaceOptions &Opts,
|
||||
@@ -493,8 +500,10 @@ static void SaveModuleInterfaceArgs(ModuleInterfaceOptions &Opts,
|
||||
if (!FOpts.InputsAndOutputs.hasModuleInterfaceOutputPath())
|
||||
return;
|
||||
ArgStringList RenderedArgs;
|
||||
ArgStringList RenderedArgsForPackageOnly;
|
||||
ArgStringList RenderedArgsIgnorable;
|
||||
ArgStringList RenderedArgsIgnorablePrivate;
|
||||
|
||||
for (auto A : Args) {
|
||||
if (!ShouldIncludeModuleInterfaceArg(A))
|
||||
continue;
|
||||
@@ -504,7 +513,10 @@ static void SaveModuleInterfaceArgs(ModuleInterfaceOptions &Opts,
|
||||
} else if (A->getOption().hasFlag(options::ModuleInterfaceOptionIgnorable)) {
|
||||
A->render(Args, RenderedArgsIgnorable);
|
||||
} else if (A->getOption().hasFlag(options::ModuleInterfaceOption)) {
|
||||
A->render(Args, RenderedArgs);
|
||||
if (ShouldIncludeArgInPackageInterfaceOnly(A, Args))
|
||||
A->render(Args, RenderedArgsForPackageOnly);
|
||||
else
|
||||
A->render(Args, RenderedArgs);
|
||||
}
|
||||
}
|
||||
{
|
||||
@@ -513,6 +525,13 @@ static void SaveModuleInterfaceArgs(ModuleInterfaceOptions &Opts,
|
||||
[&](const char *Argument) { PrintArg(OS, Argument, StringRef()); },
|
||||
[&] { OS << " "; });
|
||||
}
|
||||
{
|
||||
llvm::raw_string_ostream OS(Opts.FlagsForPackageOnly);
|
||||
interleave(
|
||||
RenderedArgsForPackageOnly,
|
||||
[&](const char *Argument) { PrintArg(OS, Argument, StringRef()); },
|
||||
[&] { OS << " "; });
|
||||
}
|
||||
{
|
||||
llvm::raw_string_ostream OS(Opts.IgnorablePrivateFlags);
|
||||
interleave(RenderedArgsIgnorablePrivate,
|
||||
|
||||
Reference in New Issue
Block a user