CloneContext: Remove remnants of clone pointer de-duping
It appears that I didn't do a great job cleaning up the removal of ShareableCloneable in https://dawn-review.googlesource.com/c/tint/+/51484.
Cloning nodes shouldn't return the same pointer. Remove bad comments.
Clean up leftover logic from CloneWithoutTransform().
Change-Id: Ibbc5f625c5978e9c11da59e7aa6197f39b6f0363
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58220
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
diff --git a/src/clone_context.h b/src/clone_context.h
index ff34dd1..6c89ef7 100644
--- a/src/clone_context.h
+++ b/src/clone_context.h
@@ -85,9 +85,7 @@
~CloneContext();
/// Clones the Node or sem::Type `a` into the ProgramBuilder #dst if `a` is
- /// not null. If `a` is null, then Clone() returns null. If `a` has been
- /// cloned already by this CloneContext then the same cloned pointer is
- /// returned.
+ /// not null. If `a` is null, then Clone() returns null.
///
/// Clone() may use a function registered with ReplaceAll() to create a
/// transformed version of the object. See ReplaceAll() for more information.
@@ -140,9 +138,7 @@
}
/// Clones the Node or sem::Type `a` into the ProgramBuilder #dst if `a` is
- /// not null. If `a` is null, then Clone() returns null. If `a` has been
- /// cloned already by this CloneContext then the same cloned pointer is
- /// returned.
+ /// not null. If `a` is null, then Clone() returns null.
///
/// Unlike Clone(), this method does not invoke or use any transformations
/// registered by ReplaceAll().
@@ -158,22 +154,10 @@
if (a == nullptr) {
return nullptr;
}
-
if (src) {
TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(Clone, src, a);
}
-
- // Have we seen this object before? If so, return the previously cloned
- // version instead of making yet another copy.
- auto it = replacements_.find(a);
- if (it != replacements_.end()) {
- return CheckedCast<T>(it->second);
- }
-
- // First time clone and no replacer transforms matched.
- // Clone with T::Clone().
auto* c = a->Clone(this);
- replacements_.emplace(a, c);
return CheckedCast<T>(c);
}