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.

llvm-svn: 142510
This commit is contained in:
David Greene 2011-10-19 13:03:25 +00:00
parent 212f6a9e9a
commit f651a2a5c0
1 changed files with 3 additions and 4 deletions

View File

@ -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.