blob: f14922a84117671c7b6ac83c8f65b91bcd517fc6 [file] [log] [blame]
{{- /*
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
*/ -}}
{{- $I := LoadIntrinsics "src/tint/lang/core/core.def" -}}
{{- Import "src/tint/utils/templates/enums.tmpl.inc" -}}
#include "src/tint/lang/core/diagnostic_severity.h"
#include <string>
namespace tint::core {
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" ($I.Sem.Enum "diagnostic_severity")}}
{{ Eval "EnumOStream" ($I.Sem.Enum "diagnostic_severity")}}
} // namespace tint::core