diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-11-20 05:09:20 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-11-20 05:09:20 +0000 |
commit | f86efb9b98faf36e1038a34327df2bdeea95f19a (patch) | |
tree | aad015951d6304cd1409e1aad01fa39db8169821 /llvm/lib/VMCore/LLVMContextImpl.cpp | |
parent | 9c1a86b29cfee575a9c8bc2e0e0b5349227d0b4f (diff) | |
download | bcm5719-llvm-f86efb9b98faf36e1038a34327df2bdeea95f19a.tar.gz bcm5719-llvm-f86efb9b98faf36e1038a34327df2bdeea95f19a.zip |
Make the AttrListPtr object a part of the LLVMContext.
When code deletes the context, the AttributeImpls that the AttrListPtr points to
are now invalid. Therefore, instead of keeping a separate managed static for the
AttrListPtrs that's reference counted, move it into the LLVMContext and delete
it when deleting the AttributeImpls.
llvm-svn: 168354
Diffstat (limited to 'llvm/lib/VMCore/LLVMContextImpl.cpp')
-rw-r--r-- | llvm/lib/VMCore/LLVMContextImpl.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/LLVMContextImpl.cpp b/llvm/lib/VMCore/LLVMContextImpl.cpp index 74247bdde13..d35d2844b89 100644 --- a/llvm/lib/VMCore/LLVMContextImpl.cpp +++ b/llvm/lib/VMCore/LLVMContextImpl.cpp @@ -97,11 +97,18 @@ LLVMContextImpl::~LLVMContextImpl() { // Destroy attributes. for (FoldingSetIterator<AttributesImpl> I = AttrsSet.begin(), - E = AttrsSet.end(); I != E;) { + E = AttrsSet.end(); I != E; ) { FoldingSetIterator<AttributesImpl> Elem = I++; delete &*Elem; } + // Destroy attribute lists. + for (FoldingSetIterator<AttributeListImpl> I = AttrsLists.begin(), + E = AttrsLists.end(); I != E; ) { + FoldingSetIterator<AttributeListImpl> Elem = I++; + delete &*Elem; + } + // Destroy MDNodes. ~MDNode can move and remove nodes between the MDNodeSet // and the NonUniquedMDNodes sets, so copy the values out first. SmallVector<MDNode*, 8> MDNodes; |