summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2014-05-08 09:29:28 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2014-05-08 09:29:28 +0000
commit2b6b3d1c5db00b7f11cb4de6421a71daa088c751 (patch)
tree5fb1cecee8f924d230c022e3d4cbce48e3b3fe2e
parentc03e16a7bcd4644db6e1bacddd47d9fd47669840 (diff)
downloadbcm5719-llvm-2b6b3d1c5db00b7f11cb4de6421a71daa088c751.tar.gz
bcm5719-llvm-2b6b3d1c5db00b7f11cb4de6421a71daa088c751.zip
Use a vector of unique_ptrs to fix a memory leak introduced in r208179.
Also removed an inaccurate comment that stated that a DenseMap was used as storage for the ListInit*'s. It's currently using a FoldingSet. I expect there's a better way to fix this but I haven't found it yet. FoldingSet is incompatible with the Pool template and I'm not sure if FoldingSet can be safely replaced with a DenseMap of computed FoldingSetID's to ListInit*'s. llvm-svn: 208293
-rw-r--r--llvm/lib/TableGen/Record.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp
index c17aea99f8e..c553a21c261 100644
--- a/llvm/lib/TableGen/Record.cpp
+++ b/llvm/lib/TableGen/Record.cpp
@@ -623,9 +623,8 @@ static void ProfileListInit(FoldingSetNodeID &ID,
ListInit *ListInit::get(ArrayRef<Init *> Range, RecTy *EltTy) {
typedef FoldingSet<ListInit> Pool;
static Pool ThePool;
+ static std::vector<std::unique_ptr<ListInit>> TheActualPool;
- // Just use the FoldingSetNodeID to compute a hash. Use a DenseMap
- // for actual storage.
FoldingSetNodeID ID;
ProfileListInit(ID, Range, EltTy);
@@ -635,6 +634,7 @@ ListInit *ListInit::get(ArrayRef<Init *> Range, RecTy *EltTy) {
ListInit *I = new ListInit(Range, EltTy);
ThePool.InsertNode(I, IP);
+ TheActualPool.push_back(std::unique_ptr<ListInit>(I));
return I;
}
OpenPOWER on IntegriCloud