From 487a913e3134823703cd81db306b747dfebbd846 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Thu, 15 Jul 2021 16:37:24 +0000 Subject: [PATCH] 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 Reviewed-by: James Price Commit-Queue: James Price Auto-Submit: Ben Clayton --- src/clone_context.h | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/clone_context.h b/src/clone_context.h index ff34dd1101..6c89ef7fe3 100644 --- a/src/clone_context.h +++ b/src/clone_context.h @@ -85,9 +85,7 @@ class CloneContext { ~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 @@ class 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. /// /// Unlike Clone(), this method does not invoke or use any transformations /// registered by ReplaceAll(). @@ -158,22 +154,10 @@ class CloneContext { 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(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(c); }