diag: Add System enumerator to all diagnostics

Describes what Tint system raised the diagnostic.

Use this information in the fuzzers to distinguish between expected and unexpected failure cases in the Transform fuzzer tests.

Fixed: chromium:1206407
Fixed: chromium:1207154
Change-Id: I3b807acafe384a2fc363d2a4165a29693450b3cf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55254
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
Ben Clayton
2021-06-24 11:27:36 +00:00
committed by Tint LUCI CQ
parent 261643bb9f
commit ffd28e2e1a
94 changed files with 1005 additions and 902 deletions

View File

@@ -35,7 +35,7 @@ Array::Array(const Type* element,
size_(size),
stride_(stride),
implicit_stride_(implicit_stride) {
TINT_ASSERT(element_);
TINT_ASSERT(Semantic, element_);
}
std::string Array::type_name() const {

View File

@@ -23,7 +23,7 @@ namespace tint {
namespace sem {
Atomic::Atomic(const sem::Type* subtype) : subtype_(subtype) {
TINT_ASSERT(!subtype->Is<Reference>());
TINT_ASSERT(AST, !subtype->Is<Reference>());
}
std::string Atomic::type_name() const {

View File

@@ -23,7 +23,7 @@ namespace sem {
CallTarget::CallTarget(sem::Type* return_type, const ParameterList& parameters)
: return_type_(return_type), parameters_(parameters) {
TINT_ASSERT(return_type);
TINT_ASSERT(Semantic, return_type);
}
CallTarget::~CallTarget() = default;

View File

@@ -32,7 +32,7 @@ bool IsValidDepthDimension(ast::TextureDimension dim) {
} // namespace
DepthTexture::DepthTexture(ast::TextureDimension dim) : Base(dim) {
TINT_ASSERT(IsValidDepthDimension(dim));
TINT_ASSERT(Semantic, IsValidDepthDimension(dim));
}
DepthTexture::DepthTexture(DepthTexture&&) = default;

View File

@@ -23,7 +23,7 @@ Expression::Expression(const ast::Expression* declaration,
const sem::Type* type,
Statement* statement)
: declaration_(declaration), type_(type), statement_(statement) {
TINT_ASSERT(type_);
TINT_ASSERT(Semantic, type_);
}
} // namespace sem

View File

@@ -70,7 +70,7 @@ class Info {
void Add(const AST_OR_TYPE* node,
const SemanticNodeTypeFor<AST_OR_TYPE>* sem_node) {
// Check there's no semantic info already existing for the node
TINT_ASSERT(Get(node) == nullptr);
TINT_ASSERT(Semantic, Get(node) == nullptr);
map.emplace(node, sem_node);
}

View File

@@ -27,10 +27,10 @@ Matrix::Matrix(Vector* column_type, uint32_t columns)
column_type_(column_type),
rows_(column_type->size()),
columns_(columns) {
TINT_ASSERT(rows_ > 1);
TINT_ASSERT(rows_ < 5);
TINT_ASSERT(columns_ > 1);
TINT_ASSERT(columns_ < 5);
TINT_ASSERT(AST, rows_ > 1);
TINT_ASSERT(AST, rows_ < 5);
TINT_ASSERT(AST, columns_ > 1);
TINT_ASSERT(AST, columns_ < 5);
}
Matrix::Matrix(Matrix&&) = default;

View File

@@ -24,7 +24,7 @@ namespace sem {
MultisampledTexture::MultisampledTexture(ast::TextureDimension dim,
const Type* type)
: Base(dim), type_(type) {
TINT_ASSERT(type_);
TINT_ASSERT(Semantic, type_);
}
MultisampledTexture::MultisampledTexture(MultisampledTexture&&) = default;

View File

@@ -26,8 +26,8 @@ Pointer::Pointer(const Type* subtype,
ast::StorageClass storage_class,
ast::Access access)
: subtype_(subtype), storage_class_(storage_class), access_(access) {
TINT_ASSERT(!subtype->Is<Reference>());
TINT_ASSERT(access != ast::Access::kUndefined);
TINT_ASSERT(Semantic, !subtype->Is<Reference>());
TINT_ASSERT(Semantic, access != ast::Access::kUndefined);
}
std::string Pointer::type_name() const {

View File

@@ -25,8 +25,8 @@ Reference::Reference(const Type* subtype,
ast::StorageClass storage_class,
ast::Access access)
: subtype_(subtype), storage_class_(storage_class), access_(access) {
TINT_ASSERT(!subtype->Is<Reference>());
TINT_ASSERT(access != ast::Access::kUndefined);
TINT_ASSERT(Semantic, !subtype->Is<Reference>());
TINT_ASSERT(Semantic, access != ast::Access::kUndefined);
}
std::string Reference::type_name() const {

View File

@@ -23,7 +23,7 @@ namespace sem {
SampledTexture::SampledTexture(ast::TextureDimension dim, const Type* type)
: Base(dim), type_(type) {
TINT_ASSERT(type_);
TINT_ASSERT(Semantic, type_);
}
SampledTexture::SampledTexture(SampledTexture&&) = default;

View File

@@ -47,7 +47,7 @@ Statement::Statement(const ast::Statement* declaration, const Statement* parent)
}
}
}
TINT_ASSERT(statement_is_continuing_for_loop);
TINT_ASSERT(Semantic, statement_is_continuing_for_loop);
}
}
}

View File

@@ -23,8 +23,8 @@ namespace sem {
Vector::Vector(Type const* subtype, uint32_t size)
: subtype_(subtype), size_(size) {
TINT_ASSERT(size_ > 1);
TINT_ASSERT(size_ < 5);
TINT_ASSERT(Semantic, size_ > 1);
TINT_ASSERT(Semantic, size_ < 5);
}
Vector::Vector(Vector&&) = default;