llvm.org GIT mirror llvm / e2501f5
Remove another use of AttributeWithIndex, using the AttributeSetImpl accessors instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173644 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
1 changed file(s) with 14 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
734734 return pImpl ? pImpl->Raw(Index) : 0;
735735 }
736736
737 /// getAttributes - The attributes for the specified index are returned.
737 /// \brief The attributes for the specified index are returned.
738 ///
739 /// FIXME: This shouldn't return 'Attribute'.
738740 Attribute AttributeSet::getAttributes(unsigned Idx) const {
739741 if (pImpl == 0) return Attribute();
740742
741 ArrayRef Attrs = pImpl->getAttributes();
742 for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
743 if (Attrs[i].Index == Idx)
744 return Attrs[i].Attrs;
743 // Loop through to find the attribute we want.
744 for (unsigned I = 0, E = pImpl->getNumAttributes(); I != E; ++I) {
745 if (pImpl->getSlotIndex(I) != Idx) continue;
746
747 AttrBuilder B;
748 for (AttributeSetImpl::const_iterator II = pImpl->begin(I),
749 IE = pImpl->end(I); II != IE; ++II)
750 B.addAttributes(*II);
751 return Attribute::get(pImpl->getContext(), B);
752 }
745753
746754 return Attribute();
747755 }
752760 if (pImpl == 0) return false;
753761
754762 for (unsigned I = 0, E = pImpl->getNumAttributes(); I != E; ++I)
755 for (AttributeSetImpl::iterator II = pImpl->begin(I),
763 for (AttributeSetImpl::const_iterator II = pImpl->begin(I),
756764 IE = pImpl->end(I); II != IE; ++II)
757765 if (II->hasAttribute(Attr))
758766 return true;