Use the AttributeSet as the 'key' to the map instead of the 'raw' pointer.
authorBill Wendling <isanbard@gmail.com>
Tue, 12 Feb 2013 08:01:22 +0000 (08:01 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 12 Feb 2013 08:01:22 +0000 (08:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174950 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bitcode/Writer/ValueEnumerator.cpp
lib/Bitcode/Writer/ValueEnumerator.h

index 5822586e9fee67dfe53b6ec97adf1149939cd2ab..4f19dd00e63966cebe2ce1057e90b23011540cff 100644 (file)
@@ -418,10 +418,11 @@ void ValueEnumerator::EnumerateOperandType(const Value *V) {
     EnumerateMetadata(V);
 }
 
-void ValueEnumerator::EnumerateAttributes(const AttributeSet &PAL) {
+void ValueEnumerator::EnumerateAttributes(AttributeSet PAL) {
   if (PAL.isEmpty()) return;  // null is always 0.
+
   // Do a lookup.
-  unsigned &Entry = AttributeMap[PAL.getRawPointer()];
+  unsigned &Entry = AttributeMap[PAL];
   if (Entry == 0) {
     // Never saw this before, add it.
     Attribute.push_back(PAL);
index 33db52388a82ba569be94a7868beb09dbb66c232..0af6164c944f83b0f20ea0e5595392b0cd9a8e6b 100644 (file)
@@ -56,7 +56,7 @@ private:
   AttributeGroupMapType AttributeGroupMap;
   std::vector<AttributeSet> AttributeGroups;
 
-  typedef DenseMap<void*, unsigned> AttributeMapType;
+  typedef DenseMap<AttributeSet, unsigned> AttributeMapType;
   AttributeMapType AttributeMap;
   std::vector<AttributeSet> Attribute;
 
@@ -104,7 +104,7 @@ public:
 
   unsigned getAttributeID(AttributeSet PAL) const {
     if (PAL.isEmpty()) return 0;  // Null maps to zero.
-    AttributeMapType::const_iterator I = AttributeMap.find(PAL.getRawPointer());
+    AttributeMapType::const_iterator I = AttributeMap.find(PAL);
     assert(I != AttributeMap.end() && "Attribute not in ValueEnumerator!");
     return I->second;
   }
@@ -160,7 +160,7 @@ private:
   void EnumerateValue(const Value *V);
   void EnumerateType(Type *T);
   void EnumerateOperandType(const Value *V);
-  void EnumerateAttributes(const AttributeSet &PAL);
+  void EnumerateAttributes(AttributeSet PAL);
 
   void EnumerateValueSymbolTable(const ValueSymbolTable &ST);
   void EnumerateNamedMetadata(const Module *M);