From 9d30e7208e6b2bc3fa48305e3ae371188f643425 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Mon, 31 Dec 2012 00:49:59 +0000 Subject: Remove the getAttributesAtIndex and getNumAttrs methods in favor of using the getAttrSomewhere predicate. This prevents the uses of 'Attribute' as a collection of attributes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171271 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Attributes.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'lib/VMCore') diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp index de83deb..e8c6b2a 100644 --- a/lib/VMCore/Attributes.cpp +++ b/lib/VMCore/Attributes.cpp @@ -478,7 +478,7 @@ uint64_t AttributeSet::getBitMask(unsigned Index) const { Attribute AttributeSet::getAttributes(unsigned Idx) const { if (AttrList == 0) return Attribute(); - const SmallVector &Attrs = AttrList->Attrs; + const SmallVectorImpl &Attrs = AttrList->Attrs; for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i) if (Attrs[i].Index == Idx) return Attrs[i].Attrs; @@ -499,18 +499,8 @@ bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr) const { return false; } -unsigned AttributeSet::getNumAttrs() const { - return AttrList ? AttrList->Attrs.size() : 0; -} - -Attribute &AttributeSet::getAttributesAtIndex(unsigned i) const { - assert(AttrList && "Trying to get an attribute from an empty list!"); - assert(i < AttrList->Attrs.size() && "Index out of range!"); - return AttrList->Attrs[i].Attrs; -} - AttributeSet AttributeSet::addAttr(LLVMContext &C, unsigned Idx, - Attribute Attrs) const { + Attribute Attrs) const { Attribute OldAttrs = getAttributes(Idx); #ifndef NDEBUG // FIXME it is not obvious how this should work for alignment. @@ -555,7 +545,7 @@ AttributeSet AttributeSet::addAttr(LLVMContext &C, unsigned Idx, } AttributeSet AttributeSet::removeAttr(LLVMContext &C, unsigned Idx, - Attribute Attrs) const { + Attribute Attrs) const { #ifndef NDEBUG // FIXME it is not obvious how this should work for alignment. // For now, say we can't pass in alignment, which no current use does. -- cgit v1.1