[tint][diagnostics] Remove System enum
This was only used by the old fuzzers to determine whether to fail the fuzzer when a backend errored (transform vs other).
This is no longer used in the new fuzzers, and so this enum is now entirely redundant.
Change-Id: Ieb7a222cc8c1d942efaba28ba690d38fb2b7c351
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/186622
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/lang/core/constant/eval.cc b/src/tint/lang/core/constant/eval.cc
index 0b78386..36069fd 100644
--- a/src/tint/lang/core/constant/eval.cc
+++ b/src/tint/lang/core/constant/eval.cc
@@ -281,7 +281,7 @@
// [abstract-numeric -> x] - materialization failure
auto msg = OverflowErrorMessage(scalar->value, target_ty->FriendlyName());
if (ctx.use_runtime_semantics) {
- ctx.diags.AddWarning(tint::diag::System::Resolver, ctx.source) << msg;
+ ctx.diags.AddWarning(ctx.source) << msg;
switch (conv.Failure()) {
case ConversionFailure::kExceedsNegativeLimit:
return ctx.mgr.Get<Scalar<TO>>(target_ty, TO::Lowest());
@@ -289,7 +289,7 @@
return ctx.mgr.Get<Scalar<TO>>(target_ty, TO::Highest());
}
} else {
- ctx.diags.AddError(tint::diag::System::Resolver, ctx.source) << msg;
+ ctx.diags.AddError(ctx.source) << msg;
return nullptr;
}
} else if constexpr (IsFloatingPoint<TO>) {
@@ -297,7 +297,7 @@
// https://www.w3.org/TR/WGSL/#floating-point-conversion
auto msg = OverflowErrorMessage(scalar->value, target_ty->FriendlyName());
if (ctx.use_runtime_semantics) {
- ctx.diags.AddWarning(tint::diag::System::Resolver, ctx.source) << msg;
+ ctx.diags.AddWarning(ctx.source) << msg;
switch (conv.Failure()) {
case ConversionFailure::kExceedsNegativeLimit:
return ctx.mgr.Get<Scalar<TO>>(target_ty, TO::Lowest());
@@ -305,7 +305,7 @@
return ctx.mgr.Get<Scalar<TO>>(target_ty, TO::Highest());
}
} else {
- ctx.diags.AddError(tint::diag::System::Resolver, ctx.source) << msg;
+ ctx.diags.AddError(ctx.source) << msg;
return nullptr;
}
} else if constexpr (IsFloatingPoint<FROM>) {
@@ -4014,18 +4014,18 @@
diag::Diagnostic& Eval::AddError(const Source& source) const {
if (use_runtime_semantics_) {
- return diags.AddWarning(diag::System::Constant, source);
+ return diags.AddWarning(source);
} else {
- return diags.AddError(diag::System::Constant, source);
+ return diags.AddError(source);
}
}
diag::Diagnostic& Eval::AddWarning(const Source& source) const {
- return diags.AddWarning(diag::System::Constant, source);
+ return diags.AddWarning(source);
}
diag::Diagnostic& Eval::AddNote(const Source& source) const {
- return diags.AddNote(diag::System::Constant, source);
+ return diags.AddNote(source);
}
} // namespace tint::core::constant
diff --git a/src/tint/lang/core/ir/validator.cc b/src/tint/lang/core/ir/validator.cc
index 27f1e24..bee3ef3 100644
--- a/src/tint/lang/core/ir/validator.cc
+++ b/src/tint/lang/core/ir/validator.cc
@@ -440,8 +440,7 @@
}
if (diagnostics_.ContainsErrors()) {
- diagnostics_.AddNote(tint::diag::System::IR, Source{}) << "# Disassembly\n"
- << Disassembly().Text();
+ diagnostics_.AddNote(Source{}) << "# Disassembly\n" << Disassembly().Text();
return Failure{std::move(diagnostics_)};
}
return Success;
@@ -527,13 +526,13 @@
}
diag::Diagnostic& Validator::AddError(Source src) {
- auto& diag = diagnostics_.AddError(tint::diag::System::IR, src);
+ auto& diag = diagnostics_.AddError(src);
diag.owned_file = Disassembly().File();
return diag;
}
diag::Diagnostic& Validator::AddNote(Source src) {
- auto& diag = diagnostics_.AddNote(tint::diag::System::IR, src);
+ auto& diag = diagnostics_.AddNote(src);
diag.owned_file = Disassembly().File();
return diag;
}
diff --git a/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc b/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
index 067f38c..92b6cad 100644
--- a/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
@@ -397,7 +397,7 @@
auto* dst_type = TypeOf(call);
if (!dst_type->is_integer_scalar_or_vector() && !dst_type->is_float_scalar_or_vector()) {
- diagnostics_.AddError(diag::System::Writer, Source{})
+ diagnostics_.AddError(Source{})
<< "Unable to do bitcast to type " << dst_type->FriendlyName();
return;
}
@@ -1744,8 +1744,7 @@
case wgsl::BuiltinFn::kUnpack4X8Unorm:
return "unpackUnorm4x8";
default:
- diagnostics_.AddError(diag::System::Writer, Source{})
- << "Unknown builtin method: " << builtin;
+ diagnostics_.AddError(Source{}) << "Unknown builtin method: " << builtin;
}
return "";
@@ -1923,7 +1922,7 @@
[&](const ast::Let* let) { EmitProgramConstVariable(let); },
[&](const ast::Override*) {
// Override is removed with SubstituteOverride
- diagnostics_.AddError(diag::System::Writer, Source{})
+ diagnostics_.AddError(Source{})
<< "override-expressions should have been removed with the "
"SubstituteOverride transform";
},
@@ -2192,7 +2191,7 @@
out << "local_size_" << (i == 0 ? "x" : i == 1 ? "y" : "z") << " = ";
if (!wgsize[i].has_value()) {
- diagnostics_.AddError(diag::System::Writer, Source{})
+ diagnostics_.AddError(Source{})
<< "override-expressions should have been removed with the SubstituteOverride "
"transform";
return;
@@ -2295,8 +2294,7 @@
auto count = a->ConstantCount();
if (!count) {
- diagnostics_.AddError(diag::System::Writer, Source{})
- << core::type::Array::kErrExpectedConstantCount;
+ diagnostics_.AddError(Source{}) << core::type::Array::kErrExpectedConstantCount;
return;
}
@@ -2347,8 +2345,7 @@
return;
}
}
- diagnostics_.AddError(diag::System::Writer, Source{})
- << "unknown integer literal suffix type";
+ diagnostics_.AddError(Source{}) << "unknown integer literal suffix type";
}, //
TINT_ICE_ON_NO_MATCH);
}
@@ -2400,8 +2397,7 @@
auto count = arr->ConstantCount();
if (!count) {
- diagnostics_.AddError(diag::System::Writer, Source{})
- << core::type::Array::kErrExpectedConstantCount;
+ diagnostics_.AddError(Source{}) << core::type::Array::kErrExpectedConstantCount;
return;
}
@@ -2412,7 +2408,7 @@
EmitZeroValue(out, arr->ElemType());
}
} else {
- diagnostics_.AddError(diag::System::Writer, Source{})
+ diagnostics_.AddError(Source{})
<< "Invalid type for zero emission: " << type->FriendlyName();
}
}
@@ -2688,8 +2684,7 @@
} else {
auto count = arr->ConstantCount();
if (!count) {
- diagnostics_.AddError(diag::System::Writer, Source{})
- << core::type::Array::kErrExpectedConstantCount;
+ diagnostics_.AddError(Source{}) << core::type::Array::kErrExpectedConstantCount;
return;
}
sizes.push_back(count.value());
@@ -2844,7 +2839,7 @@
} else if (type->Is<core::type::Void>()) {
out << "void";
} else {
- diagnostics_.AddError(diag::System::Writer, Source{}) << "unknown type in EmitType";
+ diagnostics_.AddError(Source{}) << "unknown type in EmitType";
}
}
diff --git a/src/tint/lang/glsl/writer/ast_printer/ast_printer_test.cc b/src/tint/lang/glsl/writer/ast_printer/ast_printer_test.cc
index 4c8c40c..125afe8 100644
--- a/src/tint/lang/glsl/writer/ast_printer/ast_printer_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/ast_printer_test.cc
@@ -35,7 +35,7 @@
using GlslASTPrinterTest = TestHelper;
TEST_F(GlslASTPrinterTest, InvalidProgram) {
- Diagnostics().AddError(diag::System::Writer, Source{}) << "make the program invalid";
+ Diagnostics().AddError(Source{}) << "make the program invalid";
ASSERT_FALSE(IsValid());
auto program = resolver::Resolve(*this);
ASSERT_FALSE(program.IsValid());
diff --git a/src/tint/lang/glsl/writer/ast_raise/combine_samplers.cc b/src/tint/lang/glsl/writer/ast_raise/combine_samplers.cc
index 9b09f57..fcaef5e 100644
--- a/src/tint/lang/glsl/writer/ast_raise/combine_samplers.cc
+++ b/src/tint/lang/glsl/writer/ast_raise/combine_samplers.cc
@@ -441,8 +441,7 @@
auto* binding_info = inputs.Get<BindingInfo>();
if (!binding_info) {
ProgramBuilder b;
- b.Diagnostics().AddError(diag::System::Transform, Source{})
- << "missing transform data for " << TypeInfo().name;
+ b.Diagnostics().AddError(Source{}) << "missing transform data for " << TypeInfo().name;
return resolver::Resolve(b);
}
diff --git a/src/tint/lang/glsl/writer/ast_raise/texture_builtins_from_uniform.cc b/src/tint/lang/glsl/writer/ast_raise/texture_builtins_from_uniform.cc
index 89cebe1..d0e8c71 100644
--- a/src/tint/lang/glsl/writer/ast_raise/texture_builtins_from_uniform.cc
+++ b/src/tint/lang/glsl/writer/ast_raise/texture_builtins_from_uniform.cc
@@ -74,7 +74,7 @@
ApplyResult Run() {
auto* cfg = inputs.Get<Config>();
if (cfg == nullptr) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
+ b.Diagnostics().AddError(Source{})
<< "missing transform data for "
<< tint::TypeInfo::Of<TextureBuiltinsFromUniform>().name;
return resolver::Resolve(b);
diff --git a/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc b/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
index 13b1fd6..35a7140 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/ast_printer.cc
@@ -709,7 +709,7 @@
auto* dst_el_type = dst_type->DeepestElement();
if (!dst_el_type->is_integer_scalar() && !dst_el_type->is_float_scalar()) {
- diagnostics_.AddError(diag::System::Writer, Source{})
+ diagnostics_.AddError(Source{})
<< "Unable to do bitcast to type " << dst_el_type->FriendlyName();
return false;
}
@@ -3122,8 +3122,7 @@
case wgsl::BuiltinFn::kSubgroupBroadcast:
return "WaveReadLaneAt";
default:
- diagnostics_.AddError(diag::System::Writer, Source{})
- << "Unknown builtin method: " << builtin->str();
+ diagnostics_.AddError(Source{}) << "Unknown builtin method: " << builtin->str();
}
return "";
@@ -3394,7 +3393,7 @@
case core::AddressSpace::kWorkgroup:
return EmitWorkgroupVariable(sem);
case core::AddressSpace::kPushConstant:
- diagnostics_.AddError(diag::System::Writer, Source{})
+ diagnostics_.AddError(Source{})
<< "unhandled address space " << sem->AddressSpace();
return false;
default: {
@@ -3405,7 +3404,7 @@
},
[&](const ast::Override*) {
// Override is removed with SubstituteOverride
- diagnostics_.AddError(diag::System::Writer, Source{})
+ diagnostics_.AddError(Source{})
<< "override-expressions should have been removed with the SubstituteOverride "
"transform";
return false;
@@ -3630,7 +3629,7 @@
out << ", ";
}
if (!wgsize[i].has_value()) {
- diagnostics_.AddError(diag::System::Writer, Source{})
+ diagnostics_.AddError(Source{})
<< "override-expressions should have been removed with the "
"SubstituteOverride transform";
return false;
@@ -3784,8 +3783,7 @@
auto count = a->ConstantCount();
if (!count) {
- diagnostics_.AddError(diag::System::Writer, Source{})
- << core::type::Array::kErrExpectedConstantCount;
+ diagnostics_.AddError(Source{}) << core::type::Array::kErrExpectedConstantCount;
return false;
}
@@ -3880,8 +3878,7 @@
out << "u";
return true;
}
- diagnostics_.AddError(diag::System::Writer, Source{})
- << "unknown integer literal suffix type";
+ diagnostics_.AddError(Source{}) << "unknown integer literal suffix type";
return false;
}, //
TINT_ICE_ON_NO_MATCH);
@@ -4348,8 +4345,7 @@
}
const auto count = arr->ConstantCount();
if (!count) {
- diagnostics_.AddError(diag::System::Writer, Source{})
- << core::type::Array::kErrExpectedConstantCount;
+ diagnostics_.AddError(Source{}) << core::type::Array::kErrExpectedConstantCount;
return false;
}
@@ -4588,7 +4584,7 @@
if (auto builtin = attributes.builtin) {
auto name = builtin_to_attribute(builtin.value());
if (name.empty()) {
- diagnostics_.AddError(diag::System::Writer, Source{}) << "unsupported builtin";
+ diagnostics_.AddError(Source{}) << "unsupported builtin";
return false;
}
post += " : " + name;
@@ -4596,8 +4592,7 @@
if (auto interpolation = attributes.interpolation) {
auto mod = interpolation_to_modifiers(interpolation->type, interpolation->sampling);
if (mod.empty()) {
- diagnostics_.AddError(diag::System::Writer, Source{})
- << "unsupported interpolation";
+ diagnostics_.AddError(Source{}) << "unsupported interpolation";
return false;
}
pre += mod;
diff --git a/src/tint/lang/hlsl/writer/ast_printer/ast_printer_test.cc b/src/tint/lang/hlsl/writer/ast_printer/ast_printer_test.cc
index 8348b54..1a99d1f 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/ast_printer_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/ast_printer_test.cc
@@ -35,7 +35,7 @@
using HlslASTPrinterTest = TestHelper;
TEST_F(HlslASTPrinterTest, InvalidProgram) {
- Diagnostics().AddError(diag::System::Writer, Source{}) << "make the program invalid";
+ Diagnostics().AddError(Source{}) << "make the program invalid";
ASSERT_FALSE(IsValid());
auto program = resolver::Resolve(*this);
ASSERT_FALSE(program.IsValid());
diff --git a/src/tint/lang/hlsl/writer/ast_raise/num_workgroups_from_uniform.cc b/src/tint/lang/hlsl/writer/ast_raise/num_workgroups_from_uniform.cc
index f266d83..bee8ba5 100644
--- a/src/tint/lang/hlsl/writer/ast_raise/num_workgroups_from_uniform.cc
+++ b/src/tint/lang/hlsl/writer/ast_raise/num_workgroups_from_uniform.cc
@@ -90,8 +90,7 @@
auto* cfg = inputs.Get<Config>();
if (cfg == nullptr) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
- << "missing transform data for " << TypeInfo().name;
+ b.Diagnostics().AddError(Source{}) << "missing transform data for " << TypeInfo().name;
return resolver::Resolve(b);
}
diff --git a/src/tint/lang/hlsl/writer/ast_raise/pixel_local.cc b/src/tint/lang/hlsl/writer/ast_raise/pixel_local.cc
index fd59677..d193740 100644
--- a/src/tint/lang/hlsl/writer/ast_raise/pixel_local.cc
+++ b/src/tint/lang/hlsl/writer/ast_raise/pixel_local.cc
@@ -469,7 +469,7 @@
uint32_t ROVRegisterIndex(uint32_t field_index) {
auto idx = cfg.pls_member_to_rov_reg.Get(field_index);
if (TINT_UNLIKELY(!idx)) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
+ b.Diagnostics().AddError(Source{})
<< "PixelLocal::Config::attachments missing entry for field " << field_index;
return 0;
}
@@ -501,8 +501,7 @@
auto* cfg = inputs.Get<Config>();
if (!cfg) {
ProgramBuilder b;
- b.Diagnostics().AddError(diag::System::Transform, Source{})
- << "missing transform data for " << TypeInfo().name;
+ b.Diagnostics().AddError(Source{}) << "missing transform data for " << TypeInfo().name;
return resolver::Resolve(b);
}
diff --git a/src/tint/lang/hlsl/writer/ast_raise/truncate_interstage_variables.cc b/src/tint/lang/hlsl/writer/ast_raise/truncate_interstage_variables.cc
index 7028093..07dd208 100644
--- a/src/tint/lang/hlsl/writer/ast_raise/truncate_interstage_variables.cc
+++ b/src/tint/lang/hlsl/writer/ast_raise/truncate_interstage_variables.cc
@@ -70,7 +70,7 @@
const auto* data = config.Get<Config>();
if (data == nullptr) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
+ b.Diagnostics().AddError(Source{})
<< "missing transform data for "
<< tint::TypeInfo::Of<TruncateInterstageVariables>().name;
return resolver::Resolve(b);
diff --git a/src/tint/lang/hlsl/writer/common/option_helpers.cc b/src/tint/lang/hlsl/writer/common/option_helpers.cc
index 416569d..ec26be9 100644
--- a/src/tint/lang/hlsl/writer/common/option_helpers.cc
+++ b/src/tint/lang/hlsl/writer/common/option_helpers.cc
@@ -54,8 +54,7 @@
const binding::BindingInfo& dst) -> bool {
if (auto binding = seen_wgsl_bindings.Get(src)) {
if (*binding != dst) {
- diagnostics.AddError(diag::System::Writer, Source{})
- << "found duplicate WGSL binding point: " << src;
+ diagnostics.AddError(Source{}) << "found duplicate WGSL binding point: " << src;
return true;
}
}
@@ -67,7 +66,7 @@
const tint::BindingPoint& dst) -> bool {
if (auto binding = map.Get(src)) {
if (*binding != dst) {
- diagnostics.AddError(diag::System::Writer, Source{})
+ diagnostics.AddError(Source{})
<< "found duplicate MSL binding point: [binding: " << src.binding << "]";
return true;
}
@@ -94,27 +93,27 @@
// Storage and uniform are both [[buffer()]]
if (!valid(seen_hlsl_buffer_bindings, options.bindings.uniform)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing uniform";
+ diagnostics.AddNote(Source{}) << "when processing uniform";
return Failure{std::move(diagnostics)};
}
if (!valid(seen_hlsl_buffer_bindings, options.bindings.storage)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing storage";
+ diagnostics.AddNote(Source{}) << "when processing storage";
return Failure{std::move(diagnostics)};
}
// Sampler is [[sampler()]]
if (!valid(seen_hlsl_sampler_bindings, options.bindings.sampler)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing sampler";
+ diagnostics.AddNote(Source{}) << "when processing sampler";
return Failure{std::move(diagnostics)};
}
// Texture and storage texture are [[texture()]]
if (!valid(seen_hlsl_texture_bindings, options.bindings.texture)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing texture";
+ diagnostics.AddNote(Source{}) << "when processing texture";
return Failure{std::move(diagnostics)};
}
if (!valid(seen_hlsl_texture_bindings, options.bindings.storage_texture)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing storage_texture";
+ diagnostics.AddNote(Source{}) << "when processing storage_texture";
return Failure{std::move(diagnostics)};
}
@@ -126,26 +125,22 @@
// Validate with the actual source regardless of what the remapper will do
if (wgsl_seen(src_binding, plane0)) {
- diagnostics.AddNote(diag::System::Writer, Source{})
- << "when processing external_texture";
+ diagnostics.AddNote(Source{}) << "when processing external_texture";
return Failure{std::move(diagnostics)};
}
// Plane0 & Plane1 are [[texture()]]
if (hlsl_seen(seen_hlsl_texture_bindings, plane0, src_binding)) {
- diagnostics.AddNote(diag::System::Writer, Source{})
- << "when processing external_texture";
+ diagnostics.AddNote(Source{}) << "when processing external_texture";
return Failure{std::move(diagnostics)};
}
if (hlsl_seen(seen_hlsl_texture_bindings, plane1, src_binding)) {
- diagnostics.AddNote(diag::System::Writer, Source{})
- << "when processing external_texture";
+ diagnostics.AddNote(Source{}) << "when processing external_texture";
return Failure{std::move(diagnostics)};
}
// Metadata is [[buffer()]]
if (hlsl_seen(seen_hlsl_buffer_bindings, metadata, src_binding)) {
- diagnostics.AddNote(diag::System::Writer, Source{})
- << "when processing external_texture";
+ diagnostics.AddNote(Source{}) << "when processing external_texture";
return Failure{std::move(diagnostics)};
}
}
diff --git a/src/tint/lang/msl/writer/ast_printer/ast_printer.cc b/src/tint/lang/msl/writer/ast_printer/ast_printer.cc
index bb583cd..0ba01d6 100644
--- a/src/tint/lang/msl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/msl/writer/ast_printer/ast_printer.cc
@@ -314,7 +314,7 @@
},
[&](const ast::Override*) {
// Override is removed with SubstituteOverride
- diagnostics_.AddError(diag::System::Writer, Source{})
+ diagnostics_.AddError(Source{})
<< "override-expressions should have been removed with the "
"SubstituteOverride transform.";
return false;
@@ -373,8 +373,7 @@
return false;
}
} else {
- diagnostics_.AddError(diag::System::Writer, Source{})
- << "unknown alias type: " << ty->FriendlyName();
+ diagnostics_.AddError(Source{}) << "unknown alias type: " << ty->FriendlyName();
return false;
}
@@ -1073,8 +1072,7 @@
std::vector<const char*> dims;
switch (texture_type->dim()) {
case core::type::TextureDimension::kNone:
- diagnostics_.AddError(diag::System::Writer, Source{})
- << "texture dimension is kNone";
+ diagnostics_.AddError(Source{}) << "texture dimension is kNone";
return false;
case core::type::TextureDimension::k1d:
dims = {"width"};
@@ -1273,7 +1271,7 @@
out << "gradientcube(";
break;
default: {
- diagnostics_.AddError(diag::System::Writer, Source{})
+ diagnostics_.AddError(Source{})
<< "MSL does not support gradients for " << dim << " textures";
return false;
}
@@ -1630,13 +1628,12 @@
out += "unpack_unorm2x16_to_float";
break;
case wgsl::BuiltinFn::kArrayLength:
- diagnostics_.AddError(diag::System::Writer, Source{})
+ diagnostics_.AddError(Source{})
<< "Unable to translate builtin: " << builtin->Fn()
<< "\nDid you forget to pass array_length_from_uniform generator options?";
return "";
default:
- diagnostics_.AddError(diag::System::Writer, Source{})
- << "Unknown import method: " << builtin->Fn();
+ diagnostics_.AddError(Source{}) << "Unknown import method: " << builtin->Fn();
return "";
}
return out;
@@ -1811,8 +1808,7 @@
auto count = a->ConstantCount();
if (!count) {
- diagnostics_.AddError(diag::System::Writer, Source{})
- << core::type::Array::kErrExpectedConstantCount;
+ diagnostics_.AddError(Source{}) << core::type::Array::kErrExpectedConstantCount;
return false;
}
@@ -1882,8 +1878,7 @@
return true;
}
}
- diagnostics_.AddError(diag::System::Writer, Source{})
- << "unknown integer literal suffix type";
+ diagnostics_.AddError(Source{}) << "unknown integer literal suffix type";
return false;
}, //
TINT_ICE_ON_NO_MATCH);
@@ -2078,8 +2073,7 @@
auto name = BuiltinToAttribute(builtin);
if (name.empty()) {
- diagnostics_.AddError(diag::System::Writer, Source{})
- << "unknown builtin";
+ diagnostics_.AddError(Source{}) << "unknown builtin";
return false;
}
out << " [[" << name << "]]";
@@ -2536,8 +2530,7 @@
} else {
auto count = arr->ConstantCount();
if (!count) {
- diagnostics_.AddError(diag::System::Writer, Source{})
- << core::type::Array::kErrExpectedConstantCount;
+ diagnostics_.AddError(Source{}) << core::type::Array::kErrExpectedConstantCount;
return false;
}
@@ -2632,8 +2625,7 @@
out << "cube_array";
break;
default:
- diagnostics_.AddError(diag::System::Writer, Source{})
- << "Invalid texture dimensions";
+ diagnostics_.AddError(Source{}) << "Invalid texture dimensions";
return false;
}
if (tex->IsAnyOf<core::type::MultisampledTexture,
@@ -2666,7 +2658,7 @@
} else if (storage->access() == core::Access::kWrite) {
out << ", access::write";
} else {
- diagnostics_.AddError(diag::System::Writer, Source{})
+ diagnostics_.AddError(Source{})
<< "Invalid access control for storage texture";
return false;
}
@@ -2808,7 +2800,7 @@
if (auto builtin = attributes.builtin) {
auto name = BuiltinToAttribute(builtin.value());
if (name.empty()) {
- diagnostics_.AddError(diag::System::Writer, Source{}) << "unknown builtin";
+ diagnostics_.AddError(Source{}) << "unknown builtin";
return false;
}
out << " [[" << name << "]]";
@@ -2850,8 +2842,7 @@
if (auto interpolation = attributes.interpolation) {
auto name = InterpolationToAttribute(interpolation->type, interpolation->sampling);
if (name.empty()) {
- diagnostics_.AddError(diag::System::Writer, Source{})
- << "unknown interpolation attribute";
+ diagnostics_.AddError(Source{}) << "unknown interpolation attribute";
return false;
}
out << " [[" << name << "]]";
diff --git a/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc b/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc
index 5a1e8c0..4f60358 100644
--- a/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc
@@ -39,7 +39,7 @@
using MslASTPrinterTest = TestHelper;
TEST_F(MslASTPrinterTest, InvalidProgram) {
- Diagnostics().AddError(diag::System::Writer, Source{}) << "make the program invalid";
+ Diagnostics().AddError(Source{}) << "make the program invalid";
ASSERT_FALSE(IsValid());
auto program = resolver::Resolve(*this);
ASSERT_FALSE(program.IsValid());
diff --git a/src/tint/lang/msl/writer/ast_raise/module_scope_var_to_entry_point_param.cc b/src/tint/lang/msl/writer/ast_raise/module_scope_var_to_entry_point_param.cc
index 0084d30a..370164a 100644
--- a/src/tint/lang/msl/writer/ast_raise/module_scope_var_to_entry_point_param.cc
+++ b/src/tint/lang/msl/writer/ast_raise/module_scope_var_to_entry_point_param.cc
@@ -244,7 +244,7 @@
case core::AddressSpace::kWorkgroup:
break;
case core::AddressSpace::kPushConstant: {
- ctx.dst->Diagnostics().AddError(diag::System::Transform, Source{})
+ ctx.dst->Diagnostics().AddError(Source{})
<< "unhandled module-scope address space (" << sc << ")";
break;
}
diff --git a/src/tint/lang/msl/writer/ast_raise/pixel_local.cc b/src/tint/lang/msl/writer/ast_raise/pixel_local.cc
index c6cc55a..a9a79d8 100644
--- a/src/tint/lang/msl/writer/ast_raise/pixel_local.cc
+++ b/src/tint/lang/msl/writer/ast_raise/pixel_local.cc
@@ -257,7 +257,7 @@
uint32_t AttachmentIndex(uint32_t field_index) {
auto idx = cfg.attachments.Get(field_index);
if (TINT_UNLIKELY(!idx)) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
+ b.Diagnostics().AddError(Source{})
<< "PixelLocal::Config::attachments missing entry for field " << field_index;
return 0;
}
@@ -275,8 +275,7 @@
auto* cfg = inputs.Get<Config>();
if (!cfg) {
ProgramBuilder b;
- b.Diagnostics().AddError(diag::System::Transform, Source{})
- << "missing transform data for " << TypeInfo().name;
+ b.Diagnostics().AddError(Source{}) << "missing transform data for " << TypeInfo().name;
return resolver::Resolve(b);
}
diff --git a/src/tint/lang/msl/writer/common/option_helpers.cc b/src/tint/lang/msl/writer/common/option_helpers.cc
index ab4857b..ace6898 100644
--- a/src/tint/lang/msl/writer/common/option_helpers.cc
+++ b/src/tint/lang/msl/writer/common/option_helpers.cc
@@ -53,8 +53,7 @@
auto wgsl_seen = [&diagnostics, &seen_wgsl_bindings](const tint::BindingPoint& src,
const binding::BindingInfo& dst) -> bool {
if (auto binding = seen_wgsl_bindings.Add(src, dst); binding.value != dst) {
- diagnostics.AddError(diag::System::Writer, Source{})
- << "found duplicate WGSL binding point: " << src;
+ diagnostics.AddError(Source{}) << "found duplicate WGSL binding point: " << src;
return true;
}
return false;
@@ -63,7 +62,7 @@
auto msl_seen = [&diagnostics](InfoToPointMap& map, const binding::BindingInfo& src,
const tint::BindingPoint& dst) -> bool {
if (auto binding = map.Add(src, dst); binding.value != dst) {
- diagnostics.AddError(diag::System::Writer, Source{})
+ diagnostics.AddError(Source{})
<< "found duplicate MSL binding point: [binding: " << src.binding << "]";
return true;
}
@@ -88,27 +87,27 @@
// Storage and uniform are both [[buffer()]]
if (!valid(seen_msl_buffer_bindings, options.bindings.uniform)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing uniform";
+ diagnostics.AddNote(Source{}) << "when processing uniform";
return Failure{std::move(diagnostics)};
}
if (!valid(seen_msl_buffer_bindings, options.bindings.storage)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing storage";
+ diagnostics.AddNote(Source{}) << "when processing storage";
return Failure{std::move(diagnostics)};
}
// Sampler is [[sampler()]]
if (!valid(seen_msl_sampler_bindings, options.bindings.sampler)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing sampler";
+ diagnostics.AddNote(Source{}) << "when processing sampler";
return Failure{std::move(diagnostics)};
}
// Texture and storage texture are [[texture()]]
if (!valid(seen_msl_texture_bindings, options.bindings.texture)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing texture";
+ diagnostics.AddNote(Source{}) << "when processing texture";
return Failure{std::move(diagnostics)};
}
if (!valid(seen_msl_texture_bindings, options.bindings.storage_texture)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing storage_texture";
+ diagnostics.AddNote(Source{}) << "when processing storage_texture";
return Failure{std::move(diagnostics)};
}
@@ -120,26 +119,22 @@
// Validate with the actual source regardless of what the remapper will do
if (wgsl_seen(src_binding, plane0)) {
- diagnostics.AddNote(diag::System::Writer, Source{})
- << "when processing external_texture";
+ diagnostics.AddNote(Source{}) << "when processing external_texture";
return Failure{std::move(diagnostics)};
}
// Plane0 & Plane1 are [[texture()]]
if (msl_seen(seen_msl_texture_bindings, plane0, src_binding)) {
- diagnostics.AddNote(diag::System::Writer, Source{})
- << "when processing external_texture";
+ diagnostics.AddNote(Source{}) << "when processing external_texture";
return Failure{std::move(diagnostics)};
}
if (msl_seen(seen_msl_texture_bindings, plane1, src_binding)) {
- diagnostics.AddNote(diag::System::Writer, Source{})
- << "when processing external_texture";
+ diagnostics.AddNote(Source{}) << "when processing external_texture";
return Failure{std::move(diagnostics)};
}
// Metadata is [[buffer()]]
if (msl_seen(seen_msl_buffer_bindings, metadata, src_binding)) {
- diagnostics.AddNote(diag::System::Writer, Source{})
- << "when processing external_texture";
+ diagnostics.AddNote(Source{}) << "when processing external_texture";
return Failure{std::move(diagnostics)};
}
}
diff --git a/src/tint/lang/spirv/reader/ast_lower/atomics.cc b/src/tint/lang/spirv/reader/ast_lower/atomics.cc
index 181ab19..8b74df7 100644
--- a/src/tint/lang/spirv/reader/ast_lower/atomics.cc
+++ b/src/tint/lang/spirv/reader/ast_lower/atomics.cc
@@ -224,7 +224,7 @@
}
auto count = arr->ConstantCount();
if (!count) {
- ctx.dst->Diagnostics().AddError(diag::System::Transform, Source{})
+ ctx.dst->Diagnostics().AddError(Source{})
<< "the Atomics transform does not currently support array counts that use "
"override values";
count = 1;
diff --git a/src/tint/lang/spirv/reader/ast_parser/barrier_test.cc b/src/tint/lang/spirv/reader/ast_parser/barrier_test.cc
index 7fa6c89..aef7e09 100644
--- a/src/tint/lang/spirv/reader/ast_parser/barrier_test.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/barrier_test.cc
@@ -51,7 +51,7 @@
auto p = std::make_unique<ASTParser>(test::Assemble(preamble + spirv));
if (!p->BuildAndParseInternalModule()) {
ProgramBuilder builder;
- builder.Diagnostics().AddError(diag::System::Reader, Source{}) << p->error();
+ builder.Diagnostics().AddError(Source{}) << p->error();
return Program(std::move(builder));
}
return p->Program();
diff --git a/src/tint/lang/spirv/reader/ast_parser/parse.cc b/src/tint/lang/spirv/reader/ast_parser/parse.cc
index ac50d1e..48f9443 100644
--- a/src/tint/lang/spirv/reader/ast_parser/parse.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/parse.cc
@@ -82,7 +82,7 @@
ProgramBuilder& builder = parser.builder();
if (!parsed) {
- builder.Diagnostics().AddError(diag::System::Reader, Source{}) << parser.error();
+ builder.Diagnostics().AddError(Source{}) << parser.error();
return Program(std::move(builder));
}
diff --git a/src/tint/lang/spirv/writer/ast_printer/ast_printer_test.cc b/src/tint/lang/spirv/writer/ast_printer/ast_printer_test.cc
index e76c3c2..48c2a3d 100644
--- a/src/tint/lang/spirv/writer/ast_printer/ast_printer_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/ast_printer_test.cc
@@ -34,7 +34,7 @@
using SpirvASTPrinterTest = TestHelper;
TEST_F(SpirvASTPrinterTest, InvalidProgram) {
- Diagnostics().AddError(diag::System::Writer, Source{}) << "make the program invalid";
+ Diagnostics().AddError(Source{}) << "make the program invalid";
ASSERT_FALSE(IsValid());
auto program = resolver::Resolve(*this);
ASSERT_FALSE(program.IsValid());
diff --git a/src/tint/lang/spirv/writer/common/option_helper.cc b/src/tint/lang/spirv/writer/common/option_helper.cc
index 76a21ed..f209b63 100644
--- a/src/tint/lang/spirv/writer/common/option_helper.cc
+++ b/src/tint/lang/spirv/writer/common/option_helper.cc
@@ -48,8 +48,7 @@
const binding::BindingInfo& dst) -> bool {
if (auto binding = seen_wgsl_bindings.Get(src)) {
if (*binding != dst) {
- diagnostics.AddError(diag::System::Writer, Source{})
- << "found duplicate WGSL binding point: " << src;
+ diagnostics.AddError(Source{}) << "found duplicate WGSL binding point: " << src;
return true;
}
}
@@ -61,7 +60,7 @@
const tint::BindingPoint& dst) -> bool {
if (auto binding = seen_spirv_bindings.Get(src)) {
if (*binding != dst) {
- diagnostics.AddError(diag::System::Writer, Source{})
+ diagnostics.AddError(Source{})
<< "found duplicate SPIR-V binding point: [group: " << src.group
<< ", binding: " << src.binding << "]";
return true;
@@ -88,23 +87,23 @@
};
if (!valid(options.bindings.uniform)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing uniform";
+ diagnostics.AddNote(Source{}) << "when processing uniform";
return Failure{std::move(diagnostics)};
}
if (!valid(options.bindings.storage)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing storage";
+ diagnostics.AddNote(Source{}) << "when processing storage";
return Failure{std::move(diagnostics)};
}
if (!valid(options.bindings.texture)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing texture";
+ diagnostics.AddNote(Source{}) << "when processing texture";
return Failure{std::move(diagnostics)};
}
if (!valid(options.bindings.storage_texture)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing storage_texture";
+ diagnostics.AddNote(Source{}) << "when processing storage_texture";
return Failure{std::move(diagnostics)};
}
if (!valid(options.bindings.sampler)) {
- diagnostics.AddNote(diag::System::Writer, Source{}) << "when processing sampler";
+ diagnostics.AddNote(Source{}) << "when processing sampler";
return Failure{std::move(diagnostics)};
}
@@ -116,24 +115,20 @@
// Validate with the actual source regardless of what the remapper will do
if (wgsl_seen(src_binding, plane0)) {
- diagnostics.AddNote(diag::System::Writer, Source{})
- << "when processing external_texture";
+ diagnostics.AddNote(Source{}) << "when processing external_texture";
return Failure{std::move(diagnostics)};
}
if (spirv_seen(plane0, src_binding)) {
- diagnostics.AddNote(diag::System::Writer, Source{})
- << "when processing external_texture";
+ diagnostics.AddNote(Source{}) << "when processing external_texture";
return Failure{std::move(diagnostics)};
}
if (spirv_seen(plane1, src_binding)) {
- diagnostics.AddNote(diag::System::Writer, Source{})
- << "when processing external_texture";
+ diagnostics.AddNote(Source{}) << "when processing external_texture";
return Failure{std::move(diagnostics)};
}
if (spirv_seen(metadata, src_binding)) {
- diagnostics.AddNote(diag::System::Writer, Source{})
- << "when processing external_texture";
+ diagnostics.AddNote(Source{}) << "when processing external_texture";
return Failure{std::move(diagnostics)};
}
}
diff --git a/src/tint/lang/wgsl/ast/transform/array_length_from_uniform.cc b/src/tint/lang/wgsl/ast/transform/array_length_from_uniform.cc
index 636f8f3..40c7fc2 100644
--- a/src/tint/lang/wgsl/ast/transform/array_length_from_uniform.cc
+++ b/src/tint/lang/wgsl/ast/transform/array_length_from_uniform.cc
@@ -97,9 +97,8 @@
/// @returns the new program or SkipTransform if the transform is not required
ApplyResult Run() {
if (cfg == nullptr) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
- << "missing transform data for "
- << tint::TypeInfo::Of<ArrayLengthFromUniform>().name;
+ b.Diagnostics().AddError(Source{}) << "missing transform data for "
+ << tint::TypeInfo::Of<ArrayLengthFromUniform>().name;
return resolver::Resolve(b);
}
diff --git a/src/tint/lang/wgsl/ast/transform/binding_remapper.cc b/src/tint/lang/wgsl/ast/transform/binding_remapper.cc
index 5501dd5..d89d8d8 100644
--- a/src/tint/lang/wgsl/ast/transform/binding_remapper.cc
+++ b/src/tint/lang/wgsl/ast/transform/binding_remapper.cc
@@ -67,8 +67,7 @@
auto* remappings = inputs.Get<Remappings>();
if (!remappings) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
- << "missing transform data for " << TypeInfo().name;
+ b.Diagnostics().AddError(Source{}) << "missing transform data for " << TypeInfo().name;
return resolver::Resolve(b);
}
@@ -113,13 +112,13 @@
if (ac_it != remappings->access_controls.end()) {
core::Access access = ac_it->second;
if (access == core::Access::kUndefined) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
+ b.Diagnostics().AddError(Source{})
<< "invalid access mode (" << static_cast<uint32_t>(access) << ")";
return resolver::Resolve(b);
}
auto* sem = src.Sem().Get(var);
if (sem->AddressSpace() != core::AddressSpace::kStorage) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
+ b.Diagnostics().AddError(Source{})
<< "cannot apply access control to variable with address space "
<< sem->AddressSpace();
return resolver::Resolve(b);
diff --git a/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc b/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc
index e61f615..206a8d3 100644
--- a/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc
+++ b/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc
@@ -979,8 +979,7 @@
auto* cfg = inputs.Get<Config>();
if (cfg == nullptr) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
- << "missing transform data for " << TypeInfo().name;
+ b.Diagnostics().AddError(Source{}) << "missing transform data for " << TypeInfo().name;
return resolver::Resolve(b);
}
diff --git a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc
index 3d7450b..73cd5b8 100644
--- a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc
+++ b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc
@@ -135,7 +135,7 @@
BindingsMap::const_iterator it = new_binding_points->bindings_map.find(bp);
if (it == new_binding_points->bindings_map.end()) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
+ b.Diagnostics().AddError(Source{})
<< "missing new binding points for texture_external at binding {" << bp.group
<< "," << bp.binding << "}";
continue;
@@ -558,7 +558,7 @@
ProgramBuilder b;
program::CloneContext ctx{&b, &src, /* auto_clone_symbols */ true};
if (!new_binding_points) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
+ b.Diagnostics().AddError(Source{})
<< "missing new binding point data for " << TypeInfo().name;
return resolver::Resolve(b);
}
diff --git a/src/tint/lang/wgsl/ast/transform/push_constant_helper.cc b/src/tint/lang/wgsl/ast/transform/push_constant_helper.cc
index ba10cf4..6b72964 100644
--- a/src/tint/lang/wgsl/ast/transform/push_constant_helper.cc
+++ b/src/tint/lang/wgsl/ast/transform/push_constant_helper.cc
@@ -64,8 +64,7 @@
void PushConstantHelper::InsertMember(const char* name, ast::Type type, uint32_t offset) {
auto& member = member_map[offset];
if (TINT_UNLIKELY(member != nullptr)) {
- ctx.dst->Diagnostics().AddError(diag::System::Transform, Source{})
- << "struct member offset collision";
+ ctx.dst->Diagnostics().AddError(Source{}) << "struct member offset collision";
}
member = ctx.dst->Member(name, type, Vector{ctx.dst->MemberOffset(core::AInt(offset))});
}
diff --git a/src/tint/lang/wgsl/ast/transform/robustness.cc b/src/tint/lang/wgsl/ast/transform/robustness.cc
index 42273c5..fa00dc9 100644
--- a/src/tint/lang/wgsl/ast/transform/robustness.cc
+++ b/src/tint/lang/wgsl/ast/transform/robustness.cc
@@ -272,8 +272,7 @@
}
// Note: Don't be tempted to use the array override variable as an expression here,
// the name might be shadowed!
- b.Diagnostics().AddError(diag::System::Transform, Source{})
- << core::type::Array::kErrExpectedConstantCount;
+ b.Diagnostics().AddError(Source{}) << core::type::Array::kErrExpectedConstantCount;
return nullptr;
}, //
TINT_ICE_ON_NO_MATCH);
diff --git a/src/tint/lang/wgsl/ast/transform/single_entry_point.cc b/src/tint/lang/wgsl/ast/transform/single_entry_point.cc
index a0952eb..ed16c78 100644
--- a/src/tint/lang/wgsl/ast/transform/single_entry_point.cc
+++ b/src/tint/lang/wgsl/ast/transform/single_entry_point.cc
@@ -55,8 +55,7 @@
auto* cfg = inputs.Get<Config>();
if (cfg == nullptr) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
- << "missing transform data for " << TypeInfo().name;
+ b.Diagnostics().AddError(Source{}) << "missing transform data for " << TypeInfo().name;
return resolver::Resolve(b);
}
@@ -72,7 +71,7 @@
}
}
if (entry_point == nullptr) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
+ b.Diagnostics().AddError(Source{})
<< "entry point '" << cfg->entry_point_name << "' not found";
return resolver::Resolve(b);
}
diff --git a/src/tint/lang/wgsl/ast/transform/substitute_override.cc b/src/tint/lang/wgsl/ast/transform/substitute_override.cc
index 4711b36..2c5e06a 100644
--- a/src/tint/lang/wgsl/ast/transform/substitute_override.cc
+++ b/src/tint/lang/wgsl/ast/transform/substitute_override.cc
@@ -71,8 +71,7 @@
const auto* data = config.Get<Config>();
if (!data) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
- << "Missing override substitution data";
+ b.Diagnostics().AddError(Source{}) << "Missing override substitution data";
return resolver::Resolve(b);
}
@@ -91,7 +90,7 @@
auto iter = data->map.find(sem->Attributes().override_id.value());
if (iter == data->map.end()) {
if (!w->initializer) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
+ b.Diagnostics().AddError(Source{})
<< "Initializer not provided for override, and override not overridden.";
return nullptr;
}
@@ -108,8 +107,7 @@
[&](const core::type::F16*) { return b.Expr(f16(value)); });
if (!ctor) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
- << "Failed to create override-expression";
+ b.Diagnostics().AddError(Source{}) << "Failed to create override-expression";
return nullptr;
}
diff --git a/src/tint/lang/wgsl/ast/transform/vertex_pulling.cc b/src/tint/lang/wgsl/ast/transform/vertex_pulling.cc
index 8eae5a6..4c2145d 100644
--- a/src/tint/lang/wgsl/ast/transform/vertex_pulling.cc
+++ b/src/tint/lang/wgsl/ast/transform/vertex_pulling.cc
@@ -260,7 +260,7 @@
for (auto* fn : src.AST().Functions()) {
if (fn->PipelineStage() == PipelineStage::kVertex) {
if (func != nullptr) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
+ b.Diagnostics().AddError(Source{})
<< "VertexPulling found more than one vertex entry point";
return resolver::Resolve(b);
}
@@ -268,8 +268,7 @@
}
}
if (func == nullptr) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
- << "Vertex stage entry point not found";
+ b.Diagnostics().AddError(Source{}) << "Vertex stage entry point not found";
return resolver::Resolve(b);
}
@@ -357,7 +356,7 @@
const VertexBufferLayoutDescriptor& buffer_layout = cfg.vertex_state[buffer_idx];
if ((buffer_layout.array_stride & 3) != 0) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
+ b.Diagnostics().AddError(Source{})
<< "WebGPU requires that vertex stride must be a multiple of 4 bytes, "
"but VertexPulling array stride for buffer "
<< buffer_idx << " was " << buffer_layout.array_stride << " bytes";
@@ -395,7 +394,7 @@
// Base types must match between the vertex stream and the WGSL variable
if (!IsTypeCompatible(var_dt, fmt_dt)) {
- b.Diagnostics().AddError(diag::System::Transform, Source{})
+ b.Diagnostics().AddError(Source{})
<< "VertexAttributeDescriptor for location "
<< attribute_desc.shader_location << " has format " << attribute_desc.format
<< " but shader expects " << var.type->FriendlyName();
diff --git a/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.cc b/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.cc
index 7745eb3..8807cb4 100644
--- a/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.cc
+++ b/src/tint/lang/wgsl/ast/transform/zero_init_workgroup_memory.cc
@@ -385,7 +385,7 @@
// `(idx % modulo) / division`
auto count = arr->ConstantCount();
if (!count) {
- ctx.dst->Diagnostics().AddError(diag::System::Transform, Source{})
+ ctx.dst->Diagnostics().AddError(Source{})
<< core::type::Array::kErrExpectedConstantCount;
return Expression{}; // error
}
diff --git a/src/tint/lang/wgsl/helpers/check_supported_extensions.cc b/src/tint/lang/wgsl/helpers/check_supported_extensions.cc
index 5a4372c..647221e 100644
--- a/src/tint/lang/wgsl/helpers/check_supported_extensions.cc
+++ b/src/tint/lang/wgsl/helpers/check_supported_extensions.cc
@@ -48,9 +48,8 @@
for (auto* enable : module.Enables()) {
for (auto* ext : enable->extensions) {
if (!set.Contains(ext->name)) {
- diags.AddError(diag::System::Writer, ext->source)
- << writer_name << " backend does not support extension "
- << style::Code(ext->name);
+ diags.AddError(ext->source) << writer_name << " backend does not support extension "
+ << style::Code(ext->name);
return false;
}
}
diff --git a/src/tint/lang/wgsl/inspector/inspector.cc b/src/tint/lang/wgsl/inspector/inspector.cc
index 1cdbcac..dedcdc7 100644
--- a/src/tint/lang/wgsl/inspector/inspector.cc
+++ b/src/tint/lang/wgsl/inspector/inspector.cc
@@ -571,13 +571,12 @@
const ast::Function* Inspector::FindEntryPointByName(const std::string& name) {
auto* func = program_.AST().Functions().Find(program_.Symbols().Get(name));
if (!func) {
- diagnostics_.AddError(diag::System::Inspector, Source{}) << name << " was not found!";
+ diagnostics_.AddError(Source{}) << name << " was not found!";
return nullptr;
}
if (!func->IsEntryPoint()) {
- diagnostics_.AddError(diag::System::Inspector, Source{})
- << name << " is not an entry point!";
+ diagnostics_.AddError(Source{}) << name << " is not an entry point!";
return nullptr;
}
diff --git a/src/tint/lang/wgsl/program/program.cc b/src/tint/lang/wgsl/program/program.cc
index c649781..c1dfffb 100644
--- a/src/tint/lang/wgsl/program/program.cc
+++ b/src/tint/lang/wgsl/program/program.cc
@@ -81,7 +81,7 @@
// If the builder claims to be invalid, then we really should have an error
// message generated. If we find a situation where the program is not valid
// and there are no errors reported, add one here.
- diagnostics_.AddError(diag::System::Program, Source{}) << "invalid program generated";
+ diagnostics_.AddError(Source{}) << "invalid program generated";
}
}
diff --git a/src/tint/lang/wgsl/program/program_test.cc b/src/tint/lang/wgsl/program/program_test.cc
index 2572ca5..d5f2bb3 100644
--- a/src/tint/lang/wgsl/program/program_test.cc
+++ b/src/tint/lang/wgsl/program/program_test.cc
@@ -93,7 +93,7 @@
}
TEST_F(ProgramTest, DiagnosticsMove) {
- Diagnostics().AddError(diag::System::Program, Source{}) << "an error message";
+ Diagnostics().AddError(Source{}) << "an error message";
Program program_a(std::move(*this));
EXPECT_FALSE(program_a.IsValid());
diff --git a/src/tint/lang/wgsl/reader/parser/parser.cc b/src/tint/lang/wgsl/reader/parser/parser.cc
index e9eee00..3eddee4 100644
--- a/src/tint/lang/wgsl/reader/parser/parser.cc
+++ b/src/tint/lang/wgsl/reader/parser/parser.cc
@@ -244,28 +244,27 @@
Parser::Failure::Errored Parser::AddError(const Source& source, std::string_view err) {
if (silence_diags_ == 0) {
- builder_.Diagnostics().AddError(diag::System::Reader, source) << err;
+ builder_.Diagnostics().AddError(source) << err;
}
return Failure::kErrored;
}
Parser::Failure::Errored Parser::AddError(const Source& source, StyledText&& err) {
if (silence_diags_ == 0) {
- builder_.Diagnostics().AddError(diag::System::Reader, source) << std::move(err);
+ builder_.Diagnostics().AddError(source) << std::move(err);
}
return Failure::kErrored;
}
void Parser::AddNote(const Source& source, std::string_view err) {
if (silence_diags_ == 0) {
- builder_.Diagnostics().AddNote(diag::System::Reader, source) << err;
+ builder_.Diagnostics().AddNote(source) << err;
}
}
void Parser::deprecated(const Source& source, std::string_view msg) {
if (silence_diags_ == 0) {
- builder_.Diagnostics().AddWarning(diag::System::Reader, source)
- << "use of deprecated language feature: " << msg;
+ builder_.Diagnostics().AddWarning(source) << "use of deprecated language feature: " << msg;
}
}
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.cc b/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.cc
index 4feffb8..9933ed1 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.cc
+++ b/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir.cc
@@ -200,9 +200,7 @@
~ControlStackScope() { impl_->control_stack_.Pop(); }
};
- diag::Diagnostic& AddError(const Source& source) {
- return diagnostics_.AddError(tint::diag::System::IR, source);
- }
+ diag::Diagnostic& AddError(const Source& source) { return diagnostics_.AddError(source); }
bool NeedTerminator() { return current_block_ && !current_block_->Terminator(); }
@@ -1353,7 +1351,7 @@
auto r = b.Build();
if (r != Success) {
diag::List err = std::move(r.Failure().reason);
- err.AddNote(diag::System::IR, Source{}) << "AST:\n" + Program::printer(program);
+ err.AddNote(Source{}) << "AST:\n" + Program::printer(program);
return Failure{err};
}
diff --git a/src/tint/lang/wgsl/reader/reader.cc b/src/tint/lang/wgsl/reader/reader.cc
index f2e20be..ed8009a 100644
--- a/src/tint/lang/wgsl/reader/reader.cc
+++ b/src/tint/lang/wgsl/reader/reader.cc
@@ -41,8 +41,7 @@
if (TINT_UNLIKELY(file->content.data.size() >
static_cast<size_t>(std::numeric_limits<uint32_t>::max()))) {
ProgramBuilder b;
- b.Diagnostics().AddError(tint::diag::System::Reader, Source{})
- << "WGSL source must be 0xffffffff bytes or fewer";
+ b.Diagnostics().AddError(tint::Source{}) << "WGSL source must be 0xffffffff bytes or fewer";
return Program(std::move(b));
}
Parser parser(file);
diff --git a/src/tint/lang/wgsl/resolver/dependency_graph.cc b/src/tint/lang/wgsl/resolver/dependency_graph.cc
index 7e2db61..36f97ba 100644
--- a/src/tint/lang/wgsl/resolver/dependency_graph.cc
+++ b/src/tint/lang/wgsl/resolver/dependency_graph.cc
@@ -133,12 +133,12 @@
/// @returns a new error diagnostic with the given source.
diag::Diagnostic& AddError(diag::List& diagnostics, const Source& source) {
- return diagnostics.AddError(diag::System::Resolver, source);
+ return diagnostics.AddError(source);
}
/// @returns a new note diagnostic with the given source.
diag::Diagnostic& AddNote(diag::List& diagnostics, const Source& source) {
- return diagnostics.AddNote(diag::System::Resolver, source);
+ return diagnostics.AddNote(source);
}
/// DependencyScanner is used to traverse a module to build the list of
diff --git a/src/tint/lang/wgsl/resolver/resolver.cc b/src/tint/lang/wgsl/resolver/resolver.cc
index ba65744..daf8c12 100644
--- a/src/tint/lang/wgsl/resolver/resolver.cc
+++ b/src/tint/lang/wgsl/resolver/resolver.cc
@@ -5049,21 +5049,20 @@
}
diag::Diagnostic err{};
err.severity = diag::Severity::Error;
- err.system = diag::System::Resolver;
err.source = source;
diagnostics_.Add(std::move(err)) << msg;
}
diag::Diagnostic& Resolver::AddError(const Source& source) const {
- return diagnostics_.AddError(diag::System::Resolver, source);
+ return diagnostics_.AddError(source);
}
diag::Diagnostic& Resolver::AddWarning(const Source& source) const {
- return diagnostics_.AddWarning(diag::System::Resolver, source);
+ return diagnostics_.AddWarning(source);
}
diag::Diagnostic& Resolver::AddNote(const Source& source) const {
- return diagnostics_.AddNote(diag::System::Resolver, source);
+ return diagnostics_.AddNote(source);
}
} // namespace tint::resolver
diff --git a/src/tint/lang/wgsl/resolver/sem_helper.cc b/src/tint/lang/wgsl/resolver/sem_helper.cc
index fbd74a9..1fe3934 100644
--- a/src/tint/lang/wgsl/resolver/sem_helper.cc
+++ b/src/tint/lang/wgsl/resolver/sem_helper.cc
@@ -228,14 +228,14 @@
}
diag::Diagnostic& SemHelper::AddError(const Source& source) const {
- return builder_->Diagnostics().AddError(diag::System::Resolver, source);
+ return builder_->Diagnostics().AddError(source);
}
diag::Diagnostic& SemHelper::AddWarning(const Source& source) const {
- return builder_->Diagnostics().AddWarning(diag::System::Resolver, source);
+ return builder_->Diagnostics().AddWarning(source);
}
diag::Diagnostic& SemHelper::AddNote(const Source& source) const {
- return builder_->Diagnostics().AddNote(diag::System::Resolver, source);
+ return builder_->Diagnostics().AddNote(source);
}
} // namespace tint::resolver
diff --git a/src/tint/lang/wgsl/resolver/uniformity.cc b/src/tint/lang/wgsl/resolver/uniformity.cc
index 818e5e1..eb3c810 100644
--- a/src/tint/lang/wgsl/resolver/uniformity.cc
+++ b/src/tint/lang/wgsl/resolver/uniformity.cc
@@ -1829,7 +1829,7 @@
auto* control_flow = TraceBackAlongPathUntil(
non_uniform_source, [](Node* node) { return node->affects_control_flow; });
if (control_flow) {
- diagnostics_.AddNote(diag::System::Resolver, control_flow->ast->source)
+ diagnostics_.AddNote(control_flow->ast->source)
<< "control flow depends on possibly non-uniform value";
// TODO(jrprice): There are cases where the function with uniformity requirements is not
// actually inside this control flow construct, for example:
@@ -1877,18 +1877,18 @@
auto* var = sem_.GetVal(ident)->UnwrapLoad()->As<sem::VariableUser>()->Variable();
if (auto* param = var->As<sem::Parameter>()) {
auto* func = param->Owner()->As<sem::Function>();
- diagnostics_.AddNote(diag::System::Resolver, ident->source)
+ diagnostics_.AddNote(ident->source)
<< param_type(param) << "'" << NameFor(ident) << "' of '" << NameFor(func)
<< "' may be non-uniform";
} else {
- diagnostics_.AddNote(diag::System::Resolver, ident->source)
+ diagnostics_.AddNote(ident->source)
<< "reading from " << var_type(var) << "'" << NameFor(ident)
<< "' may result in a non-uniform value";
}
},
[&](const ast::Variable* v) {
auto* var = sem_.Get(v);
- diagnostics_.AddNote(diag::System::Resolver, v->source)
+ diagnostics_.AddNote(v->source)
<< "reading from " << var_type(var) << "'" << NameFor(v)
<< "' may result in a non-uniform value";
},
@@ -1896,14 +1896,14 @@
auto target_name = NameFor(c->target);
switch (non_uniform_source->type) {
case Node::kFunctionCallReturnValue: {
- diagnostics_.AddNote(diag::System::Resolver, c->source)
+ diagnostics_.AddNote(c->source)
<< "return value of '" + target_name + "' may be non-uniform";
break;
}
case Node::kFunctionCallArgumentContents: {
auto* arg = c->args[non_uniform_source->arg_index];
auto* var = sem_.GetVal(arg)->RootIdentifier();
- diagnostics_.AddNote(diag::System::Resolver, var->Declaration()->source)
+ diagnostics_.AddNote(var->Declaration()->source)
<< "reading from " << var_type(var) << "'" << NameFor(var)
<< "' may result in a non-uniform value";
break;
@@ -1911,14 +1911,13 @@
case Node::kFunctionCallArgumentValue: {
auto* arg = c->args[non_uniform_source->arg_index];
// TODO(jrprice): Which output? (return value vs another pointer argument).
- diagnostics_.AddNote(diag::System::Resolver, arg->source)
+ diagnostics_.AddNote(arg->source)
<< "passing non-uniform pointer to '" << target_name
<< "' may produce a non-uniform output";
break;
}
case Node::kFunctionCallPointerArgumentResult: {
- diagnostics_.AddNote(diag::System::Resolver,
- c->args[non_uniform_source->arg_index]->source)
+ diagnostics_.AddNote(c->args[non_uniform_source->arg_index]->source)
<< "contents of pointer may become non-uniform after calling '"
<< target_name << "'";
break;
@@ -1930,8 +1929,7 @@
}
},
[&](const ast::Expression* e) {
- diagnostics_.AddNote(diag::System::Resolver, e->source)
- << "result of expression may be non-uniform";
+ diagnostics_.AddNote(e->source) << "result of expression may be non-uniform";
}, //
TINT_ICE_ON_NO_MATCH);
}
@@ -1945,7 +1943,6 @@
auto report = [&](Source source, std::string msg, bool note) {
diag::Diagnostic error{};
error.severity = note ? diag::Severity::Note : wgsl::ToSeverity(severity);
- error.system = diag::System::Resolver;
error.source = source;
error.message = msg;
diagnostics_.Add(std::move(error));
diff --git a/src/tint/lang/wgsl/resolver/validator.cc b/src/tint/lang/wgsl/resolver/validator.cc
index 1c110f8..7695424 100644
--- a/src/tint/lang/wgsl/resolver/validator.cc
+++ b/src/tint/lang/wgsl/resolver/validator.cc
@@ -180,15 +180,15 @@
Validator::~Validator() = default;
diag::Diagnostic& Validator::AddError(const Source& source) const {
- return diagnostics_.AddError(diag::System::Resolver, source);
+ return diagnostics_.AddError(source);
}
diag::Diagnostic& Validator::AddWarning(const Source& source) const {
- return diagnostics_.AddWarning(diag::System::Resolver, source);
+ return diagnostics_.AddWarning(source);
}
diag::Diagnostic& Validator::AddNote(const Source& source) const {
- return diagnostics_.AddNote(diag::System::Resolver, source);
+ return diagnostics_.AddNote(source);
}
diag::Diagnostic* Validator::MaybeAddDiagnostic(wgsl::DiagnosticRule rule,
@@ -197,7 +197,6 @@
if (severity != wgsl::DiagnosticSeverity::kOff) {
diag::Diagnostic d{};
d.severity = ToSeverity(severity);
- d.system = diag::System::Resolver;
d.source = source;
return &diagnostics_.Add(std::move(d));
}
diff --git a/src/tint/lang/wgsl/writer/ast_printer/ast_printer.cc b/src/tint/lang/wgsl/writer/ast_printer/ast_printer.cc
index 8ad212a..710c70a 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/wgsl/writer/ast_printer/ast_printer.cc
@@ -338,7 +338,7 @@
void ASTPrinter::EmitImageFormat(StringStream& out, const core::TexelFormat fmt) {
switch (fmt) {
case core::TexelFormat::kUndefined:
- diagnostics_.AddError(diag::System::Writer, Source{}) << "unknown image format";
+ diagnostics_.AddError(Source{}) << "unknown image format";
break;
default:
out << fmt;
diff --git a/src/tint/utils/diagnostic/diagnostic.h b/src/tint/utils/diagnostic/diagnostic.h
index 5c71762..6471b5a 100644
--- a/src/tint/utils/diagnostic/diagnostic.h
+++ b/src/tint/utils/diagnostic/diagnostic.h
@@ -48,29 +48,6 @@
return static_cast<int>(a) >= static_cast<int>(b);
}
-/// System is an enumerator of Tint systems that can be the originator of a diagnostic message.
-enum class System {
- AST,
- Builtin,
- Clone,
- Constant,
- Inspector,
- Intrinsics,
- IR,
- Program,
- ProgramBuilder,
- Reader,
- Resolver,
- Semantic,
- Symbol,
- Test,
- Transform,
- Type,
- Utils,
- Writer,
- Unknown,
-};
-
/// Diagnostic holds all the information for a single compiler diagnostic
/// message.
class Diagnostic {
@@ -99,8 +76,6 @@
Source source;
/// message is the text associated with the diagnostic.
StyledText message;
- /// system is the Tint system that raised the diagnostic.
- System system;
/// A shared pointer to a Source::File. Only used if the diagnostic Source
/// points to a file that was created specifically for this diagnostic
/// (usually an ICE).
@@ -178,40 +153,34 @@
}
/// Adds the note message with the given Source to the end of this list.
- /// @param system the system raising the note message
/// @param source the source of the note diagnostic
/// @returns a reference to the new diagnostic.
/// @note The returned reference must not be used after the list is mutated again.
- diag::Diagnostic& AddNote(System system, const Source& source) {
+ diag::Diagnostic& AddNote(const Source& source) {
diag::Diagnostic note{};
note.severity = diag::Severity::Note;
- note.system = system;
note.source = source;
return Add(std::move(note));
}
/// Adds the warning message with the given Source to the end of this list.
- /// @param system the system raising the warning message
/// @param source the source of the warning diagnostic
/// @returns a reference to the new diagnostic.
/// @note The returned reference must not be used after the list is mutated again.
- diag::Diagnostic& AddWarning(System system, const Source& source) {
+ diag::Diagnostic& AddWarning(const Source& source) {
diag::Diagnostic warning{};
warning.severity = diag::Severity::Warning;
- warning.system = system;
warning.source = source;
return Add(std::move(warning));
}
/// Adds the error message with the given Source to the end of this list.
- /// @param system the system raising the error message
/// @param source the source of the error diagnostic
/// @returns a reference to the new diagnostic.
/// @note The returned reference must not be used after the list is mutated again.
- diag::Diagnostic& AddError(System system, const Source& source) {
+ diag::Diagnostic& AddError(const Source& source) {
diag::Diagnostic error{};
error.severity = diag::Severity::Error;
- error.system = system;
error.source = source;
return Add(std::move(error));
}
diff --git a/src/tint/utils/diagnostic/formatter_test.cc b/src/tint/utils/diagnostic/formatter_test.cc
index 320b6b4..9fee7c9 100644
--- a/src/tint/utils/diagnostic/formatter_test.cc
+++ b/src/tint/utils/diagnostic/formatter_test.cc
@@ -36,12 +36,11 @@
namespace tint::diag {
namespace {
-Diagnostic Diag(Severity severity, Source source, std::string message, System system) {
+Diagnostic Diag(Severity severity, Source source, std::string message) {
Diagnostic d;
d.severity = severity;
d.source = source;
d.message = std::move(message);
- d.system = system;
return d;
}
@@ -62,31 +61,19 @@
public:
Source::File ascii_file{"file.name", ascii_content};
Source::File utf8_file{"file.name", utf8_content};
- Diagnostic ascii_diag_note = Diag(Severity::Note,
- Source{Source::Range{Source::Location{1, 14}}, &ascii_file},
- "purr",
- System::Test);
- Diagnostic ascii_diag_warn = Diag(Severity::Warning,
- Source{Source::Range{{2, 14}, {2, 18}}, &ascii_file},
- "grrr",
- System::Test);
- Diagnostic ascii_diag_err = Diag(Severity::Error,
- Source{Source::Range{{3, 16}, {3, 21}}, &ascii_file},
- "hiss",
- System::Test);
+ Diagnostic ascii_diag_note =
+ Diag(Severity::Note, Source{Source::Range{Source::Location{1, 14}}, &ascii_file}, "purr");
+ Diagnostic ascii_diag_warn =
+ Diag(Severity::Warning, Source{Source::Range{{2, 14}, {2, 18}}, &ascii_file}, "grrr");
+ Diagnostic ascii_diag_err =
+ Diag(Severity::Error, Source{Source::Range{{3, 16}, {3, 21}}, &ascii_file}, "hiss");
- Diagnostic utf8_diag_note = Diag(Severity::Note,
- Source{Source::Range{Source::Location{1, 15}}, &utf8_file},
- "purr",
- System::Test);
- Diagnostic utf8_diag_warn = Diag(Severity::Warning,
- Source{Source::Range{{2, 15}, {2, 19}}, &utf8_file},
- "grrr",
- System::Test);
- Diagnostic utf8_diag_err = Diag(Severity::Error,
- Source{Source::Range{{3, 15}, {3, 20}}, &utf8_file},
- "hiss",
- System::Test);
+ Diagnostic utf8_diag_note =
+ Diag(Severity::Note, Source{Source::Range{Source::Location{1, 15}}, &utf8_file}, "purr");
+ Diagnostic utf8_diag_warn =
+ Diag(Severity::Warning, Source{Source::Range{{2, 15}, {2, 19}}, &utf8_file}, "grrr");
+ Diagnostic utf8_diag_err =
+ Diag(Severity::Error, Source{Source::Range{{3, 15}, {3, 20}}, &utf8_file}, "hiss");
};
TEST_F(DiagFormatterTest, Simple) {
@@ -110,7 +97,7 @@
TEST_F(DiagFormatterTest, SimpleNoSource) {
Formatter fmt{{false, false, false, false}};
- auto diag = Diag(Severity::Note, Source{}, "no source!", System::Test);
+ auto diag = Diag(Severity::Note, Source{}, "no source!");
auto got = fmt.Format(List{diag}).Plain();
auto* expect = "no source!";
ASSERT_EQ(expect, got);
@@ -186,8 +173,8 @@
}
TEST_F(DiagFormatterTest, BasicWithMultiLine) {
- auto multiline = Diag(Severity::Warning, Source{Source::Range{{2, 9}, {4, 15}}, &ascii_file},
- "multiline", System::Test);
+ auto multiline =
+ Diag(Severity::Warning, Source{Source::Range{{2, 9}, {4, 15}}, &ascii_file}, "multiline");
Formatter fmt{{false, false, true, false}};
auto got = fmt.Format(List{multiline}).Plain();
auto* expect = R"(2:9: multiline
@@ -202,8 +189,8 @@
}
TEST_F(DiagFormatterTest, UnicodeWithMultiLine) {
- auto multiline = Diag(Severity::Warning, Source{Source::Range{{2, 9}, {4, 15}}, &utf8_file},
- "multiline", System::Test);
+ auto multiline =
+ Diag(Severity::Warning, Source{Source::Range{{2, 9}, {4, 15}}, &utf8_file}, "multiline");
Formatter fmt{{false, false, true, false}};
auto got = fmt.Format(List{multiline}).Plain();
auto* expect =
@@ -233,8 +220,8 @@
}
TEST_F(DiagFormatterTest, BasicWithMultiLineTab4) {
- auto multiline = Diag(Severity::Warning, Source{Source::Range{{2, 9}, {4, 15}}, &ascii_file},
- "multiline", System::Test);
+ auto multiline =
+ Diag(Severity::Warning, Source{Source::Range{{2, 9}, {4, 15}}, &ascii_file}, "multiline");
Formatter fmt{{false, false, true, false, 4u}};
auto got = fmt.Format(List{multiline}).Plain();
auto* expect = R"(2:9: multiline
@@ -251,7 +238,7 @@
TEST_F(DiagFormatterTest, RangeOOB) {
Formatter fmt{{true, true, true, true}};
diag::List list;
- list.AddError(System::Test, Source{{{10, 20}, {30, 20}}, &ascii_file}) << "oob";
+ list.AddError(Source{{{10, 20}, {30, 20}}, &ascii_file}) << "oob";
auto got = fmt.Format(list).Plain();
auto* expect = R"(file.name:10:20 error: oob
diff --git a/src/tint/utils/result/result.cc b/src/tint/utils/result/result.cc
index a3ecfc3..0a8c6c8 100644
--- a/src/tint/utils/result/result.cc
+++ b/src/tint/utils/result/result.cc
@@ -32,7 +32,7 @@
Failure::Failure() = default;
Failure::Failure(std::string_view err) {
- reason.AddError(diag::System::Unknown, Source{}) << err;
+ reason.AddError(Source{}) << err;
}
Failure::Failure(diag::Diagnostic diagnostic) : reason(diag::List{std::move(diagnostic)}) {}