Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"));
Expand Down