From 367e02703d97d989d1e57c662ec5874ec35f1344 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Wed, 8 Oct 2025 14:04:14 -0700 Subject: [PATCH] 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. --- lib/Frontend/CompilerInvocation.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 773c30ffd3f84..37f878acc536b 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -2585,6 +2585,20 @@ static bool isEmbedded(ArgList &args) { return false; } +/// Identifier modules for which we should temporarily suppress the diagnostics +/// for Embedded restrictions despite building in Embedded Swift. +static bool temporarilySuppressEmbeddedRestrictionDiagnostics(ArgList &args) { + using namespace swift::options; + + if (const Arg *arg = args.getLastArgNoClaim(OPT_module_name)) { + StringRef moduleName(arg->getValue()); + if (moduleName == "Swift" || moduleName == "_Concurrency") + return true; + } + + return false; +} + static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args, DiagnosticEngine &Diags) { // NOTE: This executes at the beginning of parsing the command line and cannot @@ -2655,7 +2669,8 @@ static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args, // If the "embedded" flag was provided, enable the EmbeddedRestrictions // warning group. This group is opt-in in non-Embedded builds. - if (isEmbedded(Args) && !Args.hasArg(OPT_suppress_warnings)) { + if (isEmbedded(Args) && !Args.hasArg(OPT_suppress_warnings) && + !temporarilySuppressEmbeddedRestrictionDiagnostics(Args)) { Opts.WarningsAsErrorsRules.push_back( WarningAsErrorRule(WarningAsErrorRule::Action::Disable, "EmbeddedRestrictions"));