CloneContext: Don't create named symbols from unnamed

Registering a new Symbol with the NameFor() of the source symbol creates
a new *named* symbol. When mixing these with unnamed symbols we can have
collisions.

Update CloneContext::Clone(Symbol) to properly clone unnamed symbols.

Update (most) the transforms to ctx.Clone() the symbols instead of
registering the names directly.

Fix up the tests where the symbol IDs have changed.

Note: We can still have symbol collisions if a program is authored with
identifiers like 'tint_symbol_3'. This will be fixed up in a later
change.

Change-Id: I0ce559644da3d60e1060f2eef185fa55ae284521
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/46866
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton
2021-04-07 11:16:01 +00:00
committed by Commit Bot service account
parent 3bfb6817df
commit 1b8d9f227b
16 changed files with 295 additions and 193 deletions

View File

@@ -220,6 +220,7 @@ source_set("tint_unittests_core_src") {
"../src/type/vector_type_test.cc",
"../src/utils/command.h",
"../src/utils/command_test.cc",
"../src/utils/get_or_create_test.cc",
"../src/utils/hash_test.cc",
"../src/utils/math_test.cc",
"../src/utils/tmpfile.h",