tint/ast: Make DiagnosticControl a plain struct

Introduce DiagnosticDirective, which contains a DiagnosticControl
struct (as does DiagnosticAttribute).

Bug: tint:1809
Change-Id: I204001266ee472d2ee2827614a306acad53f12ba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118060
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
James Price
2023-02-04 12:20:55 +00:00
committed by Dawn LUCI CQ
parent ededebbcf3
commit 98dc5a86cc
36 changed files with 297 additions and 253 deletions

View File

@@ -1311,8 +1311,11 @@ Transform::ApplyResult Renamer::Apply(const Program* src,
});
}
},
[&](const ast::DiagnosticControl* diagnostic) {
preserved_identifiers.Add(diagnostic->rule_name);
[&](const ast::DiagnosticAttribute* diagnostic) {
preserved_identifiers.Add(diagnostic->control.rule_name);
},
[&](const ast::DiagnosticDirective* diagnostic) {
preserved_identifiers.Add(diagnostic->control.rule_name);
},
[&](const ast::TypeName* type_name) {
if (is_type_short_name(type_name->name->symbol)) {

View File

@@ -114,7 +114,9 @@ Transform::ApplyResult SingleEntryPoint::Apply(const Program* src,
}
},
[&](const ast::Enable* ext) { b.AST().AddEnable(ctx.Clone(ext)); },
[&](const ast::DiagnosticControl* dc) { b.AST().AddDiagnosticControl(ctx.Clone(dc)); },
[&](const ast::DiagnosticDirective* d) {
b.AST().AddDiagnosticDirective(ctx.Clone(d));
},
[&](Default) {
TINT_UNREACHABLE(Transform, b.Diagnostics())
<< "unhandled global declaration: " << decl->TypeInfo().name;