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 mappings.
17 def MAP_IGNORE : DiagMapping;
18 def MAP_WARNING : DiagMapping;
19 def MAP_ERROR : DiagMapping;
20 def MAP_FATAL : DiagMapping;
22 // Define the diagnostic classes.
24 def CLASS_NOTE : DiagClass;
25 def CLASS_WARNING : DiagClass;
26 def CLASS_EXTENSION : DiagClass;
27 def CLASS_ERROR : DiagClass;
29 // Diagnostic Categories. These can be applied to groups or individual
30 // diagnostics to specify a category.
31 class DiagCategory<string Name> {
32 string CategoryName = Name;
36 class DiagGroup<string Name, list<DiagGroup> subgroups = []> {
37 string GroupName = Name;
38 list<DiagGroup> SubGroups = subgroups;
39 string CategoryName = "";
41 class InGroup<DiagGroup G> { DiagGroup Group = G; }
42 //class IsGroup<string Name> { DiagGroup Group = DiagGroup<Name>; }
45 // This defines all of the named diagnostic categories.
46 include "DiagnosticCategories.td"
48 // This defines all of the named diagnostic groups.
49 include "DiagnosticGroups.td"
52 // All diagnostics emitted by the compiler are an indirect subclass of this.
53 class Diagnostic<string text, DiagClass DC, DiagMapping defaultmapping> {
54 /// Component is specified by the file with a big let directive.
59 bit AccessControl = 0;
60 bit WarningNoWerror = 0;
61 bit WarningShowInSystemHeader = 0;
62 DiagMapping DefaultMapping = defaultmapping;
64 string CategoryName = "";
66 string Explanation = "";
69 class Error<string str> : Diagnostic<str, CLASS_ERROR, MAP_ERROR>;
70 class Warning<string str> : Diagnostic<str, CLASS_WARNING, MAP_WARNING>;
71 class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_IGNORE>;
72 class ExtWarn<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_WARNING>;
73 class Note<string str> : Diagnostic<str, CLASS_NOTE, MAP_FATAL/*ignored*/>;
76 class DefaultIgnore { DiagMapping DefaultMapping = MAP_IGNORE; }
77 class DefaultWarn { DiagMapping DefaultMapping = MAP_WARNING; }
78 class DefaultError { DiagMapping DefaultMapping = MAP_ERROR; }
79 class DefaultFatal { DiagMapping DefaultMapping = MAP_FATAL; }
80 class DefaultWarnNoWerror {
81 bit WarningNoWerror = 1;
83 class DefaultWarnShowInSystemHeader {
84 bit WarningShowInSystemHeader = 1;
87 class NoSFINAE { bit SFINAE = 0; }
88 class AccessControl { bit AccessControl = 1; }
90 class Brief<string str> { string Brief = str; }
91 class FullExplanation<string brief, string full> {
93 string Explanation = full;
96 // Definitions for Diagnostics.
97 include "DiagnosticASTKinds.td"
98 include "DiagnosticAnalysisKinds.td"
99 include "DiagnosticCommonKinds.td"
100 include "DiagnosticDriverKinds.td"
101 include "DiagnosticFrontendKinds.td"
102 include "DiagnosticLexKinds.td"
103 include "DiagnosticParseKinds.td"
104 include "DiagnosticSemaKinds.td"