blob: fdc3a8d10ea9e0ac43d07e8044ae168b8f143a45 [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/wgsl/wgsl.def" -}}
{{- Import "src/tint/utils/templates/enums.tmpl.inc" -}}
#include "src/tint/lang/wgsl/diagnostic_severity.h"
#include <string>
namespace tint::wgsl {
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::wgsl