Skip to content

Commit eb3f788

Browse files
committed
[clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary
The [Improving Clang's Diagnostics RFC][1] identifies eight broad fields for Clang to surface, two of which are text-based. Since the current diagnostics more closely map to the diagnostic summary (or headline), we should rename them to ensure that there's no confusion when Diagnostic.Reason is introduced in the near future. [1]: https://discourse.llvm.org/t/rfc-improving-clang-s-diagnostics/62584 Reviewed By: aaron.ballman, erichkeane Differential Revision: https://reviews.llvm.org/D135820
1 parent f6d411f commit eb3f788

File tree

7 files changed

+58
-58
lines changed

7 files changed

+58
-58
lines changed

clang/include/clang/Basic/Diagnostic.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ include "DiagnosticGroups.td"
7575

7676

7777
// All diagnostics emitted by the compiler are an indirect subclass of this.
78-
class Diagnostic<string text, DiagClass DC, Severity defaultmapping> {
78+
class Diagnostic<string summary, DiagClass DC, Severity defaultmapping> {
7979
/// Component is specified by the file with a big let directive.
8080
string Component = ?;
81-
string Text = text;
81+
string Summary = summary;
8282
DiagClass Class = DC;
8383
SFINAEResponse SFINAE = SFINAE_Suppress;
8484
bit AccessControl = 0;

clang/include/clang/Basic/DiagnosticCommonKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def note_constexpr_invalid_template_arg : Note<
269269
"%select{type_info object|string literal|temporary object|"
270270
"predefined '%3' variable}2 is not allowed in a template argument">;
271271
def err_constexpr_invalid_template_arg : Error<
272-
note_constexpr_invalid_template_arg.Text>;
272+
note_constexpr_invalid_template_arg.Summary>;
273273

274274
// Sema && Frontend
275275
let CategoryName = "Inline Assembly Issue" in {

clang/include/clang/Basic/DiagnosticFrontendKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def warn_avx_calling_convention
276276
: Warning<"AVX vector %select{return|argument}0 of type %1 without '%2' "
277277
"enabled changes the ABI">,
278278
InGroup<DiagGroup<"psabi">>;
279-
def err_avx_calling_convention : Error<warn_avx_calling_convention.Text>;
279+
def err_avx_calling_convention : Error<warn_avx_calling_convention.Summary>;
280280

281281
def err_alias_to_undefined : Error<
282282
"%select{alias|ifunc}0 must point to a defined "

clang/include/clang/Basic/DiagnosticLexKinds.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ def ext_pp_gnu_line_directive : Extension<
461461
def err_pp_invalid_directive : Error<
462462
"invalid preprocessing directive%select{|, did you mean '#%1'?}0">;
463463
def warn_pp_invalid_directive : Warning<
464-
err_pp_invalid_directive.Text>, InGroup<DiagGroup<"unknown-directives">>;
464+
err_pp_invalid_directive.Summary>, InGroup<DiagGroup<"unknown-directives">>;
465465
def err_pp_directive_required : Error<
466466
"%0 must be used within a preprocessing directive">;
467467
def err_pp_file_not_found : Error<"'%0' file not found">, DefaultFatal;
@@ -704,7 +704,7 @@ def ext_pp_bad_paste_ms : ExtWarn<
704704
def err_pp_operator_used_as_macro_name : Error<
705705
"C++ operator %0 (aka %1) used as a macro name">;
706706
def ext_pp_operator_used_as_macro_name : Extension<
707-
err_pp_operator_used_as_macro_name.Text>, InGroup<MicrosoftCppMacro>;
707+
err_pp_operator_used_as_macro_name.Summary>, InGroup<MicrosoftCppMacro>;
708708
def err_pp_illegal_floating_literal : Error<
709709
"floating point literal in preprocessor expression">;
710710
def err_pp_line_requires_integer : Error<

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 47 additions & 47 deletions
Large diffs are not rendered by default.

clang/test/TableGen/DiagnosticBase.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ class InGroup<DiagGroup G> { DiagGroup Group = G; }
6767
include "DiagnosticDocs.inc"
6868

6969
// All diagnostics emitted by the compiler are an indirect subclass of this.
70-
class Diagnostic<string text, DiagClass DC, Severity defaultmapping> {
70+
class Diagnostic<string summary, DiagClass DC, Severity defaultmapping> {
7171
/// Component is specified by the file with a big let directive.
7272
string Component = ?;
73-
string Text = text;
73+
string Summary = summary;
7474
DiagClass Class = DC;
7575
SFINAEResponse SFINAE = SFINAE_Suppress;
7676
bit AccessControl = 0;

clang/utils/TableGen/ClangDiagnosticsEmitter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ std::vector<std::string>
11651165
DiagnosticTextBuilder::buildForDocumentation(StringRef Severity,
11661166
const Record *R) {
11671167
EvaluatingRecordGuard Guard(&EvaluatingRecord, R);
1168-
StringRef Text = R->getValueAsString("Text");
1168+
StringRef Text = R->getValueAsString("Summary");
11691169

11701170
DiagText D(*this, Text);
11711171
TextPiece *Prefix = D.New<TextPiece>(Severity, Severity);
@@ -1184,7 +1184,7 @@ DiagnosticTextBuilder::buildForDocumentation(StringRef Severity,
11841184

11851185
std::string DiagnosticTextBuilder::buildForDefinition(const Record *R) {
11861186
EvaluatingRecordGuard Guard(&EvaluatingRecord, R);
1187-
StringRef Text = R->getValueAsString("Text");
1187+
StringRef Text = R->getValueAsString("Summary");
11881188
DiagText D(*this, Text);
11891189
std::string Result;
11901190
DiagTextPrinter{*this, Result}.Visit(D.Root);
@@ -1702,7 +1702,7 @@ void writeHeader(StringRef Str, raw_ostream &OS, char Kind = '-') {
17021702

17031703
void writeDiagnosticText(DiagnosticTextBuilder &Builder, const Record *R,
17041704
StringRef Role, raw_ostream &OS) {
1705-
StringRef Text = R->getValueAsString("Text");
1705+
StringRef Text = R->getValueAsString("Summary");
17061706
if (Text == "%0")
17071707
OS << "The text of this diagnostic is not controlled by Clang.\n\n";
17081708
else {

0 commit comments

Comments
 (0)