[llvm-commits] [llvm] r173642 - Remove another use of AttributeWithIndex, using the AttributeSetImpl accessors instead.

Bill Wendling isanbard at gmail.com
Sun Jan 27 16:46:02 PST 2013


Author: void
Date: Sun Jan 27 18:46:02 2013
New Revision: 173642

URL: http://llvm.org/viewvc/llvm-project?rev=173642&view=rev
Log:
Remove another use of AttributeWithIndex, using the AttributeSetImpl accessors instead.

Modified:
    llvm/trunk/lib/IR/Attributes.cpp

Modified: llvm/trunk/lib/IR/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Attributes.cpp?rev=173642&r1=173641&r2=173642&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Attributes.cpp (original)
+++ llvm/trunk/lib/IR/Attributes.cpp Sun Jan 27 18:46:02 2013
@@ -752,10 +752,11 @@ Attribute AttributeSet::getAttributes(un
 bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr) const {
   if (pImpl == 0) return false;
 
-  ArrayRef<AttributeWithIndex> Attrs = pImpl->getAttributes();
-  for (unsigned i = 0, e = Attrs.size(); i != e; ++i)
-    if (Attrs[i].Attrs.hasAttribute(Attr))
-      return true;
+  for (unsigned I = 0, E = pImpl->getNumAttributes(); I != E; ++I)
+    for (AttributeSetImpl::iterator II = pImpl->begin(I),
+           IE = pImpl->end(I); II != IE; ++II)
+      if (II->hasAttribute(Attr))
+        return true;
 
   return false;
 }
@@ -788,11 +789,12 @@ AttributeSet AttributeSet::addAttr(LLVMC
     return *this;
 
   SmallVector<AttributeWithIndex, 8> NewAttrList;
-  if (pImpl == 0)
+  if (pImpl == 0) {
     NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
-  else {
+  } else {
     ArrayRef<AttributeWithIndex> OldAttrList = pImpl->getAttributes();
     unsigned i = 0, e = OldAttrList.size();
+
     // Copy attributes for arguments before this one.
     for (; i != e && OldAttrList[i].Index < Idx; ++i)
       NewAttrList.push_back(OldAttrList[i]);





More information about the llvm-commits mailing list