[llvm-commits] [llvm] r166011 - in /llvm/trunk: include/llvm/Attributes.h lib/VMCore/Attributes.cpp

Bill Wendling isanbard at gmail.com
Mon Oct 15 22:55:09 PDT 2012


Author: void
Date: Tue Oct 16 00:55:09 2012
New Revision: 166011

URL: http://llvm.org/viewvc/llvm-project?rev=166011&view=rev
Log:
Have AttrBuilder defriend the Attributes class.

Modified:
    llvm/trunk/include/llvm/Attributes.h
    llvm/trunk/lib/VMCore/Attributes.cpp

Modified: llvm/trunk/include/llvm/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=166011&r1=166010&r2=166011&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Attributes.h (original)
+++ llvm/trunk/include/llvm/Attributes.h Tue Oct 16 00:55:09 2012
@@ -192,7 +192,6 @@
 /// Builder's value, however, is not. So this can be used as a quick way to test
 /// for equality, presence of attributes, etc.
 class AttrBuilder {
-  friend class Attributes;
   uint64_t Bits;
 public:
   AttrBuilder() : Bits(0) {}
@@ -267,6 +266,8 @@
       .removeAttribute(Attributes::AddressSafety);
   }
 
+  uint64_t Raw() const { return Bits; }
+
   bool operator==(const AttrBuilder &B) {
     return Bits == B.Bits;
   }

Modified: llvm/trunk/lib/VMCore/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=166011&r1=166010&r2=166011&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Attributes.cpp (original)
+++ llvm/trunk/lib/VMCore/Attributes.cpp Tue Oct 16 00:55:09 2012
@@ -38,13 +38,13 @@
 
 Attributes Attributes::get(LLVMContext &Context, AttrBuilder &B) {
   // If there are no attributes, return an empty Attributes class.
-  if (B.Bits == 0)
+  if (!B.hasAttributes())
     return Attributes();
 
   // Otherwise, build a key to look up the existing attributes.
   LLVMContextImpl *pImpl = Context.pImpl;
   FoldingSetNodeID ID;
-  ID.AddInteger(B.Bits);
+  ID.AddInteger(B.Raw());
 
   void *InsertPoint;
   AttributesImpl *PA = pImpl->AttrsSet.FindNodeOrInsertPos(ID, InsertPoint);
@@ -52,7 +52,7 @@
   if (!PA) {
     // If we didn't find any existing attributes of the same shape then create a
     // new one and insert it.
-    PA = new AttributesImpl(B.Bits);
+    PA = new AttributesImpl(B.Raw());
     pImpl->AttrsSet.InsertNode(PA, InsertPoint);
   }
 





More information about the llvm-commits mailing list