Resolve Record Names

When resolving Record values, be sure to update the Record name as it
may contain references to the value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142511 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/TableGen/Record.cpp b/lib/TableGen/Record.cpp
index 69d31fe..a22c80c 100644
--- a/lib/TableGen/Record.cpp
+++ b/lib/TableGen/Record.cpp
@@ -1764,6 +1764,12 @@
     if (Init *V = Values[i].getValue())
       Values[i].setValue(V->resolveReferences(*this, RV));
   }
+  Init *OldName = getNameInit();
+  Init *NewName = Name->resolveReferences(*this, RV);
+  if (NewName != OldName) {
+    // Re-register with RecordKeeper.
+    setName(NewName);
+  }
 }
 
 void Record::dump() const { errs() << *this; }