Diagnostics: Add error code to the Diagnostic

Allows this to be formatted similarly to the severity.

Change-Id: I74cd863d8f1d94089ce753ab76a2c70784eb5553
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33938
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
Ben Clayton
2020-11-26 17:49:22 +00:00
committed by Commit Bot service account
parent 61ec48b99e
commit f32a3c1f35
9 changed files with 167 additions and 140 deletions

View File

@@ -58,6 +58,12 @@ class ValidatorImpl {
/// @returns true if an error was encountered
bool has_error() const { return diags_.contains_errors(); }
/// Appends an error at @p src with the code @p code and message @p msg
/// @param src the source causing the error
/// @param code the validation error code
/// @param msg the error message
void add_error(const Source& src, const char* code, const std::string& msg);
/// Appends an error at @p src with the message @p msg
/// @param src the source causing the error
/// @param msg the error message