Skip to content

Commit 5781b14

Browse files
authored
Merge pull request #59533 from nkcsgexi/95385661
ABIChecker: diagnose removal of deprecated symbols by default
2 parents 566e00c + 2fba124 commit 5781b14

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

include/swift/APIDigester/ModuleAnalyzerNodes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ struct CheckerOptions {
157157
bool PrintModule;
158158
bool SwiftOnly;
159159
bool SkipOSCheck;
160+
bool SkipRemoveDeprecatedCheck;
160161
bool CompilerStyle;
161162
bool Migrator;
162163
StringRef LocationFilter;

include/swift/Option/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,6 +1446,10 @@ def disable_os_checks: Flag<["-", "--"], "disable-os-checks">,
14461446
Flags<[NoDriverOption, SwiftAPIDigesterOption]>,
14471447
HelpText<"Skip OS related diagnostics">;
14481448

1449+
def disable_remove_deprecated_check: Flag<["-", "--"], "disable-remove-deprecated-check">,
1450+
Flags<[NoDriverOption, SwiftAPIDigesterOption]>,
1451+
HelpText<"Skip diagnosing removal of deprecated symbols">;
1452+
14491453
def print_module: Flag<["-", "--"], "print-module">,
14501454
Flags<[NoDriverOption, SwiftAPIDigesterOption]>,
14511455
HelpText<"Print module names in diagnostics">;

lib/APIDigester/ModuleAnalyzerNodes.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2554,6 +2554,7 @@ void swift::ide::api::dumpModuleContent(ModuleDecl *MD, StringRef OutputFile,
25542554
opts.AvoidToolArgs = true;
25552555
opts.Migrator = false;
25562556
opts.SkipOSCheck = false;
2557+
opts.SkipRemoveDeprecatedCheck = false;
25572558
opts.Verbose = false;
25582559
SDKContext ctx(opts);
25592560
SwiftDeclCollector collector(ctx);

lib/DriverTool/swift_api_digester_main.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,10 +553,12 @@ static void diagnoseRemovedDecl(const SDKNodeDecl *D) {
553553
if (D->hasDeclAttribute(DeclAttrKind::DAK_AlwaysEmitIntoClient))
554554
return;
555555
}
556+
auto &Ctx = D->getSDKContext();
556557
// Don't diagnose removal of deprecated APIs.
557-
if (!D->isDeprecated()) {
558-
D->emitDiag(SourceLoc(), diag::removed_decl, false);
559-
}
558+
if (Ctx.getOpts().SkipRemoveDeprecatedCheck &&
559+
D->isDeprecated())
560+
return;
561+
D->emitDiag(SourceLoc(), diag::removed_decl, false);
560562
}
561563

562564
// This is first pass on two given SDKNode trees. This pass removes the common part
@@ -2334,6 +2336,7 @@ class SwiftAPIDigesterInvocation {
23342336
CheckerOpts.SwiftOnly =
23352337
ParsedArgs.hasArg(OPT_abi) || ParsedArgs.hasArg(OPT_swift_only);
23362338
CheckerOpts.SkipOSCheck = ParsedArgs.hasArg(OPT_disable_os_checks);
2339+
CheckerOpts.SkipRemoveDeprecatedCheck = ParsedArgs.hasArg(OPT_disable_remove_deprecated_check);
23372340
CheckerOpts.CompilerStyle =
23382341
CompilerStyleDiags || !SerializedDiagPath.empty();
23392342
for (auto Arg : Args)

0 commit comments

Comments
 (0)