Skip to content

Commit 123198b

Browse files
committed
[Frontend] Change -require-explicit-sendable argument to mean -Wwarning ExplicitSendable
1 parent 22ec081 commit 123198b

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,6 @@ namespace swift {
245245
// Availability macros definitions to be expanded at parsing.
246246
SmallVector<std::string, 4> AvailabilityMacros;
247247

248-
/// Require public declarations to declare that they are Sendable (or not).
249-
bool RequireExplicitSendable = false;
250-
251248
/// Detect and automatically import modules' cross-import overlays.
252249
bool EnableCrossImportOverlays = false;
253250

lib/Frontend/CompilerInvocation.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
12721272
if (Args.getLastArg(OPT_debug_cycles))
12731273
Opts.DebugDumpCycles = true;
12741274

1275-
Opts.RequireExplicitSendable |= Args.hasArg(OPT_require_explicit_sendable);
12761275
for (const Arg *A : Args.filtered(OPT_define_availability)) {
12771276
Opts.AvailabilityMacros.push_back(A->getValue());
12781277
}
@@ -2724,6 +2723,14 @@ static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
27242723
}
27252724
}());
27262725
}
2726+
2727+
// `-require-explicit-sendable` is an alias to `-Wwarning ExplicitSendable`.
2728+
if (Args.hasArg(OPT_require_explicit_sendable) &&
2729+
!Args.hasArg(OPT_suppress_warnings)) {
2730+
Opts.WarningsAsErrorsRules.push_back(WarningAsErrorRule(
2731+
WarningAsErrorRule::Action::Disable, "ExplicitSendable"));
2732+
}
2733+
27272734
if (Args.hasArg(OPT_debug_diagnostic_names)) {
27282735
Opts.PrintDiagnosticNames = PrintDiagnosticNamesMode::Identifier;
27292736
}

test/Concurrency/objc_require_explicit_sendable.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-sil -o /dev/null -I %S/Inputs/custom-modules %s -verify -parse-as-library -Wwarning ExplicitSendable
22
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-sil -o /dev/null -I %S/Inputs/custom-modules %s -verify -parse-as-library -Wwarning ExplicitSendable -strict-concurrency=targeted
33
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-sil -o /dev/null -I %S/Inputs/custom-modules %s -verify -parse-as-library -Wwarning ExplicitSendable -strict-concurrency=complete
4+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-sil -o /dev/null -I %S/Inputs/custom-modules %s -verify -parse-as-library -require-explicit-sendable
5+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-sil -o /dev/null -I %S/Inputs/custom-modules %s -verify -parse-as-library -require-explicit-sendable -strict-concurrency=targeted
6+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-sil -o /dev/null -I %S/Inputs/custom-modules %s -verify -parse-as-library -require-explicit-sendable -strict-concurrency=complete
47

58
// REQUIRES: objc_interop
69
// REQUIRES: concurrency

test/Concurrency/require-explicit-sendable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %target-swift-frontend -Wwarning ExplicitSendable -strict-concurrency=complete %s -emit-sil -o /dev/null -verify
2-
2+
// RUN: %target-swift-frontend -require-explicit-sendable -strict-concurrency=complete %s -emit-sil -o /dev/null -verify
33

44
public protocol P { }
55

0 commit comments

Comments
 (0)