dan sinclair | b5af23d | 2023-02-19 17:34:44 +0000 | [diff] [blame] | 1 | {{- /* |
| 2 | -------------------------------------------------------------------------------- |
| 3 | Template file for use with tools/src/cmd/gen to generate diagnostic_control.h |
| 4 | |
| 5 | See: |
| 6 | * tools/src/cmd/gen for structures used by this template |
| 7 | * https://golang.org/pkg/text/template/ for documentation on the template syntax |
| 8 | -------------------------------------------------------------------------------- |
| 9 | */ -}} |
| 10 | |
| 11 | {{- Import "src/tint/templates/enums.tmpl.inc" -}} |
| 12 | |
| 13 | #ifndef SRC_TINT_BUILTIN_DIAGNOSTIC_SEVERITY_H_ |
| 14 | #define SRC_TINT_BUILTIN_DIAGNOSTIC_SEVERITY_H_ |
| 15 | |
| 16 | #include <ostream> |
| 17 | #include <string> |
| 18 | #include <unordered_map> |
| 19 | |
| 20 | #include "src/tint/builtin/diagnostic_rule.h" |
| 21 | #include "src/tint/diagnostic/diagnostic.h" |
| 22 | |
| 23 | namespace tint::builtin { |
| 24 | |
| 25 | /// The diagnostic severity control. |
| 26 | {{ Eval "DeclareEnum" (Sem.Enum "diagnostic_severity") }} |
| 27 | |
| 28 | /// Convert a DiagnosticSeverity to the corresponding diag::Severity. |
| 29 | diag::Severity ToSeverity(DiagnosticSeverity sc); |
| 30 | |
| 31 | /// DiagnosticRuleSeverities is a map from diagnostic rule to diagnostic severity. |
| 32 | using DiagnosticRuleSeverities = std::unordered_map<DiagnosticRule, DiagnosticSeverity>; |
| 33 | |
| 34 | } // namespace tint::builtin |
| 35 | |
| 36 | #endif // SRC_TINT_BUILTIN_DIAGNOSTIC_SEVERITY_H_ |