summaryrefslogtreecommitdiff
path: root/lib/TableGen/Record.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2015-06-24 06:19:19 +0000
committerCraig Topper <craig.topper@gmail.com>2015-06-24 06:19:19 +0000
commit14055649875565c43e21f0bd6f0f4a249376766d (patch)
treee4eaeb85f87a4ec0b596b79029dc8e9552844a91 /lib/TableGen/Record.cpp
parentbfb19226709cc3ab09c8a492435a4b2bbff84c69 (diff)
[TableGen] Restore the use of the TheInit field in Record to cache the Record's DefInit. I broke this when I fixed memory leaks recently. Remove the DenseMap that mapped Record's to DefInit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240524 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/TableGen/Record.cpp')
-rw-r--r--lib/TableGen/Record.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/TableGen/Record.cpp b/lib/TableGen/Record.cpp
index 97e796c1349..6e982bf1da1 100644
--- a/lib/TableGen/Record.cpp
+++ b/lib/TableGen/Record.cpp
@@ -1574,13 +1574,9 @@ void Record::checkName() {
}
DefInit *Record::getDefInit() {
- static DenseMap<Record *, std::unique_ptr<DefInit>> ThePool;
- if (TheInit)
- return TheInit;
-
- std::unique_ptr<DefInit> &I = ThePool[this];
- if (!I) I.reset(new DefInit(this, new RecordRecTy(this)));
- return I.get();
+ if (!TheInit)
+ TheInit.reset(new DefInit(this, new RecordRecTy(this)));
+ return TheInit.get();
}
const std::string &Record::getName() const {