Skip to content

Commit 7acc5b9

Browse files
authored
Merge pull request #81610 from tshortli/suppress-package-cmo-spam
Frontend: Suppress some unsupported option warnings when verifying interfaces
2 parents abcc134 + 98aac28 commit 7acc5b9

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,10 +1483,11 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
14831483
if (Opts.AllowNonResilientAccess &&
14841484
FrontendOptions::doesActionBuildModuleFromInterface(
14851485
FrontendOpts.RequestedAction)) {
1486-
Diags.diagnose(
1487-
SourceLoc(), diag::warn_ignore_option_overriden_by,
1488-
"-allow-non-resilient-access",
1489-
"-compile-module-from-interface or -typecheck-module-from-interface");
1486+
if (FrontendOpts.RequestedAction !=
1487+
FrontendOptions::ActionType::TypecheckModuleFromInterface)
1488+
Diags.diagnose(SourceLoc(), diag::warn_ignore_option_overriden_by,
1489+
"-allow-non-resilient-access",
1490+
"-compile-module-from-interface");
14901491
Opts.AllowNonResilientAccess = false;
14911492
}
14921493
}
@@ -3012,9 +3013,10 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
30123013
Args.hasArg(OPT_PackageCMO) ||
30133014
LangOpts.hasFeature(Feature::PackageCMO)) {
30143015
if (!LangOpts.AllowNonResilientAccess) {
3015-
Diags.diagnose(SourceLoc(), diag::ignoring_option_requires_option,
3016-
"-package-cmo",
3017-
"-allow-non-resilient-access");
3016+
if (FEOpts.RequestedAction !=
3017+
FrontendOptions::ActionType::TypecheckModuleFromInterface)
3018+
Diags.diagnose(SourceLoc(), diag::ignoring_option_requires_option,
3019+
"-package-cmo", "-allow-non-resilient-access");
30183020
} else if (!FEOpts.EnableLibraryEvolution) {
30193021
Diags.diagnose(SourceLoc(), diag::package_cmo_requires_library_evolution);
30203022
} else {

test/SILGen/package_allow_non_resilient_access.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
// RUN: -allow-non-resilient-access \
131131
// RUN: %t/Utils.package.swiftinterface -o %t/Utils.swiftmodule \
132132
// RUN: 2>&1 | %FileCheck %s --check-prefix=CHECK-DIAG-INTERFACE
133-
// CHECK-DIAG-INTERFACE: warning: ignoring -allow-non-resilient-access (overriden by -compile-module-from-interface or -typecheck-module-from-interface)
133+
// CHECK-DIAG-INTERFACE: warning: ignoring -allow-non-resilient-access (overriden by -compile-module-from-interface)
134134
// RUN: llvm-bcanalyzer --dump %t/Utils.swiftmodule | %FileCheck %s --check-prefix=CHECK-OFF
135135
// CHECK-OFF-NOT: ALLOW_NON_RESILIENT_ACCESS
136136

0 commit comments

Comments
 (0)