From f628204262fb91bc095e198b5d9777bd015637e2 Mon Sep 17 00:00:00 2001 From: David Greene Date: Wed, 19 Oct 2011 13:03:25 +0000 Subject: [PATCH] Allow Names Changes on Unregistered Records Add Record names to be changed even on Records that aren't yet registered. We need to be able to do this for paste functionality because we do not want to register def names before they are unique and that can only happen once all paste operations are done. This change lets us update Record names formed by paste operations and register the result later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142510 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/TableGen/Record.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/TableGen/Record.cpp b/lib/TableGen/Record.cpp index c92f1b2f614..69d31fe3b43 100644 --- a/lib/TableGen/Record.cpp +++ b/lib/TableGen/Record.cpp @@ -1714,13 +1714,12 @@ const std::string &Record::getName() const { void Record::setName(Init *NewName) { if (TrackedRecords.getDef(Name->getAsUnquotedString()) == this) { TrackedRecords.removeDef(Name->getAsUnquotedString()); - Name = NewName; TrackedRecords.addDef(this); - } else { + } else if (TrackedRecords.getClass(Name->getAsUnquotedString()) == this) { TrackedRecords.removeClass(Name->getAsUnquotedString()); - Name = NewName; TrackedRecords.addClass(this); - } + } // Otherwise this isn't yet registered. + Name = NewName; checkName(); // Since the Init for the name was changed, see if we can resolve // any of it using members of the Record.