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 = "";
67 class Error<string str> : Diagnostic<str, CLASS_ERROR, MAP_ERROR>;
68 class Warning<string str> : Diagnostic<str, CLASS_WARNING, MAP_WARNING>;
69 class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_IGNORE>;
70 class ExtWarn<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_WARNING>;
71 class Note<string str> : Diagnostic<str, CLASS_NOTE, MAP_FATAL/*ignored*/>;
74 class DefaultIgnore { DiagMapping DefaultMapping = MAP_IGNORE; }
75 class DefaultWarn { DiagMapping DefaultMapping = MAP_WARNING; }
76 class DefaultError { DiagMapping DefaultMapping = MAP_ERROR; }
77 class DefaultFatal { DiagMapping DefaultMapping = MAP_FATAL; }
78 class DefaultWarnNoWerror {
79 bit WarningNoWerror = 1;
81 class DefaultWarnShowInSystemHeader {
82 bit WarningShowInSystemHeader = 1;
85 class NoSFINAE { bit SFINAE = 0; }
86 class AccessControl { bit AccessControl = 1; }
88 // Definitions for Diagnostics.
89 include "DiagnosticASTKinds.td"
90 include "DiagnosticAnalysisKinds.td"
91 include "DiagnosticCommonKinds.td"
92 include "DiagnosticDriverKinds.td"
93 include "DiagnosticFrontendKinds.td"
94 include "DiagnosticLexKinds.td"
95 include "DiagnosticParseKinds.td"
96 include "DiagnosticSemaKinds.td"
97 include "DiagnosticSerializationKinds.td"