Skip to content

Commit

Permalink
Implement a correct copy constructor for Record. Now that we're using…
Browse files Browse the repository at this point in the history
… 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164251 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
resistor committed Sep 19, 2012
1 parent d40d4c3 commit cdac1be
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/llvm/TableGen/Record.h
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,14 @@ class Record {
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() {}


Expand Down

0 comments on commit cdac1be

Please sign in to comment.