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;
21 def MAP_WARNING_NO_WERROR : DiagMapping;
22 def MAP_WARNING_SHOW_IN_SYSTEM_HEADER : DiagMapping;
24 // Define the diagnostic classes.
26 def CLASS_NOTE : DiagClass;
27 def CLASS_WARNING : DiagClass;
28 def CLASS_EXTENSION : DiagClass;
29 def CLASS_ERROR : DiagClass;
31 // Diagnostic Categories. These can be applied to groups or individual
32 // diagnostics to specify a category.
33 class DiagCategory<string Name> {
34 string CategoryName = Name;
38 class DiagGroup<string Name, list<DiagGroup> subgroups = []> {
39 string GroupName = Name;
40 list<DiagGroup> SubGroups = subgroups;
41 string CategoryName = "";
43 class InGroup<DiagGroup G> { DiagGroup Group = G; }
44 //class IsGroup<string Name> { DiagGroup Group = DiagGroup<Name>; }
47 // This defines all of the named diagnostic categories.
48 include "DiagnosticCategories.td"
50 // This defines all of the named diagnostic groups.
51 include "DiagnosticGroups.td"
54 // All diagnostics emitted by the compiler are an indirect subclass of this.
55 class Diagnostic<string text, DiagClass DC, DiagMapping defaultmapping> {
56 /// Component is specified by the file with a big let directive.
61 bit AccessControl = 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 { DiagMapping DefaultMapping= MAP_WARNING_NO_WERROR; }
81 class DefaultWarnShowInSystemHeader {
82 DiagMapping DefaultMapping = MAP_WARNING_SHOW_IN_SYSTEM_HEADER;
85 class NoSFINAE { bit SFINAE = 0; }
86 class AccessControl { bit AccessControl = 1; }
88 class Brief<string str> { string Brief = str; }
89 class FullExplanation<string brief, string full> {
91 string Explanation = full;
94 // Definitions for Diagnostics.
95 include "DiagnosticASTKinds.td"
96 include "DiagnosticAnalysisKinds.td"
97 include "DiagnosticCommonKinds.td"
98 include "DiagnosticDriverKinds.td"
99 include "DiagnosticFrontendKinds.td"
100 include "DiagnosticLexKinds.td"
101 include "DiagnosticParseKinds.td"
102 include "DiagnosticSemaKinds.td"