Skip to content

Commit aafd24b

Browse files
committed
Prefer diagnostic group names for diagnostic categories over the ad hoc ones
1 parent 779acb3 commit aafd24b

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lib/AST/DiagnosticEngine.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1334,12 +1334,12 @@ DiagnosticEngine::diagnosticInfoForDiagnostic(const Diagnostic &diagnostic,
13341334
StringRef Category;
13351335
if (isAPIDigesterBreakageDiagnostic(diagnostic.getID()))
13361336
Category = "api-digester-breaking-change";
1337-
else if (isDeprecationDiagnostic(diagnostic.getID()))
1338-
Category = "deprecation";
13391337
else if (isNoUsageDiagnostic(diagnostic.getID()))
13401338
Category = "no-usage";
13411339
else if (groupID != DiagGroupID::no_group)
13421340
Category = getDiagGroupInfoByID(groupID).name;
1341+
else if (isDeprecationDiagnostic(diagnostic.getID()))
1342+
Category = "deprecation";
13431343

13441344
auto fixIts = diagnostic.getFixIts();
13451345
if (loc.isValid()) {

test/diagnostics/diagnostic-group-serialization.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func f() { }
1010

1111
func g() {
1212
f()
13-
// CHECK: [[@LINE-1]]:3: warning: 'f()' is deprecated: please do not use [DeprecatedDeclaration] [-W{{.*}}deprecated-declaration.md] [deprecation]
13+
// CHECK: [[@LINE-1]]:3: warning: 'f()' is deprecated: please do not use [DeprecatedDeclaration] [-W{{.*}}deprecated-declaration.md] [DeprecatedDeclaration]
1414
}
1515

1616

tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ void EditorDiagConsumer::handleDiagnostic(SourceManager &SM,
164164

165165
SKInfo.ID = DiagnosticEngine::diagnosticIDStringFor(Info.ID).str();
166166

167-
if (Info.Category == "deprecation") {
167+
if (Info.Category == "deprecation" ||
168+
Info.Category.starts_with("Deprecated")) {
168169
SKInfo.Categories.push_back(DiagnosticCategory::Deprecation);
169170
} else if (Info.Category == "no-usage") {
170171
SKInfo.Categories.push_back(DiagnosticCategory::NoUsage);

0 commit comments

Comments
 (0)