|
23 | 23 | #include <vector>
|
24 | 24 |
|
25 | 25 | namespace clang {
|
26 |
| - class DiagnosticsEngine; |
27 |
| - class DiagnosticBuilder; |
28 |
| - class LangOptions; |
29 |
| - class SourceLocation; |
30 |
| - |
31 |
| - // Import the diagnostic enums themselves. |
32 |
| - namespace diag { |
33 |
| - enum class Group; |
34 |
| - |
35 |
| - // Size of each of the diagnostic categories. |
36 |
| - enum { |
37 |
| - DIAG_SIZE_COMMON = 300, |
38 |
| - DIAG_SIZE_DRIVER = 400, |
39 |
| - DIAG_SIZE_FRONTEND = 200, |
40 |
| - DIAG_SIZE_SERIALIZATION = 120, |
41 |
| - DIAG_SIZE_LEX = 500, |
42 |
| - DIAG_SIZE_PARSE = 800, |
43 |
| - DIAG_SIZE_AST = 300, |
44 |
| - DIAG_SIZE_COMMENT = 100, |
45 |
| - DIAG_SIZE_CROSSTU = 100, |
46 |
| - DIAG_SIZE_SEMA = 5000, |
47 |
| - DIAG_SIZE_ANALYSIS = 100, |
48 |
| - DIAG_SIZE_REFACTORING = 1000, |
49 |
| - DIAG_SIZE_INSTALLAPI = 100, |
50 |
| - }; |
51 |
| - // Start position for diagnostics. |
52 |
| - enum { |
53 |
| - DIAG_START_COMMON = 0, |
54 |
| - DIAG_START_DRIVER = DIAG_START_COMMON + static_cast<int>(DIAG_SIZE_COMMON), |
55 |
| - DIAG_START_FRONTEND = DIAG_START_DRIVER + static_cast<int>(DIAG_SIZE_DRIVER), |
56 |
| - DIAG_START_SERIALIZATION = DIAG_START_FRONTEND + static_cast<int>(DIAG_SIZE_FRONTEND), |
57 |
| - DIAG_START_LEX = DIAG_START_SERIALIZATION + static_cast<int>(DIAG_SIZE_SERIALIZATION), |
58 |
| - DIAG_START_PARSE = DIAG_START_LEX + static_cast<int>(DIAG_SIZE_LEX), |
59 |
| - DIAG_START_AST = DIAG_START_PARSE + static_cast<int>(DIAG_SIZE_PARSE), |
60 |
| - DIAG_START_COMMENT = DIAG_START_AST + static_cast<int>(DIAG_SIZE_AST), |
61 |
| - DIAG_START_CROSSTU = DIAG_START_COMMENT + static_cast<int>(DIAG_SIZE_COMMENT), |
62 |
| - DIAG_START_SEMA = DIAG_START_CROSSTU + static_cast<int>(DIAG_SIZE_CROSSTU), |
63 |
| - DIAG_START_ANALYSIS = DIAG_START_SEMA + static_cast<int>(DIAG_SIZE_SEMA), |
64 |
| - DIAG_START_REFACTORING = DIAG_START_ANALYSIS + static_cast<int>(DIAG_SIZE_ANALYSIS), |
65 |
| - DIAG_START_INSTALLAPI = DIAG_START_REFACTORING + static_cast<int>(DIAG_SIZE_REFACTORING), |
66 |
| - DIAG_UPPER_LIMIT = DIAG_START_INSTALLAPI + static_cast<int>(DIAG_SIZE_INSTALLAPI) |
67 |
| - }; |
68 |
| - |
69 |
| - class CustomDiagInfo; |
70 |
| - |
71 |
| - /// All of the diagnostics that can be emitted by the frontend. |
72 |
| - typedef unsigned kind; |
73 |
| - |
74 |
| - /// Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs |
75 |
| - /// to either Ignore (nothing), Remark (emit a remark), Warning |
76 |
| - /// (emit a warning) or Error (emit as an error). It allows clients to |
77 |
| - /// map ERRORs to Error or Fatal (stop emitting diagnostics after this one). |
78 |
| - enum class Severity : uint8_t { |
79 |
| - // NOTE: 0 means "uncomputed". |
80 |
| - Ignored = 1, ///< Do not present this diagnostic, ignore it. |
81 |
| - Remark = 2, ///< Present this diagnostic as a remark. |
82 |
| - Warning = 3, ///< Present this diagnostic as a warning. |
83 |
| - Error = 4, ///< Present this diagnostic as an error. |
84 |
| - Fatal = 5 ///< Present this diagnostic as a fatal error. |
85 |
| - }; |
86 |
| - |
87 |
| - /// Flavors of diagnostics we can emit. Used to filter for a particular |
88 |
| - /// kind of diagnostic (for instance, for -W/-R flags). |
89 |
| - enum class Flavor { |
90 |
| - WarningOrError, ///< A diagnostic that indicates a problem or potential |
91 |
| - ///< problem. Can be made fatal by -Werror. |
92 |
| - Remark ///< A diagnostic that indicates normal progress through |
93 |
| - ///< compilation. |
94 |
| - }; |
95 |
| - } // end namespace diag |
| 26 | +class DiagnosticsEngine; |
| 27 | +class DiagnosticBuilder; |
| 28 | +class LangOptions; |
| 29 | +class SourceLocation; |
| 30 | + |
| 31 | +// Import the diagnostic enums themselves. |
| 32 | +namespace diag { |
| 33 | +enum class Group; |
| 34 | + |
| 35 | +// Size of each of the diagnostic categories. |
| 36 | +enum { |
| 37 | + DIAG_SIZE_COMMON = 300, |
| 38 | + DIAG_SIZE_DRIVER = 400, |
| 39 | + DIAG_SIZE_FRONTEND = 200, |
| 40 | + DIAG_SIZE_SERIALIZATION = 120, |
| 41 | + DIAG_SIZE_LEX = 500, |
| 42 | + DIAG_SIZE_PARSE = 800, |
| 43 | + DIAG_SIZE_AST = 300, |
| 44 | + DIAG_SIZE_COMMENT = 100, |
| 45 | + DIAG_SIZE_CROSSTU = 100, |
| 46 | + DIAG_SIZE_SEMA = 5000, |
| 47 | + DIAG_SIZE_ANALYSIS = 100, |
| 48 | + DIAG_SIZE_REFACTORING = 1000, |
| 49 | + DIAG_SIZE_INSTALLAPI = 100, |
| 50 | +}; |
| 51 | +// Start position for diagnostics. |
| 52 | +// clang-format off |
| 53 | +enum { |
| 54 | + DIAG_START_COMMON = 0, |
| 55 | + DIAG_START_DRIVER = DIAG_START_COMMON + static_cast<int>(DIAG_SIZE_COMMON), |
| 56 | + DIAG_START_FRONTEND = DIAG_START_DRIVER + static_cast<int>(DIAG_SIZE_DRIVER), |
| 57 | + DIAG_START_SERIALIZATION = DIAG_START_FRONTEND + static_cast<int>(DIAG_SIZE_FRONTEND), |
| 58 | + DIAG_START_LEX = DIAG_START_SERIALIZATION + static_cast<int>(DIAG_SIZE_SERIALIZATION), |
| 59 | + DIAG_START_PARSE = DIAG_START_LEX + static_cast<int>(DIAG_SIZE_LEX), |
| 60 | + DIAG_START_AST = DIAG_START_PARSE + static_cast<int>(DIAG_SIZE_PARSE), |
| 61 | + DIAG_START_COMMENT = DIAG_START_AST + static_cast<int>(DIAG_SIZE_AST), |
| 62 | + DIAG_START_CROSSTU = DIAG_START_COMMENT + static_cast<int>(DIAG_SIZE_COMMENT), |
| 63 | + DIAG_START_SEMA = DIAG_START_CROSSTU + static_cast<int>(DIAG_SIZE_CROSSTU), |
| 64 | + DIAG_START_ANALYSIS = DIAG_START_SEMA + static_cast<int>(DIAG_SIZE_SEMA), |
| 65 | + DIAG_START_REFACTORING = DIAG_START_ANALYSIS + static_cast<int>(DIAG_SIZE_ANALYSIS), |
| 66 | + DIAG_START_INSTALLAPI = DIAG_START_REFACTORING + static_cast<int>(DIAG_SIZE_REFACTORING), |
| 67 | + DIAG_UPPER_LIMIT = DIAG_START_INSTALLAPI + static_cast<int>(DIAG_SIZE_INSTALLAPI) |
| 68 | +}; |
| 69 | +// clang-format on |
| 70 | + |
| 71 | +class CustomDiagInfo; |
| 72 | + |
| 73 | +/// All of the diagnostics that can be emitted by the frontend. |
| 74 | +typedef unsigned kind; |
| 75 | + |
| 76 | +/// Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs |
| 77 | +/// to either Ignore (nothing), Remark (emit a remark), Warning |
| 78 | +/// (emit a warning) or Error (emit as an error). It allows clients to |
| 79 | +/// map ERRORs to Error or Fatal (stop emitting diagnostics after this one). |
| 80 | +enum class Severity : uint8_t { |
| 81 | + // NOTE: 0 means "uncomputed". |
| 82 | + Ignored = 1, ///< Do not present this diagnostic, ignore it. |
| 83 | + Remark = 2, ///< Present this diagnostic as a remark. |
| 84 | + Warning = 3, ///< Present this diagnostic as a warning. |
| 85 | + Error = 4, ///< Present this diagnostic as an error. |
| 86 | + Fatal = 5 ///< Present this diagnostic as a fatal error. |
| 87 | +}; |
| 88 | + |
| 89 | +/// Flavors of diagnostics we can emit. Used to filter for a particular |
| 90 | +/// kind of diagnostic (for instance, for -W/-R flags). |
| 91 | +enum class Flavor { |
| 92 | + WarningOrError, ///< A diagnostic that indicates a problem or potential |
| 93 | + ///< problem. Can be made fatal by -Werror. |
| 94 | + Remark ///< A diagnostic that indicates normal progress through |
| 95 | + ///< compilation. |
| 96 | +}; |
| 97 | +} // end namespace diag |
96 | 98 | } // end namespace clang
|
97 | 99 |
|
98 | 100 | // This has to be included *after* the DIAG_START_ enums above are defined.
|
@@ -173,7 +175,8 @@ class DiagnosticMapping {
|
173 | 175 |
|
174 | 176 | /// Used for handling and querying diagnostic IDs.
|
175 | 177 | ///
|
176 |
| -/// Can be used and shared by multiple Diagnostics for multiple translation units. |
| 178 | +/// Can be used and shared by multiple Diagnostics for multiple translation |
| 179 | +/// units. |
177 | 180 | class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
|
178 | 181 | public:
|
179 | 182 | /// The level of the diagnostic, after it has been through mapping.
|
@@ -498,6 +501,6 @@ class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
|
498 | 501 | friend class DiagnosticsEngine;
|
499 | 502 | };
|
500 | 503 |
|
501 |
| -} // end namespace clang |
| 504 | +} // end namespace clang |
502 | 505 |
|
503 | 506 | #endif
|
0 commit comments