[llvm-commits] [llvm] r142510 - /llvm/trunk/lib/TableGen/Record.cpp

David Greene greened at obbligato.org
Wed Oct 19 06:03:25 PDT 2011


Author: greened
Date: Wed Oct 19 08:03:25 2011
New Revision: 142510

URL: http://llvm.org/viewvc/llvm-project?rev=142510&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/TableGen/Record.cpp

Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=142510&r1=142509&r2=142510&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Wed Oct 19 08:03:25 2011
@@ -1714,13 +1714,12 @@
 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.





More information about the llvm-commits mailing list