Fix symbol collision in RenameReservedKeywords()

Fixed: tint:711
Bug: tint:712
Change-Id: I8d0b5c926772c4265d273f6420f101f48ac29b9c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47628
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton
2021-04-13 17:53:09 +00:00
committed by Commit Bot service account
parent ebc5bd4e28
commit 095cd1c255
4 changed files with 37 additions and 34 deletions

View File

@@ -67,6 +67,9 @@ void Transform::RenameReservedKeywords(CloneContext* ctx,
const char* names[],
size_t count) {
ctx->ReplaceAll([=](Symbol in) {
if (!ctx->src->Symbols().HasName(in)) {
return ctx->dst->Symbols().New();
}
auto name_in = ctx->src->Symbols().NameFor(in);
if (!std::binary_search(names, names + count, name_in)) {
return ctx->dst->Symbols().Register(name_in);