@@ -55,22 +55,34 @@ enum class DiagnosticOptions {
55
55
56
56
// / An API or ABI breakage diagnostic emitted by the API digester.
57
57
APIDigesterBreakage,
58
+
59
+ // / A deprecation warning or error.
60
+ Deprecation,
61
+
62
+ // / A diagnostic warning about an unused element.
63
+ NoUsage,
58
64
};
59
65
struct StoredDiagnosticInfo {
60
66
DiagnosticKind kind : 2 ;
61
67
bool pointsToFirstBadToken : 1 ;
62
68
bool isFatal : 1 ;
63
69
bool isAPIDigesterBreakage : 1 ;
70
+ bool isDeprecation : 1 ;
71
+ bool isNoUsage : 1 ;
64
72
65
73
constexpr StoredDiagnosticInfo (DiagnosticKind k, bool firstBadToken,
66
- bool fatal, bool isAPIDigesterBreakage)
74
+ bool fatal, bool isAPIDigesterBreakage,
75
+ bool deprecation, bool noUsage)
67
76
: kind(k), pointsToFirstBadToken(firstBadToken), isFatal(fatal),
68
- isAPIDigesterBreakage(isAPIDigesterBreakage) {}
77
+ isAPIDigesterBreakage(isAPIDigesterBreakage), isDeprecation(deprecation),
78
+ isNoUsage(noUsage) {}
69
79
constexpr StoredDiagnosticInfo (DiagnosticKind k, DiagnosticOptions opts)
70
80
: StoredDiagnosticInfo(k,
71
81
opts == DiagnosticOptions::PointsToFirstBadToken,
72
82
opts == DiagnosticOptions::Fatal,
73
- opts == DiagnosticOptions::APIDigesterBreakage) {}
83
+ opts == DiagnosticOptions::APIDigesterBreakage,
84
+ opts == DiagnosticOptions::Deprecation,
85
+ opts == DiagnosticOptions::NoUsage) {}
74
86
};
75
87
76
88
// Reproduce the DiagIDs, as we want both the size and access to the raw ids
@@ -332,6 +344,14 @@ bool DiagnosticEngine::isAPIDigesterBreakageDiagnostic(DiagID ID) const {
332
344
return storedDiagnosticInfos[(unsigned )ID].isAPIDigesterBreakage ;
333
345
}
334
346
347
+ bool DiagnosticEngine::isDeprecationDiagnostic (DiagID ID) const {
348
+ return storedDiagnosticInfos[(unsigned )ID].isDeprecation ;
349
+ }
350
+
351
+ bool DiagnosticEngine::isNoUsageDiagnostic (DiagID ID) const {
352
+ return storedDiagnosticInfos[(unsigned )ID].isNoUsage ;
353
+ }
354
+
335
355
bool DiagnosticEngine::finishProcessing () {
336
356
bool hadError = false ;
337
357
for (auto &Consumer : Consumers) {
@@ -1108,10 +1128,13 @@ DiagnosticEngine::diagnosticInfoForDiagnostic(const Diagnostic &diagnostic) {
1108
1128
}
1109
1129
}
1110
1130
1111
- // Currently, only API digester diagnostics are assigned a category.
1112
1131
StringRef Category;
1113
1132
if (isAPIDigesterBreakageDiagnostic (diagnostic.getID ()))
1114
1133
Category = " api-digester-breaking-change" ;
1134
+ if (isDeprecationDiagnostic (diagnostic.getID ()))
1135
+ Category = " deprecation" ;
1136
+ if (isNoUsageDiagnostic (diagnostic.getID ()))
1137
+ Category = " no-usage" ;
1115
1138
1116
1139
return DiagnosticInfo (
1117
1140
diagnostic.getID (), loc, toDiagnosticKind (behavior),
0 commit comments