blob: 3278bb1f812a3c73f337f67d59198a9bb7e3f888 [file] [log] [blame] [edit]
{{- /*
--------------------------------------------------------------------------------
Template file for use with tools/src/cmd/gen to generate diagnostic_control.cc
See:
* tools/src/cmd/gen for structures used by this template
* https://golang.org/pkg/text/template/ for documentation on the template syntax
--------------------------------------------------------------------------------
*/ -}}
{{- Import "src/tint/templates/enums.tmpl.inc" -}}
#include "src/tint/builtin/diagnostic_severity.h"
#include <string>
namespace tint::builtin {
diag::Severity ToSeverity(DiagnosticSeverity sc) {
switch (sc) {
case DiagnosticSeverity::kError:
return diag::Severity::Error;
case DiagnosticSeverity::kWarning:
return diag::Severity::Warning;
case DiagnosticSeverity::kInfo:
return diag::Severity::Note;
default:
return diag::Severity::InternalCompilerError;
}
}
{{ Eval "ParseEnum" (Sem.Enum "diagnostic_severity")}}
{{ Eval "EnumOStream" (Sem.Enum "diagnostic_severity")}}
} // namespace tint::builtin