Skip to content

Commit 5a78608

Browse files
authored
Merge pull request #70775 from tshortli/deprecate-swift3-objc-inference
Frontend: Hide and deprecate options for Swift 3 @objc inference
2 parents ecca144 + 2fbef52 commit 5a78608

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

include/swift/Option/FrontendOptions.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,12 +677,12 @@ def report_errors_to_debugger : Flag<["-"], "report-errors-to-debugger">,
677677

678678
def enable_swift3_objc_inference : Flag<["-"], "enable-swift3-objc-inference">,
679679
Flags<[FrontendOption, HelpHidden]>,
680-
HelpText<"Enable Swift 3's @objc inference rules for NSObject-derived classes and 'dynamic' members (emulates Swift 3 behavior)">;
680+
HelpText<"Deprecated">;
681681

682682
def disable_swift3_objc_inference :
683683
Flag<["-"], "disable-swift3-objc-inference">,
684684
Flags<[FrontendOption, HelpHidden]>,
685-
HelpText<"Disable Swift 3's @objc inference rules for NSObject-derived classes and 'dynamic' members (emulates Swift 4 behavior)">;
685+
HelpText<"Deprecated">;
686686

687687
def enable_implicit_dynamic : Flag<["-"], "enable-implicit-dynamic">,
688688
Flags<[FrontendOption, NoInteractiveOption, HelpHidden]>,

include/swift/Option/Options.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -787,13 +787,13 @@ def continue_building_after_errors : Flag<["-"], "continue-building-after-errors
787787

788788
def warn_swift3_objc_inference_complete :
789789
Flag<["-"], "warn-swift3-objc-inference-complete">,
790-
Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
791-
HelpText<"Warn about deprecated @objc inference in Swift 3 for every declaration that will no longer be inferred as @objc in Swift 4">;
790+
Flags<[FrontendOption, HelpHidden, DoesNotAffectIncrementalBuild]>,
791+
HelpText<"Deprecated">;
792792

793793
def warn_swift3_objc_inference_minimal :
794794
Flag<["-"], "warn-swift3-objc-inference-minimal">,
795-
Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
796-
HelpText<"Warn about deprecated @objc inference in Swift 3 based on direct uses of the Objective-C entrypoint">;
795+
Flags<[FrontendOption, HelpHidden, DoesNotAffectIncrementalBuild]>,
796+
HelpText<"Deprecated">;
797797

798798
def enable_actor_data_race_checks :
799799
Flag<["-"], "enable-actor-data-race-checks">,

lib/Frontend/CompilerInvocation.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,14 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
920920
Args.hasFlag(OPT_enable_swift3_objc_inference,
921921
OPT_disable_swift3_objc_inference, false);
922922

923+
if (Args.hasArg(OPT_enable_swift3_objc_inference))
924+
Diags.diagnose(SourceLoc(), diag::warn_flag_deprecated,
925+
"-enable-swift3-objc-inference");
926+
927+
if (Args.hasArg(OPT_disable_swift3_objc_inference))
928+
Diags.diagnose(SourceLoc(), diag::warn_flag_deprecated,
929+
"-disable-swift3-objc-inference");
930+
923931
if (const Arg *A = Args.getLastArg(OPT_library_level)) {
924932
StringRef contents = A->getValue();
925933
if (contents == "api") {
@@ -983,6 +991,14 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
983991
}
984992
}
985993

994+
if (Args.hasArg(OPT_warn_swift3_objc_inference_minimal))
995+
Diags.diagnose(SourceLoc(), diag::warn_flag_deprecated,
996+
"-warn-swift3-objc-inference-minimal");
997+
998+
if (Args.hasArg(OPT_warn_swift3_objc_inference_complete))
999+
Diags.diagnose(SourceLoc(), diag::warn_flag_deprecated,
1000+
"-warn-swift3-objc-inference-complete");
1001+
9861002
// Swift 6+ uses the strictest concurrency level.
9871003
if (Opts.isSwiftVersionAtLeast(6)) {
9881004
Opts.StrictConcurrencyLevel = StrictConcurrency::Complete;

0 commit comments

Comments
 (0)