Add Diagnostics to Program, reader::[wgsl,spirv]::Parse()

By putting diagnostics into the program, we can hold all the diagnostic messages for parsing and type determination in one place.
This also means that we can simplify the public WGSL and SPIR-V Parser interfaces to a single function.

Change-Id: Ib6ab5fa180addd45c4aaf0c6b192d47182ffb50a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38920
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2021-01-27 18:49:05 +00:00
committed by Commit Bot service account
parent 21b52b60b6
commit 844217fa34
16 changed files with 181 additions and 43 deletions

View File

@@ -54,6 +54,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return 0;
}
auto src = parser.program();
if (!src.IsValid()) {
return 0;
}
// Clone the src program to dst
tint::Program dst(src.Clone());