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

Bill Wendling isanbard at gmail.com
Sun Oct 14 00:17:34 PDT 2012


Author: void
Date: Sun Oct 14 02:17:34 2012
New Revision: 165894

URL: http://llvm.org/viewvc/llvm-project?rev=165894&view=rev
Log:
Remove the bitwise OR operator from the Attributes class. Replace it with the equivalent from the builder 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=165894&r1=165893&r2=165894&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Attributes.h (original)
+++ llvm/trunk/include/llvm/Attributes.h Sun Oct 14 02:17:34 2012
@@ -131,6 +131,7 @@
     /// a power of 2) into the form used internally in Attributes.
     Builder &addStackAlignmentAttr(unsigned Align);
 
+    Builder &addAttributes(const Attributes &A);
     Builder &removeAttributes(const Attributes &A);
 
     /// @brief Remove attributes that are used on functions only.
@@ -234,7 +235,6 @@
     return Attrs.Bits != A.Attrs.Bits;
   }
 
-  Attributes operator | (const Attributes &A) const;
   Attributes operator & (const Attributes &A) const;
   Attributes &operator |= (const Attributes &A);
   Attributes &operator &= (const Attributes &A);

Modified: llvm/trunk/lib/VMCore/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=165894&r1=165893&r2=165894&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Attributes.cpp (original)
+++ llvm/trunk/lib/VMCore/Attributes.cpp Sun Oct 14 02:17:34 2012
@@ -93,9 +93,6 @@
   return Attrs.isEmptyOrSingleton();
 }
 
-Attributes Attributes::operator | (const Attributes &A) const {
-  return Attributes(Raw() | A.Raw());
-}
 Attributes Attributes::operator & (const Attributes &A) const {
   return Attributes(Raw() & A.Raw());
 }
@@ -236,8 +233,12 @@
   return *this;
 }
 
-Attributes::Builder &Attributes::Builder::
-removeAttributes(const Attributes &A) {
+Attributes::Builder &Attributes::Builder::addAttributes(const Attributes &A) {
+  Bits |= A.Raw();
+  return *this;
+}
+
+Attributes::Builder &Attributes::Builder::removeAttributes(const Attributes &A){
   Bits &= ~A.Raw();
   return *this;
 }
@@ -514,8 +515,9 @@
          "Attempt to change alignment!");
 #endif
   
-  Attributes NewAttrs = OldAttrs | Attrs;
-  if (NewAttrs == OldAttrs)
+  Attributes::Builder NewAttrs =
+    Attributes::Builder(OldAttrs).addAttributes(Attrs);
+  if (NewAttrs == Attributes::Builder(OldAttrs))
     return *this;
   
   SmallVector<AttributeWithIndex, 8> NewAttrList;





More information about the llvm-commits mailing list