Skip to content

Commit 590deff

Browse files
committed
Frontend: Suppress some unsupported option warnings when verifying interfaces.
The following warnings get emitted every time we build the compiler libraries that are implemented in Swift: ``` <unknown>:0: warning: ignoring -allow-non-resilient-access (overriden by -compile-module-from-interface or -typecheck-module-from-interface) <unknown>:0: warning: ignoring -package-cmo (requires -allow-non-resilient-access) <unknown>:0: warning: ignoring -allow-non-resilient-access (overriden by -compile-module-from-interface or -typecheck-module-from-interface) <unknown>:0: warning: ignoring -package-cmo (requires -allow-non-resilient-access) ``` These warnings are generated because `-allow-non-resilient-access` and `-package-cmo` are being passed in with `-Xfrontend` and are therefore copied into the interface verification jobs, even though they don't apply. Suppress the warnings under these circumstances; they aren't going to help anyone understand a problem, so they're just spam. Resolves rdar://151616909.
1 parent 2d96b24 commit 590deff

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
@@ -1455,10 +1455,11 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
14551455
if (Opts.AllowNonResilientAccess &&
14561456
FrontendOptions::doesActionBuildModuleFromInterface(
14571457
FrontendOpts.RequestedAction)) {
1458-
Diags.diagnose(
1459-
SourceLoc(), diag::warn_ignore_option_overriden_by,
1460-
"-allow-non-resilient-access",
1461-
"-compile-module-from-interface or -typecheck-module-from-interface");
1458+
if (FrontendOpts.RequestedAction !=
1459+
FrontendOptions::ActionType::TypecheckModuleFromInterface)
1460+
Diags.diagnose(SourceLoc(), diag::warn_ignore_option_overriden_by,
1461+
"-allow-non-resilient-access",
1462+
"-compile-module-from-interface");
14621463
Opts.AllowNonResilientAccess = false;
14631464
}
14641465
}
@@ -2988,9 +2989,10 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
29882989
Args.hasArg(OPT_PackageCMO) ||
29892990
LangOpts.hasFeature(Feature::PackageCMO)) {
29902991
if (!LangOpts.AllowNonResilientAccess) {
2991-
Diags.diagnose(SourceLoc(), diag::ignoring_option_requires_option,
2992-
"-package-cmo",
2993-
"-allow-non-resilient-access");
2992+
if (FEOpts.RequestedAction !=
2993+
FrontendOptions::ActionType::TypecheckModuleFromInterface)
2994+
Diags.diagnose(SourceLoc(), diag::ignoring_option_requires_option,
2995+
"-package-cmo", "-allow-non-resilient-access");
29942996
} else if (!FEOpts.EnableLibraryEvolution) {
29952997
Diags.diagnose(SourceLoc(), diag::package_cmo_requires_library_evolution);
29962998
} 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)