[llvm-commits] [llvm] r164251 - /llvm/trunk/include/llvm/TableGen/Record.h
Owen Anderson
resistor at mac.com
Wed Sep 19 14:34:18 PDT 2012
Author: resistor
Date: Wed Sep 19 16:34:18 2012
New Revision: 164251
URL: http://llvm.org/viewvc/llvm-project?rev=164251&view=rev
Log:
Implement a correct copy constructor for Record. Now that we're using the ID number as a key in maps (for determinism), it is imperative that ID numbers be globally unique, even when we copy construct a Record.
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.
Modified:
llvm/trunk/include/llvm/TableGen/Record.h
Modified: llvm/trunk/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=164251&r1=164250&r2=164251&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h (original)
+++ llvm/trunk/include/llvm/TableGen/Record.h Wed Sep 19 16:34:18 2012
@@ -1328,6 +1328,14 @@
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() {}
More information about the llvm-commits
mailing list