aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/TableGen
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2012-09-19 21:34:18 +0000
committerOwen Anderson <resistor@mac.com>2012-09-19 21:34:18 +0000
commitcdac1be34a0b329f1bd2232a3f4995432f633c3c (patch)
treeb31b5b103380de9c2d38a7dd7f76cc5580e5ca0c /include/llvm/TableGen
parentd40d4c34f72d1eda3cd9ba0f3dbf2d43b726f06c (diff)
downloadexternal_llvm-cdac1be34a0b329f1bd2232a3f4995432f633c3c.zip
external_llvm-cdac1be34a0b329f1bd2232a3f4995432f633c3c.tar.gz
external_llvm-cdac1be34a0b329f1bd2232a3f4995432f633c3c.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164251 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/TableGen')
-rw-r--r--include/llvm/TableGen/Record.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/TableGen/Record.h b/include/llvm/TableGen/Record.h
index 032f153..8c4893d 100644
--- a/include/llvm/TableGen/Record.h
+++ b/include/llvm/TableGen/Record.h
@@ -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() {}