llvm.org GIT mirror llvm / ec25898
s/AttrList/pImpl/g in AttributeSet. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173628 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
2 changed file(s) with 33 addition(s) and 33 deletion(s). Raw diff Collapse all Expand all
209209
210210 /// \brief The attributes that we are managing. This can be null to represent
211211 /// the empty attributes list.
212 AttributeSetImpl *AttrList;
212 AttributeSetImpl *pImpl;
213213
214214 /// \brief The attributes for the specified index are returned. Attributes
215215 /// for the result are denoted with Idx = 0.
229229 /// N.B. this is only temporary. It will be disappearing in the future.
230230 static AttributeSet get(LLVMContext &C, ArrayRef Attrs);
231231
232 explicit AttributeSet(AttributeSetImpl *LI) : AttrList(LI) {}
232 explicit AttributeSet(AttributeSetImpl *LI) : pImpl(LI) {}
233233 public:
234 AttributeSet() : AttrList(0) {}
235 AttributeSet(const AttributeSet &P) : AttrList(P.AttrList) {}
234 AttributeSet() : pImpl(0) {}
235 AttributeSet(const AttributeSet &P) : pImpl(P.pImpl) {}
236236 const AttributeSet &operator=(const AttributeSet &RHS);
237237
238238 //===--------------------------------------------------------------------===//
319319
320320 /// operator==/!= - Provide equality predicates.
321321 bool operator==(const AttributeSet &RHS) const {
322 return AttrList == RHS.AttrList;
322 return pImpl == RHS.pImpl;
323323 }
324324 bool operator!=(const AttributeSet &RHS) const {
325 return AttrList != RHS.AttrList;
325 return pImpl != RHS.pImpl;
326326 }
327327
328328 //===--------------------------------------------------------------------===//
331331
332332 /// \brief Return a raw pointer that uniquely identifies this attribute list.
333333 void *getRawPointer() const {
334 return AttrList;
334 return pImpl;
335335 }
336336
337337 // Attributes are stored as a dense set of slots, where there is one slot for
340340
341341 /// \brief Return true if there are no attributes.
342342 bool isEmpty() const {
343 return AttrList == 0;
343 return pImpl == 0;
344344 }
345345
346346 /// \brief Return the number of slots used in this attribute list. This is
182182
183183 AttrBuilder::AttrBuilder(AttributeSet AS, unsigned Idx)
184184 : Alignment(0), StackAlignment(0) {
185 AttributeSetImpl *pImpl = AS.AttrList;
185 AttributeSetImpl *pImpl = AS.pImpl;
186186 if (!pImpl) return;
187187
188188 ArrayRef AttrList = pImpl->getAttributes();
568568
569569 AttributeSet AttributeSet::getParamAttributes(unsigned Idx) const {
570570 // FIXME: Remove.
571 return AttrList && hasAttributes(Idx) ?
572 AttributeSet::get(AttrList->getContext(),
571 return pImpl && hasAttributes(Idx) ?
572 AttributeSet::get(pImpl->getContext(),
573573 AttributeWithIndex::get(Idx, getAttributes(Idx))) :
574574 AttributeSet();
575575 }
576576
577577 AttributeSet AttributeSet::getRetAttributes() const {
578578 // FIXME: Remove.
579 return AttrList && hasAttributes(ReturnIndex) ?
580 AttributeSet::get(AttrList->getContext(),
579 return pImpl && hasAttributes(ReturnIndex) ?
580 AttributeSet::get(pImpl->getContext(),
581581 AttributeWithIndex::get(ReturnIndex,
582582 getAttributes(ReturnIndex))) :
583583 AttributeSet();
585585
586586 AttributeSet AttributeSet::getFnAttributes() const {
587587 // FIXME: Remove.
588 return AttrList && hasAttributes(FunctionIndex) ?
589 AttributeSet::get(AttrList->getContext(),
588 return pImpl && hasAttributes(FunctionIndex) ?
589 AttributeSet::get(pImpl->getContext(),
590590 AttributeWithIndex::get(FunctionIndex,
591591 getAttributes(FunctionIndex))) :
592592 AttributeSet();
650650 for (ArrayRef::iterator I = Attrs.begin(), E = Attrs.end();
651651 I != E; ++I) {
652652 AttributeSet AS = *I;
653 if (!AS.AttrList) continue;
654 AttrList.append(AS.AttrList->AttrList.begin(), AS.AttrList->AttrList.end());
653 if (!AS.pImpl) continue;
654 AttrList.append(AS.pImpl->AttrList.begin(), AS.pImpl->AttrList.end());
655655 }
656656
657657 return get(C, AttrList);
658658 }
659659
660660 const AttributeSet &AttributeSet::operator=(const AttributeSet &RHS) {
661 AttrList = RHS.AttrList;
661 pImpl = RHS.pImpl;
662662 return *this;
663663 }
664664
666666 /// This is the number of arguments that have an attribute set on them
667667 /// (including the function itself).
668668 unsigned AttributeSet::getNumSlots() const {
669 return AttrList ? AttrList->getNumAttributes() : 0;
669 return pImpl ? pImpl->getNumAttributes() : 0;
670670 }
671671
672672 unsigned AttributeSet::getSlotIndex(unsigned Slot) const {
673 assert(AttrList && Slot < AttrList->getNumAttributes() &&
673 assert(pImpl && Slot < pImpl->getNumAttributes() &&
674674 "Slot # out of range!");
675 return AttrList->getSlotIndex(Slot);
675 return pImpl->getSlotIndex(Slot);
676676 }
677677
678678 AttributeSet AttributeSet::getSlotAttributes(unsigned Slot) const {
679 assert(AttrList && Slot < AttrList->getNumAttributes() &&
679 assert(pImpl && Slot < pImpl->getNumAttributes() &&
680680 "Slot # out of range!");
681 return AttrList->getSlotAttributes(Slot);
681 return pImpl->getSlotAttributes(Slot);
682682 }
683683
684684 bool AttributeSet::hasAttribute(unsigned Index, Attribute::AttrKind Kind) const{
708708
709709 /// getAttributes - The attributes for the specified index are returned.
710710 Attribute AttributeSet::getAttributes(unsigned Idx) const {
711 if (AttrList == 0) return Attribute();
712
713 ArrayRef Attrs = AttrList->getAttributes();
711 if (pImpl == 0) return Attribute();
712
713 ArrayRef Attrs = pImpl->getAttributes();
714714 for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
715715 if (Attrs[i].Index == Idx)
716716 return Attrs[i].Attrs;
721721 /// hasAttrSomewhere - Return true if the specified attribute is set for at
722722 /// least one parameter or for the return value.
723723 bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr) const {
724 if (AttrList == 0) return false;
725
726 ArrayRef Attrs = AttrList->getAttributes();
724 if (pImpl == 0) return false;
725
726 ArrayRef Attrs = pImpl->getAttributes();
727727 for (unsigned i = 0, e = Attrs.size(); i != e; ++i)
728728 if (Attrs[i].Attrs.hasAttribute(Attr))
729729 return true;
759759 return *this;
760760
761761 SmallVector NewAttrList;
762 if (AttrList == 0)
762 if (pImpl == 0)
763763 NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
764764 else {
765 ArrayRef OldAttrList = AttrList->getAttributes();
765 ArrayRef OldAttrList = pImpl->getAttributes();
766766 unsigned i = 0, e = OldAttrList.size();
767767 // Copy attributes for arguments before this one.
768768 for (; i != e && OldAttrList[i].Index < Idx; ++i)
804804 assert(!Attrs.hasAttribute(Attribute::Alignment) &&
805805 "Attempt to exclude alignment!");
806806 #endif
807 if (AttrList == 0) return AttributeSet();
807 if (pImpl == 0) return AttributeSet();
808808
809809 Attribute OldAttrs = getAttributes(Idx);
810810 AttrBuilder NewAttrs =
813813 return *this;
814814
815815 SmallVector NewAttrList;
816 ArrayRef OldAttrList = AttrList->getAttributes();
816 ArrayRef OldAttrList = pImpl->getAttributes();
817817 unsigned i = 0, e = OldAttrList.size();
818818
819819 // Copy attributes for arguments before this one.