blob: ff0f70e11ca6c7f66162c3b1a5edca5673c19c1d [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::Error;
}
}
{{ Eval "ParseEnum" ($I.Sem.Enum "diagnostic_severity")}}
{{ Eval "EnumOStream" ($I.Sem.Enum "diagnostic_severity")}}
} // namespace tint::wgsl