Add a context so that once we uniquify strings we can access them easily.
authorBill Wendling <isanbard@gmail.com>
Wed, 19 Dec 2012 23:55:43 +0000 (23:55 +0000)
committerBill Wendling <isanbard@gmail.com>
Wed, 19 Dec 2012 23:55:43 +0000 (23:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170615 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Attributes.cpp
lib/VMCore/AttributesImpl.h

index 4b975238b252fcf30b3f53de9b61069ca4a617bc..9e24add8c8df03751c3af6eaaa60f8ecb35e3130 100644 (file)
@@ -382,7 +382,7 @@ AttributeSet AttributeSet::get(LLVMContext &C,
   // If we didn't find any existing attributes of the same shape then
   // create a new one and insert it.
   if (!PA) {
-    PA = new AttributeSetImpl(Attrs);
+    PA = new AttributeSetImpl(C, Attrs);
     pImpl->AttrsLists.InsertNode(PA, InsertPoint);
   }
 
index 0b3b4971f363e2b176b442a3eb4921c1e6043f7b..396634ed0fe74263446ae6a3e84c013543d19623 100644 (file)
@@ -20,6 +20,8 @@
 
 namespace llvm {
 
+class LLVMContext;
+
 class AttributesImpl : public FoldingSetNode {
   uint64_t Bits;                // FIXME: We will be expanding this.
 public:
@@ -50,10 +52,11 @@ class AttributeSetImpl : public FoldingSetNode {
   void operator=(const AttributeSetImpl &) LLVM_DELETED_FUNCTION;
   AttributeSetImpl(const AttributeSetImpl &) LLVM_DELETED_FUNCTION;
 public:
+  LLVMContext &Context;
   SmallVector<AttributeWithIndex, 4> Attrs;
 
-  AttributeSetImpl(ArrayRef<AttributeWithIndex> attrs)
-    : Attrs(attrs.begin(), attrs.end()) {}
+  AttributeSetImpl(LLVMContext &C, ArrayRef<AttributeWithIndex> attrs)
+    : Context(C), Attrs(attrs.begin(), attrs.end()) {}
 
   void Profile(FoldingSetNodeID &ID) const {
     Profile(ID, Attrs);