aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/Diagnostic.td
blob: 0a86715453d41b478e075ce118e75401ce06e544 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//===--- Diagnostic.td - C Language Family Diagnostic Handling ------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines the TableGen core definitions for the diagnostics
//  and diagnostic control.
//
//===----------------------------------------------------------------------===//

// Define the diagnostic mappings.
class DiagMapping;
def MAP_IGNORE  : DiagMapping;
def MAP_WARNING : DiagMapping;
def MAP_ERROR   : DiagMapping;
def MAP_FATAL   : DiagMapping;

// Define the diagnostic classes.
class DiagClass;
def CLASS_NOTE      : DiagClass;
def CLASS_WARNING   : DiagClass;
def CLASS_EXTENSION : DiagClass;
def CLASS_ERROR     : DiagClass;

// Diagnostic Groups.
class DiagGroup<string Name> { string GroupName = Name; }
class InGroup<DiagGroup G> { DiagGroup Group = G; }
//class IsGroup<string Name> { DiagGroup Group = DiagGroup<Name>; }

def ImplicitFunctionDeclare : DiagGroup<"implicit-function-declaration">;
def Trigraphs : DiagGroup<"trigraphs">;

// Empty DiagGroups: these are recognized by clang but ignored.
def : DiagGroup<"extra">;
def : DiagGroup<"">;  // -W

def : DiagGroup<"aggregate-return">;
def : DiagGroup<"all">;
def : DiagGroup<"bad-function-cast">;
def : DiagGroup<"cast-align">;
def : DiagGroup<"cast-qual">;
def : DiagGroup<"char-align">;
def : DiagGroup<"char-subscripts">;
def : DiagGroup<"declaration-after-statement">;
def : DiagGroup<"error-implicit-function-declaration">;
def : DiagGroup<"error">;
def : DiagGroup<"format-security">;
def : DiagGroup<"format=2">;
def : DiagGroup<"format">;
def : DiagGroup<"four-char-constants">;
def : DiagGroup<"init-self">;
def : DiagGroup<"inline">;
def : DiagGroup<"int-to-pointer-cast">;
def : DiagGroup<"missing-braces">;
def : DiagGroup<"missing-declarations">;
def : DiagGroup<"missing-format-attribute">;
def : DiagGroup<"most">;
def : DiagGroup<"nested-externs">;
def : DiagGroup<"newline-eof">;
def : DiagGroup<"no-#warnings">;
def : DiagGroup<"no-comment">;
def : DiagGroup<"format-y2k">;
def : DiagGroup<"long-long">;
def : DiagGroup<"missing-field-initializers">;
def : DiagGroup<"nonportable-cfstrings">;
def : DiagGroup<"parentheses">;
def : DiagGroup<"strict-selector-match">;
def : DiagGroup<"nonportable-cfstrings">;
def : DiagGroup<"old-style-definition">;
def : DiagGroup<"packed">;
def : DiagGroup<"parentheses">;
def : DiagGroup<"pointer-arith">;
def : DiagGroup<"pointer-to-int-cast">;
def : DiagGroup<"redundant-decls">;
def : DiagGroup<"return-type">;
def : DiagGroup<"shadow">;
def : DiagGroup<"shorten-64-to-32">;
def : DiagGroup<"sign-compare">;
def : DiagGroup<"strict-overflow=">;
def : DiagGroup<"strict-overflow">;
def : DiagGroup<"strict-prototypes">;
def : DiagGroup<"switch">;
def : DiagGroup<"uninitialized">;
def : DiagGroup<"unknown-pragmas">;
def : DiagGroup<"unused-function">;
def : DiagGroup<"unused-label">;
def : DiagGroup<"unused-parameter">;
def : DiagGroup<"unused-value">;
def : DiagGroup<"unused-variable">;
def : DiagGroup<"variadic-macros">;
def : DiagGroup<"write-strings">;


// All diagnostics emitted by the compiler are an indirect subclass of this.
class Diagnostic<string text, DiagClass DC, DiagMapping defaultmapping> {
  /// Component is specified by the file with a big let directive.
  string      Component = ?;
  string      Text = text;
  DiagClass   Class = DC;
  DiagMapping DefaultMapping = defaultmapping;
  DiagGroup   Group;
}

class Error<string str>     : Diagnostic<str, CLASS_ERROR, MAP_ERROR>;
class Warning<string str>   : Diagnostic<str, CLASS_WARNING, MAP_WARNING>;
class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_IGNORE>;
class ExtWarn<string str>   : Diagnostic<str, CLASS_EXTENSION, MAP_WARNING>;
class Note<string str>      : Diagnostic<str, CLASS_NOTE, MAP_FATAL/*ignored*/>;


class DefaultIgnore { DiagMapping DefaultMapping = MAP_IGNORE; }
class DefaultWarn   { DiagMapping DefaultMapping = MAP_WARNING; }
class DefaultError  { DiagMapping DefaultMapping = MAP_ERROR; }
class DefaultFatal  { DiagMapping DefaultMapping = MAP_FATAL; }

// Definitions for Diagnostics.
include "DiagnosticASTKinds.td"
include "DiagnosticAnalysisKinds.td"
include "DiagnosticCommonKinds.td"
include "DiagnosticDriverKinds.td"
include "DiagnosticFrontendKinds.td"
include "DiagnosticLexKinds.td"
include "DiagnosticParseKinds.td"
include "DiagnosticSemaKinds.td"