llvm.org GIT mirror llvm / d05204a
Push the calculation of the 'Raw' attribute mask down into the implementation. It in turn uses the correct list for calculating the 'Raw' value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173637 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
3 changed file(s) with 29 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
233233 public:
234234 AttributeSet() : pImpl(0) {}
235235 AttributeSet(const AttributeSet &P) : pImpl(P.pImpl) {}
236 const AttributeSet &operator=(const AttributeSet &RHS);
236 const AttributeSet &operator=(const AttributeSet &RHS) {
237 pImpl = RHS.pImpl;
238 return *this;
239 }
237240
238241 //===--------------------------------------------------------------------===//
239242 // Attribute List Construction and Mutation
164164 ID.AddPointer(Nodes[i].second);
165165 }
166166 }
167
168 // FIXME: This atrocity is temporary.
169 uint64_t Raw(uint64_t Index) const;
167170 };
168171
169172 } // end llvm namespace
573573 #endif
574574 }
575575
576 uint64_t AttributeSetImpl::Raw(uint64_t Index) const {
577 for (unsigned I = 0, E = getNumAttributes(); I != E; ++I) {
578 if (getSlotIndex(I) != Index) continue;
579 const AttributeSetNode *ASN = AttrNodes[I].second;
580 AttrBuilder B;
581
582 for (AttributeSetNode::const_iterator II = ASN->begin(),
583 IE = ASN->end(); II != IE; ++II)
584 B.addAttributes(*II);
585
586 assert(B.Raw() == AttrList[I].Attrs.Raw() &&
587 "Attributes aren't the same!");
588 return B.Raw();
589 }
590
591 return 0;
592 }
593
576594 //===----------------------------------------------------------------------===//
577595 // AttributeSet Method Implementations
578596 //===----------------------------------------------------------------------===//
668686 return get(C, AttrList);
669687 }
670688
671 const AttributeSet &AttributeSet::operator=(const AttributeSet &RHS) {
672 pImpl = RHS.pImpl;
673 return *this;
674 }
675
676 /// getNumSlots - Return the number of slots used in this attribute list.
677 /// This is the number of arguments that have an attribute set on them
678 /// (including the function itself).
689 /// \brief Return the number of slots used in this attribute list. This is the
690 /// number of arguments that have an attribute set on them (including the
691 /// function itself).
679692 unsigned AttributeSet::getNumSlots() const {
680693 return pImpl ? pImpl->getNumAttributes() : 0;
681694 }
714727
715728 uint64_t AttributeSet::Raw(unsigned Index) const {
716729 // FIXME: Remove this.
717 return getAttributes(Index).Raw();
730 return pImpl ? pImpl->Raw(Index) : 0;
718731 }
719732
720733 /// getAttributes - The attributes for the specified index are returned.