Implement a correct copy constructor for Record. Now that we're using the ID number...
authorOwen Anderson <resistor@mac.com>
Wed, 19 Sep 2012 21:34:18 +0000 (21:34 +0000)
committerOwen Anderson <resistor@mac.com>
Wed, 19 Sep 2012 21:34:18 +0000 (21:34 +0000)
This fixes some obscure failure cases involving registers defined inside multiclasses or foreach constructs that would not receive a unique ID, and would end up being omitted from the AsmMatcher tables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164251 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/TableGen/Record.h

index 032f15368d9ddd9f994f19ca84c015a4cc8f5912..8c4893dd04385fd31d0a7a2b016348f537ad9058 100644 (file)
@@ -1328,6 +1328,14 @@ public:
     TrackedRecords(records), TheInit(0) {
     init();
   }
+
+  // When copy-constructing a Record, we must still guarantee a globally unique
+  // ID number.  All other fields can be copied normally.
+  Record(const Record &O) :
+    ID(LastID++), Name(O.Name), Locs(O.Locs), TemplateArgs(O.TemplateArgs),
+    Values(O.Values), SuperClasses(O.SuperClasses),
+    TrackedRecords(O.TrackedRecords), TheInit(O.TheInit) { }
+
   ~Record() {}