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 | 0976e00fd1cbf4128daeb72efd8957d00383fda9 (patch) | |
tree | 8cc3415764d8f9ae20c32ef1a7edd9a519f5a118 /lib/VMCore/AttributesImpl.h | |
parent | 9eecb35d6b3cd772b57620f37deb065b2f426aae (diff) | |
download | external_llvm-0976e00fd1cbf4128daeb72efd8957d00383fda9.zip external_llvm-0976e00fd1cbf4128daeb72efd8957d00383fda9.tar.gz external_llvm-0976e00fd1cbf4128daeb72efd8957d00383fda9.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168354 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/AttributesImpl.h')
-rw-r--r-- | lib/VMCore/AttributesImpl.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/VMCore/AttributesImpl.h b/lib/VMCore/AttributesImpl.h index b4a0f61..5c107e1 100644 --- a/lib/VMCore/AttributesImpl.h +++ b/lib/VMCore/AttributesImpl.h @@ -15,12 +15,11 @@ #ifndef LLVM_ATTRIBUTESIMPL_H #define LLVM_ATTRIBUTESIMPL_H +#include "llvm/Attributes.h" #include "llvm/ADT/FoldingSet.h" namespace llvm { -class Attributes; - class AttributesImpl : public FoldingSetNode { uint64_t Bits; // FIXME: We will be expanding this. public: @@ -46,6 +45,27 @@ public: } }; +class AttributeListImpl : public FoldingSetNode { + // AttributesList is uniqued, these should not be publicly available. + void operator=(const AttributeListImpl &) LLVM_DELETED_FUNCTION; + AttributeListImpl(const AttributeListImpl &) LLVM_DELETED_FUNCTION; +public: + SmallVector<AttributeWithIndex, 4> Attrs; + + AttributeListImpl(ArrayRef<AttributeWithIndex> attrs) + : Attrs(attrs.begin(), attrs.end()) {} + + void Profile(FoldingSetNodeID &ID) const { + Profile(ID, Attrs); + } + static void Profile(FoldingSetNodeID &ID, ArrayRef<AttributeWithIndex> Attrs){ + for (unsigned i = 0, e = Attrs.size(); i != e; ++i) { + ID.AddInteger(Attrs[i].Attrs.Raw()); + ID.AddInteger(Attrs[i].Index); + } + } +}; + } // end llvm namespace #endif |