Skip to content

Commit 367e027

Browse files
committed
Temporarily suppress embedded-restrictions diagnostic in Swift and _Concurrency
These are really noisy and are masking other issues. While we still have tons of cleanup to do, suppress these warnings.
1 parent 5f897a8 commit 367e027

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2585,6 +2585,20 @@ static bool isEmbedded(ArgList &args) {
25852585
return false;
25862586
}
25872587

2588+
/// Identifier modules for which we should temporarily suppress the diagnostics
2589+
/// for Embedded restrictions despite building in Embedded Swift.
2590+
static bool temporarilySuppressEmbeddedRestrictionDiagnostics(ArgList &args) {
2591+
using namespace swift::options;
2592+
2593+
if (const Arg *arg = args.getLastArgNoClaim(OPT_module_name)) {
2594+
StringRef moduleName(arg->getValue());
2595+
if (moduleName == "Swift" || moduleName == "_Concurrency")
2596+
return true;
2597+
}
2598+
2599+
return false;
2600+
}
2601+
25882602
static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
25892603
DiagnosticEngine &Diags) {
25902604
// NOTE: This executes at the beginning of parsing the command line and cannot
@@ -2655,7 +2669,8 @@ static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
26552669

26562670
// If the "embedded" flag was provided, enable the EmbeddedRestrictions
26572671
// warning group. This group is opt-in in non-Embedded builds.
2658-
if (isEmbedded(Args) && !Args.hasArg(OPT_suppress_warnings)) {
2672+
if (isEmbedded(Args) && !Args.hasArg(OPT_suppress_warnings) &&
2673+
!temporarilySuppressEmbeddedRestrictionDiagnostics(Args)) {
26592674
Opts.WarningsAsErrorsRules.push_back(
26602675
WarningAsErrorRule(WarningAsErrorRule::Action::Disable,
26612676
"EmbeddedRestrictions"));

0 commit comments

Comments
 (0)