Move struct validation from Validator to Resolver

* Moved Validator::ValidateConstructedType, which only validated
structs, to Resolver as ValidateStructure.
* Moved relevant tests to new files, and also updated all failing tests
to validate Source location.
* Fixed other tests that broke now that we're validating structs.

Bug: tint:642
Change-Id: Iefc08ef548f52d8c3798d814d2183c56d1236c2d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/45160
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Antonio Maiorano
2021-03-18 17:59:54 +00:00
committed by Commit Bot service account
parent e072465d83
commit 9970ec63ca
16 changed files with 497 additions and 322 deletions

View File

@@ -110,21 +110,35 @@ class List {
/// adds the error message without a source to the end of this list.
/// @param err_msg the error message
void add_error(const std::string& err_msg) {
void add_error(std::string err_msg) {
diag::Diagnostic error{};
error.severity = diag::Severity::Error;
error.message = err_msg;
error.message = std::move(err_msg);
add(std::move(error));
}
/// adds the error message with the given Source to the end of this list.
/// @param err_msg the error message
/// @param source the source of the error diagnostic
void add_error(const std::string& err_msg, const Source& source) {
void add_error(std::string err_msg, const Source& source) {
diag::Diagnostic error{};
error.severity = diag::Severity::Error;
error.source = source;
error.message = err_msg;
error.message = std::move(err_msg);
add(std::move(error));
}
/// adds the error message with the given code and Source to the end of this
/// list.
/// @param code the error code
/// @param err_msg the error message
/// @param source the source of the error diagnostic
void add_error(const char* code, std::string err_msg, const Source& source) {
diag::Diagnostic error{};
error.code = code;
error.severity = diag::Severity::Error;
error.source = source;
error.message = std::move(err_msg);
add(std::move(error));
}