]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/Basic/Diagnostic.td
Merge ^/head r337286 through r337585.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / include / clang / Basic / Diagnostic.td
1 //===--- Diagnostic.td - C Language Family Diagnostic Handling ------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  This file defines the TableGen core definitions for the diagnostics
11 //  and diagnostic control.
12 //
13 //===----------------------------------------------------------------------===//
14
15 // See the Internals Manual, section The Diagnostics Subsystem for an overview.
16
17 // Define the diagnostic severities.
18 class Severity<string N> {
19   string Name = N;
20 }
21 def SEV_Ignored : Severity<"Ignored">;
22 def SEV_Remark  : Severity<"Remark">;
23 def SEV_Warning : Severity<"Warning">;
24 def SEV_Error   : Severity<"Error">;
25 def SEV_Fatal   : Severity<"Fatal">;
26
27 // Define the diagnostic classes.
28 class DiagClass;
29 def CLASS_NOTE      : DiagClass;
30 def CLASS_REMARK    : DiagClass;
31 def CLASS_WARNING   : DiagClass;
32 def CLASS_EXTENSION : DiagClass;
33 def CLASS_ERROR     : DiagClass;
34
35 // Responses to a diagnostic in a SFINAE context.
36 class SFINAEResponse;
37 def SFINAE_SubstitutionFailure : SFINAEResponse;
38 def SFINAE_Suppress            : SFINAEResponse;
39 def SFINAE_Report              : SFINAEResponse;
40 def SFINAE_AccessControl       : SFINAEResponse;
41
42 // Textual substitutions which may be performed on the text of diagnostics
43 class TextSubstitution<string Text> {
44   string Substitution = Text;
45   // TODO: These are only here to allow substitutions to be declared inline with
46   // diagnostics
47   string Component = "";
48   string CategoryName = "";
49 }
50
51 // Diagnostic Categories.  These can be applied to groups or individual
52 // diagnostics to specify a category.
53 class DiagCategory<string Name> {
54   string CategoryName = Name;
55 }
56
57 // Diagnostic Groups.
58 class DiagGroup<string Name, list<DiagGroup> subgroups = []> {
59   string GroupName = Name;
60   list<DiagGroup> SubGroups = subgroups;
61   string CategoryName = "";
62   code Documentation = [{}];
63 }
64 class InGroup<DiagGroup G> { DiagGroup Group = G; }
65 //class IsGroup<string Name> { DiagGroup Group = DiagGroup<Name>; }
66
67 // This defines documentation for diagnostic groups.
68 include "DiagnosticDocs.td"
69
70 // This defines all of the named diagnostic categories.
71 include "DiagnosticCategories.td"
72
73 // This defines all of the named diagnostic groups.
74 include "DiagnosticGroups.td"
75
76
77 // All diagnostics emitted by the compiler are an indirect subclass of this.
78 class Diagnostic<string text, DiagClass DC, Severity defaultmapping> {
79   /// Component is specified by the file with a big let directive.
80   string         Component = ?;
81   string         Text = text;
82   DiagClass      Class = DC;
83   SFINAEResponse SFINAE = SFINAE_Suppress;
84   bit            AccessControl = 0;
85   bit            WarningNoWerror = 0;
86   bit            ShowInSystemHeader = 0;
87   Severity       DefaultSeverity = defaultmapping;
88   DiagGroup      Group;
89   string         CategoryName = "";
90 }
91
92 class SFINAEFailure {
93   SFINAEResponse SFINAE = SFINAE_SubstitutionFailure;
94 }
95 class NoSFINAE {
96   SFINAEResponse SFINAE = SFINAE_Report;
97 }
98 class AccessControl {
99   SFINAEResponse SFINAE = SFINAE_AccessControl;
100 }
101
102 class ShowInSystemHeader {
103   bit ShowInSystemHeader = 1;
104 }
105
106 class SuppressInSystemHeader {
107   bit ShowInSystemHeader = 0;
108 }
109
110 // FIXME: ExtWarn and Extension should also be SFINAEFailure by default.
111 class Error<string str>     : Diagnostic<str, CLASS_ERROR, SEV_Error>, SFINAEFailure {
112   bit ShowInSystemHeader = 1;
113 }
114 // Warnings default to on (but can be default-off'd with DefaultIgnore).
115 // This is used for warnings about questionable code; warnings about
116 // accepted language extensions should use Extension or ExtWarn below instead.
117 class Warning<string str>   : Diagnostic<str, CLASS_WARNING, SEV_Warning>;
118 // Remarks can be turned on with -R flags and provide commentary, e.g. on
119 // optimizer decisions.
120 class Remark<string str>    : Diagnostic<str, CLASS_REMARK, SEV_Ignored>;
121 // Extensions are warnings about accepted language extensions.
122 // Extension warnings are default-off but enabled by -pedantic.
123 class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, SEV_Ignored>;
124 // ExtWarns are warnings about accepted language extensions.
125 // ExtWarn warnings are default-on.
126 class ExtWarn<string str>   : Diagnostic<str, CLASS_EXTENSION, SEV_Warning>;
127 // Notes can provide supplementary information on errors, warnings, and remarks.
128 class Note<string str>      : Diagnostic<str, CLASS_NOTE, SEV_Fatal/*ignored*/>;
129
130
131 class DefaultIgnore { Severity DefaultSeverity = SEV_Ignored; }
132 class DefaultWarn   { Severity DefaultSeverity = SEV_Warning; }
133 class DefaultError  { Severity DefaultSeverity = SEV_Error; }
134 class DefaultFatal  { Severity DefaultSeverity = SEV_Fatal; }
135 class DefaultWarnNoWerror {
136   bit WarningNoWerror = 1;
137 }
138 class DefaultRemark { Severity DefaultSeverity = SEV_Remark; }
139
140 // Definitions for Diagnostics.
141 include "DiagnosticASTKinds.td"
142 include "DiagnosticAnalysisKinds.td"
143 include "DiagnosticCommentKinds.td"
144 include "DiagnosticCommonKinds.td"
145 include "DiagnosticCrossTUKinds.td"
146 include "DiagnosticDriverKinds.td"
147 include "DiagnosticFrontendKinds.td"
148 include "DiagnosticLexKinds.td"
149 include "DiagnosticParseKinds.td"
150 include "DiagnosticRefactoringKinds.td"
151 include "DiagnosticSemaKinds.td"
152 include "DiagnosticSerializationKinds.td"
153