Skip to content

Commit 10d249b

Browse files
committed
Frontend: Introduce a -warn-soft-deprecated option.
This option should cause references to declarations that are deprecated in future OS versions to be diagnosed.
1 parent a55beaa commit 10d249b

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,9 @@ namespace swift {
462462
/// Diagnose implicit 'override'.
463463
bool WarnImplicitOverrides = false;
464464

465+
/// Diagnose use of declarations that are soft-deprecated.
466+
bool WarnSoftDeprecated = false;
467+
465468
/// Diagnose uses of NSCoding with classes that have unstable mangled names.
466469
bool EnableNSKeyedArchiverDiagnostics = true;
467470

include/swift/Option/Options.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,11 @@ def warn_implicit_overrides :
838838
Flags<[FrontendOption, DoesNotAffectIncrementalBuild]>,
839839
HelpText<"Warn about implicit overrides of protocol members">;
840840

841+
def warn_soft_deprecated :
842+
Flag<["-"], "warn-soft-deprecated">,
843+
Flags<[FrontendOption, DoesNotAffectIncrementalBuild, HelpHidden]>,
844+
HelpText<"Warn when soft-deprecated declarations are referenced">;
845+
841846
def typo_correction_limit : Separate<["-"], "typo-correction-limit">,
842847
Flags<[FrontendOption, HelpHidden]>,
843848
MetaVarName<"<n>">,

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
11681168
Opts.WarnImplicitOverrides =
11691169
Args.hasArg(OPT_warn_implicit_overrides);
11701170

1171+
Opts.WarnSoftDeprecated = Args.hasArg(OPT_warn_soft_deprecated);
1172+
11711173
Opts.EnableNSKeyedArchiverDiagnostics =
11721174
Args.hasFlag(OPT_enable_nskeyedarchiver_diagnostics,
11731175
OPT_disable_nskeyedarchiver_diagnostics,

0 commit comments

Comments
 (0)