• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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// Define the diagnostic mappings.
16class DiagMapping;
17def MAP_IGNORE  : DiagMapping;
18def MAP_WARNING : DiagMapping;
19def MAP_ERROR   : DiagMapping;
20def MAP_FATAL   : DiagMapping;
21
22// Define the diagnostic classes.
23class DiagClass;
24def CLASS_NOTE      : DiagClass;
25def CLASS_WARNING   : DiagClass;
26def CLASS_EXTENSION : DiagClass;
27def CLASS_ERROR     : DiagClass;
28
29// Diagnostic Categories.  These can be applied to groups or individual
30// diagnostics to specify a category.
31class DiagCategory<string Name> {
32  string CategoryName = Name;
33}
34
35// Diagnostic Groups.
36class DiagGroup<string Name, list<DiagGroup> subgroups = []> {
37  string GroupName = Name;
38  list<DiagGroup> SubGroups = subgroups;
39  string CategoryName = "";
40}
41class InGroup<DiagGroup G> { DiagGroup Group = G; }
42//class IsGroup<string Name> { DiagGroup Group = DiagGroup<Name>; }
43
44
45// This defines all of the named diagnostic categories.
46include "DiagnosticCategories.td"
47
48// This defines all of the named diagnostic groups.
49include "DiagnosticGroups.td"
50
51
52// All diagnostics emitted by the compiler are an indirect subclass of this.
53class Diagnostic<string text, DiagClass DC, DiagMapping defaultmapping> {
54  /// Component is specified by the file with a big let directive.
55  string      Component = ?;
56  string      Text = text;
57  DiagClass   Class = DC;
58  bit         SFINAE = 1;
59  bit         AccessControl = 0;
60  bit         WarningNoWerror = 0;
61  bit         WarningShowInSystemHeader = 0;
62  DiagMapping DefaultMapping = defaultmapping;
63  DiagGroup   Group;
64  string      CategoryName = "";
65}
66
67class Error<string str>     : Diagnostic<str, CLASS_ERROR, MAP_ERROR>;
68class Warning<string str>   : Diagnostic<str, CLASS_WARNING, MAP_WARNING>;
69class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_IGNORE>;
70class ExtWarn<string str>   : Diagnostic<str, CLASS_EXTENSION, MAP_WARNING>;
71class Note<string str>      : Diagnostic<str, CLASS_NOTE, MAP_FATAL/*ignored*/>;
72
73
74class DefaultIgnore { DiagMapping DefaultMapping = MAP_IGNORE; }
75class DefaultWarn   { DiagMapping DefaultMapping = MAP_WARNING; }
76class DefaultError  { DiagMapping DefaultMapping = MAP_ERROR; }
77class DefaultFatal  { DiagMapping DefaultMapping = MAP_FATAL; }
78class DefaultWarnNoWerror {
79  bit WarningNoWerror = 1;
80}
81class DefaultWarnShowInSystemHeader {
82  bit WarningShowInSystemHeader = 1;
83}
84
85class NoSFINAE { bit SFINAE = 0; }
86class AccessControl { bit AccessControl = 1; }
87
88// Definitions for Diagnostics.
89include "DiagnosticASTKinds.td"
90include "DiagnosticAnalysisKinds.td"
91include "DiagnosticCommentKinds.td"
92include "DiagnosticCommonKinds.td"
93include "DiagnosticDriverKinds.td"
94include "DiagnosticFrontendKinds.td"
95include "DiagnosticLexKinds.td"
96include "DiagnosticParseKinds.td"
97include "DiagnosticSemaKinds.td"
98include "DiagnosticSerializationKinds.td"
99
100