]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/Basic/Diagnostic.td
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r301441, and update
[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 // Diagnostic Categories.  These can be applied to groups or individual
43 // diagnostics to specify a category.
44 class DiagCategory<string Name> {
45   string CategoryName = Name;
46 }
47
48 // Diagnostic Groups.
49 class DiagGroup<string Name, list<DiagGroup> subgroups = []> {
50   string GroupName = Name;
51   list<DiagGroup> SubGroups = subgroups;
52   string CategoryName = "";
53   code Documentation = [{}];
54 }
55 class InGroup<DiagGroup G> { DiagGroup Group = G; }
56 //class IsGroup<string Name> { DiagGroup Group = DiagGroup<Name>; }
57
58 // This defines documentation for diagnostic groups.
59 include "DiagnosticDocs.td"
60
61 // This defines all of the named diagnostic categories.
62 include "DiagnosticCategories.td"
63
64 // This defines all of the named diagnostic groups.
65 include "DiagnosticGroups.td"
66
67
68 // All diagnostics emitted by the compiler are an indirect subclass of this.
69 class Diagnostic<string text, DiagClass DC, Severity defaultmapping> {
70   /// Component is specified by the file with a big let directive.
71   string         Component = ?;
72   string         Text = text;
73   DiagClass      Class = DC;
74   SFINAEResponse SFINAE = SFINAE_Suppress;
75   bit            AccessControl = 0;
76   bit            WarningNoWerror = 0;
77   bit            ShowInSystemHeader = 0;
78   Severity       DefaultSeverity = defaultmapping;
79   DiagGroup      Group;
80   string         CategoryName = "";
81 }
82
83 class SFINAEFailure {
84   SFINAEResponse SFINAE = SFINAE_SubstitutionFailure;
85 }
86 class NoSFINAE {
87   SFINAEResponse SFINAE = SFINAE_Report;
88 }
89 class AccessControl {
90   SFINAEResponse SFINAE = SFINAE_AccessControl;
91 }
92
93 class ShowInSystemHeader {
94   bit ShowInSystemHeader = 1;
95 }
96
97 class SuppressInSystemHeader {
98   bit ShowInSystemHeader = 0;
99 }
100
101 // FIXME: ExtWarn and Extension should also be SFINAEFailure by default.
102 class Error<string str>     : Diagnostic<str, CLASS_ERROR, SEV_Error>, SFINAEFailure {
103   bit ShowInSystemHeader = 1;
104 }
105 // Warnings default to on (but can be default-off'd with DefaultIgnore).
106 // This is used for warnings about questionable code; warnings about
107 // accepted language extensions should use Extension or ExtWarn below instead.
108 class Warning<string str>   : Diagnostic<str, CLASS_WARNING, SEV_Warning>;
109 // Remarks can be turned on with -R flags and provide commentary, e.g. on
110 // optimizer decisions.
111 class Remark<string str>    : Diagnostic<str, CLASS_REMARK, SEV_Ignored>;
112 // Extensions are warnings about accepted language extensions.
113 // Extension warnings are default-off but enabled by -pedantic.
114 class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, SEV_Ignored>;
115 // ExtWarns are warnings about accepted language extensions.
116 // ExtWarn warnings are default-on.
117 class ExtWarn<string str>   : Diagnostic<str, CLASS_EXTENSION, SEV_Warning>;
118 // Notes can provide supplementary information on errors, warnings, and remarks.
119 class Note<string str>      : Diagnostic<str, CLASS_NOTE, SEV_Fatal/*ignored*/>;
120
121
122 class DefaultIgnore { Severity DefaultSeverity = SEV_Ignored; }
123 class DefaultWarn   { Severity DefaultSeverity = SEV_Warning; }
124 class DefaultError  { Severity DefaultSeverity = SEV_Error; }
125 class DefaultFatal  { Severity DefaultSeverity = SEV_Fatal; }
126 class DefaultWarnNoWerror {
127   bit WarningNoWerror = 1;
128 }
129 class DefaultRemark { Severity DefaultSeverity = SEV_Remark; }
130
131 // Definitions for Diagnostics.
132 include "DiagnosticASTKinds.td"
133 include "DiagnosticAnalysisKinds.td"
134 include "DiagnosticCommentKinds.td"
135 include "DiagnosticCommonKinds.td"
136 include "DiagnosticDriverKinds.td"
137 include "DiagnosticFrontendKinds.td"
138 include "DiagnosticLexKinds.td"
139 include "DiagnosticParseKinds.td"
140 include "DiagnosticSemaKinds.td"
141 include "DiagnosticSerializationKinds.td"
142