]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/llvm/tools/clang/include/clang/Basic/Diagnostic.td
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.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 // Define the diagnostic mappings.
16 class DiagMapping;
17 def MAP_IGNORE  : DiagMapping;
18 def MAP_WARNING : DiagMapping;
19 def MAP_ERROR   : DiagMapping;
20 def MAP_FATAL   : DiagMapping;
21
22 // Define the diagnostic classes.
23 class DiagClass;
24 def CLASS_NOTE      : DiagClass;
25 def CLASS_WARNING   : DiagClass;
26 def CLASS_EXTENSION : DiagClass;
27 def CLASS_ERROR     : DiagClass;
28
29 // Responses to a diagnostic in a SFINAE context.
30 class SFINAEResponse;
31 def SFINAE_SubstitutionFailure : SFINAEResponse;
32 def SFINAE_Suppress            : SFINAEResponse;
33 def SFINAE_Report              : SFINAEResponse;
34 def SFINAE_AccessControl       : SFINAEResponse;
35
36 // Diagnostic Categories.  These can be applied to groups or individual
37 // diagnostics to specify a category.
38 class DiagCategory<string Name> {
39   string CategoryName = Name;
40 }
41
42 // Diagnostic Groups.
43 class DiagGroup<string Name, list<DiagGroup> subgroups = []> {
44   string GroupName = Name;
45   list<DiagGroup> SubGroups = subgroups;
46   string CategoryName = "";
47 }
48 class InGroup<DiagGroup G> { DiagGroup Group = G; }
49 //class IsGroup<string Name> { DiagGroup Group = DiagGroup<Name>; }
50
51
52 // This defines all of the named diagnostic categories.
53 include "DiagnosticCategories.td"
54
55 // This defines all of the named diagnostic groups.
56 include "DiagnosticGroups.td"
57
58
59 // All diagnostics emitted by the compiler are an indirect subclass of this.
60 class Diagnostic<string text, DiagClass DC, DiagMapping defaultmapping> {
61   /// Component is specified by the file with a big let directive.
62   string         Component = ?;
63   string         Text = text;
64   DiagClass      Class = DC;
65   SFINAEResponse SFINAE = SFINAE_Suppress;
66   bit            AccessControl = 0;
67   bit            WarningNoWerror = 0;
68   bit            WarningShowInSystemHeader = 0;
69   DiagMapping    DefaultMapping = defaultmapping;
70   DiagGroup      Group;
71   string         CategoryName = "";
72 }
73
74 class SFINAEFailure {
75   SFINAEResponse SFINAE = SFINAE_SubstitutionFailure;
76 }
77 class NoSFINAE {
78   SFINAEResponse SFINAE = SFINAE_Report;
79 }
80 class AccessControl {
81   SFINAEResponse SFINAE = SFINAE_AccessControl;
82 }
83
84 // FIXME: ExtWarn and Extension should also be SFINAEFailure by default.
85 class Error<string str>     : Diagnostic<str, CLASS_ERROR, MAP_ERROR>, SFINAEFailure;
86 class Warning<string str>   : Diagnostic<str, CLASS_WARNING, MAP_WARNING>;
87 class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_IGNORE>;
88 class ExtWarn<string str>   : Diagnostic<str, CLASS_EXTENSION, MAP_WARNING>;
89 class Note<string str>      : Diagnostic<str, CLASS_NOTE, MAP_FATAL/*ignored*/>;
90
91
92 class DefaultIgnore { DiagMapping DefaultMapping = MAP_IGNORE; }
93 class DefaultWarn   { DiagMapping DefaultMapping = MAP_WARNING; }
94 class DefaultError  { DiagMapping DefaultMapping = MAP_ERROR; }
95 class DefaultFatal  { DiagMapping DefaultMapping = MAP_FATAL; }
96 class DefaultWarnNoWerror {
97   bit WarningNoWerror = 1;
98 }
99 class DefaultWarnShowInSystemHeader {
100   bit WarningShowInSystemHeader = 1;
101 }
102
103 // Definitions for Diagnostics.
104 include "DiagnosticASTKinds.td"
105 include "DiagnosticAnalysisKinds.td"
106 include "DiagnosticCommentKinds.td"
107 include "DiagnosticCommonKinds.td"
108 include "DiagnosticDriverKinds.td"
109 include "DiagnosticFrontendKinds.td"
110 include "DiagnosticLexKinds.td"
111 include "DiagnosticParseKinds.td"
112 include "DiagnosticSemaKinds.td"
113 include "DiagnosticSerializationKinds.td"
114