1 //===--- Diagnostic.td - C Language Family Diagnostic Handling ------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the TableGen core definitions for the diagnostics
11 // and diagnostic control.
13 //===----------------------------------------------------------------------===//
15 // Define the diagnostic severities.
16 class Severity<string N> {
19 def SEV_Ignored : Severity<"Ignored">;
20 def SEV_Remark : Severity<"Remark">;
21 def SEV_Warning : Severity<"Warning">;
22 def SEV_Error : Severity<"Error">;
23 def SEV_Fatal : Severity<"Fatal">;
25 // Define the diagnostic classes.
27 def CLASS_NOTE : DiagClass;
28 def CLASS_REMARK : DiagClass;
29 def CLASS_WARNING : DiagClass;
30 def CLASS_EXTENSION : DiagClass;
31 def CLASS_ERROR : DiagClass;
33 // Responses to a diagnostic in a SFINAE context.
35 def SFINAE_SubstitutionFailure : SFINAEResponse;
36 def SFINAE_Suppress : SFINAEResponse;
37 def SFINAE_Report : SFINAEResponse;
38 def SFINAE_AccessControl : SFINAEResponse;
40 // Diagnostic Categories. These can be applied to groups or individual
41 // diagnostics to specify a category.
42 class DiagCategory<string Name> {
43 string CategoryName = Name;
47 class DiagGroup<string Name, list<DiagGroup> subgroups = []> {
48 string GroupName = Name;
49 list<DiagGroup> SubGroups = subgroups;
50 string CategoryName = "";
51 code Documentation = [{}];
53 class InGroup<DiagGroup G> { DiagGroup Group = G; }
54 //class IsGroup<string Name> { DiagGroup Group = DiagGroup<Name>; }
56 // This defines documentation for diagnostic groups.
57 include "DiagnosticDocs.td"
59 // This defines all of the named diagnostic categories.
60 include "DiagnosticCategories.td"
62 // This defines all of the named diagnostic groups.
63 include "DiagnosticGroups.td"
66 // All diagnostics emitted by the compiler are an indirect subclass of this.
67 class Diagnostic<string text, DiagClass DC, Severity defaultmapping> {
68 /// Component is specified by the file with a big let directive.
72 SFINAEResponse SFINAE = SFINAE_Suppress;
73 bit AccessControl = 0;
74 bit WarningNoWerror = 0;
75 bit ShowInSystemHeader = 0;
76 Severity DefaultSeverity = defaultmapping;
78 string CategoryName = "";
82 SFINAEResponse SFINAE = SFINAE_SubstitutionFailure;
85 SFINAEResponse SFINAE = SFINAE_Report;
88 SFINAEResponse SFINAE = SFINAE_AccessControl;
91 class ShowInSystemHeader {
92 bit ShowInSystemHeader = 1;
95 class SuppressInSystemHeader {
96 bit ShowInSystemHeader = 0;
99 // FIXME: ExtWarn and Extension should also be SFINAEFailure by default.
100 class Error<string str> : Diagnostic<str, CLASS_ERROR, SEV_Error>, SFINAEFailure {
101 bit ShowInSystemHeader = 1;
103 class Warning<string str> : Diagnostic<str, CLASS_WARNING, SEV_Warning>;
104 class Remark<string str> : Diagnostic<str, CLASS_REMARK, SEV_Ignored>;
105 class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, SEV_Ignored>;
106 class ExtWarn<string str> : Diagnostic<str, CLASS_EXTENSION, SEV_Warning>;
107 class Note<string str> : Diagnostic<str, CLASS_NOTE, SEV_Fatal/*ignored*/>;
110 class DefaultIgnore { Severity DefaultSeverity = SEV_Ignored; }
111 class DefaultWarn { Severity DefaultSeverity = SEV_Warning; }
112 class DefaultError { Severity DefaultSeverity = SEV_Error; }
113 class DefaultFatal { Severity DefaultSeverity = SEV_Fatal; }
114 class DefaultWarnNoWerror {
115 bit WarningNoWerror = 1;
117 class DefaultRemark { Severity DefaultSeverity = SEV_Remark; }
119 // Definitions for Diagnostics.
120 include "DiagnosticASTKinds.td"
121 include "DiagnosticAnalysisKinds.td"
122 include "DiagnosticCommentKinds.td"
123 include "DiagnosticCommonKinds.td"
124 include "DiagnosticDriverKinds.td"
125 include "DiagnosticFrontendKinds.td"
126 include "DiagnosticLexKinds.td"
127 include "DiagnosticParseKinds.td"
128 include "DiagnosticSemaKinds.td"
129 include "DiagnosticSerializationKinds.td"