mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Frontend: Only print the -project-name flag in private and package interfaces.
Resolves rdar://130992944.
This commit is contained in:
@@ -489,13 +489,16 @@ static bool ShouldIncludeModuleInterfaceArg(const Arg *A) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ShouldIncludeArgInPackageInterfaceOnly(const Arg *A,
|
||||
ArgList &Args) {
|
||||
static bool IsPackageInterfaceFlag(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);
|
||||
}
|
||||
|
||||
static bool IsPrivateInterfaceFlag(const Arg *A, ArgList &Args) {
|
||||
return A->getOption().matches(options::OPT_project_name);
|
||||
}
|
||||
|
||||
/// 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,
|
||||
@@ -510,14 +513,18 @@ static void SaveModuleInterfaceArgs(ModuleInterfaceOptions &Opts,
|
||||
};
|
||||
|
||||
RenderedInterfaceArgs PublicArgs{};
|
||||
RenderedInterfaceArgs PrivateArgs{};
|
||||
RenderedInterfaceArgs PackageArgs{};
|
||||
|
||||
auto interfaceArgListForArg = [&](Arg *A) -> ArgStringList & {
|
||||
bool ignorable =
|
||||
A->getOption().hasFlag(options::ModuleInterfaceOptionIgnorable);
|
||||
if (ShouldIncludeArgInPackageInterfaceOnly(A, Args))
|
||||
if (IsPackageInterfaceFlag(A, Args))
|
||||
return ignorable ? PackageArgs.Ignorable : PackageArgs.Standard;
|
||||
|
||||
if (IsPrivateInterfaceFlag(A, Args))
|
||||
return ignorable ? PrivateArgs.Ignorable : PrivateArgs.Standard;
|
||||
|
||||
return ignorable ? PublicArgs.Ignorable : PublicArgs.Standard;
|
||||
};
|
||||
|
||||
@@ -543,6 +550,7 @@ static void SaveModuleInterfaceArgs(ModuleInterfaceOptions &Opts,
|
||||
};
|
||||
|
||||
updateInterfaceOpts(Opts.PublicFlags, PublicArgs);
|
||||
updateInterfaceOpts(Opts.PrivateFlags, PrivateArgs);
|
||||
updateInterfaceOpts(Opts.PackageFlags, PackageArgs);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user