aboutsummaryrefslogtreecommitdiff
path: root/lib/TableGen/Record.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/TableGen/Record.cpp')
-rw-r--r--lib/TableGen/Record.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/TableGen/Record.cpp b/lib/TableGen/Record.cpp
index c92f1b2f61..69d31fe3b4 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.