From 64275742e0dd880d786f45df1fef85d004b544ab Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Tue, 12 Jan 2021 08:55:57 +0000 Subject: [PATCH] ShaderModule: Enable the prettier tint diagnostic formatter Includes code snippits and squiggles of the offending line(s) Bug: none Change-Id: If704b5d1118d0246c16f6e729a10d16363a1169b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37281 Reviewed-by: Corentin Wallez Reviewed-by: Austin Eng Commit-Queue: Corentin Wallez Auto-Submit: Ben Clayton --- src/dawn_native/ShaderModule.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp index 3e1f3d90d6..98cdfa8ce7 100644 --- a/src/dawn_native/ShaderModule.cpp +++ b/src/dawn_native/ShaderModule.cpp @@ -179,7 +179,8 @@ namespace dawn_native { tint::reader::wgsl::Parser parser(file); if (!parser.Parse()) { - errorStream << "Parser: " << parser.error() << std::endl; + auto err = tint::diag::Formatter{}.format(parser.diagnostics()); + errorStream << "Parser: " << err << std::endl; return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); } @@ -229,7 +230,8 @@ namespace dawn_native { tint::Validator validator; if (!validator.Validate(module)) { - errorStream << "Validation: " << validator.error() << std::endl; + auto err = tint::diag::Formatter{}.format(validator.diagnostics()); + errorStream << "Validation: " << err << std::endl; return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); }