1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

s/AttrList/pImpl/g in AttributeSet. No functionality change.

llvm-svn: 173628
This commit is contained in:
Bill Wendling 2013-01-27 21:23:46 +00:00
parent 2b431a6fb5
commit bc0a92c4bd
2 changed files with 31 additions and 31 deletions

View File

@ -210,7 +210,7 @@ private:
/// \brief The attributes that we are managing. This can be null to represent /// \brief The attributes that we are managing. This can be null to represent
/// the empty attributes list. /// the empty attributes list.
AttributeSetImpl *AttrList; AttributeSetImpl *pImpl;
/// \brief The attributes for the specified index are returned. Attributes /// \brief The attributes for the specified index are returned. Attributes
/// for the result are denoted with Idx = 0. /// for the result are denoted with Idx = 0.
@ -230,10 +230,10 @@ private:
/// N.B. this is only temporary. It will be disappearing in the future. /// N.B. this is only temporary. It will be disappearing in the future.
static AttributeSet get(LLVMContext &C, ArrayRef<AttributeWithIndex> Attrs); static AttributeSet get(LLVMContext &C, ArrayRef<AttributeWithIndex> Attrs);
explicit AttributeSet(AttributeSetImpl *LI) : AttrList(LI) {} explicit AttributeSet(AttributeSetImpl *LI) : pImpl(LI) {}
public: public:
AttributeSet() : AttrList(0) {} AttributeSet() : pImpl(0) {}
AttributeSet(const AttributeSet &P) : AttrList(P.AttrList) {} AttributeSet(const AttributeSet &P) : pImpl(P.pImpl) {}
const AttributeSet &operator=(const AttributeSet &RHS); const AttributeSet &operator=(const AttributeSet &RHS);
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
@ -320,10 +320,10 @@ public:
/// operator==/!= - Provide equality predicates. /// operator==/!= - Provide equality predicates.
bool operator==(const AttributeSet &RHS) const { bool operator==(const AttributeSet &RHS) const {
return AttrList == RHS.AttrList; return pImpl == RHS.pImpl;
} }
bool operator!=(const AttributeSet &RHS) const { bool operator!=(const AttributeSet &RHS) const {
return AttrList != RHS.AttrList; return pImpl != RHS.pImpl;
} }
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
@ -332,7 +332,7 @@ public:
/// \brief Return a raw pointer that uniquely identifies this attribute list. /// \brief Return a raw pointer that uniquely identifies this attribute list.
void *getRawPointer() const { void *getRawPointer() const {
return AttrList; return pImpl;
} }
// Attributes are stored as a dense set of slots, where there is one slot for // Attributes are stored as a dense set of slots, where there is one slot for
@ -341,7 +341,7 @@ public:
/// \brief Return true if there are no attributes. /// \brief Return true if there are no attributes.
bool isEmpty() const { bool isEmpty() const {
return AttrList == 0; return pImpl == 0;
} }
/// \brief Return the number of slots used in this attribute list. This is /// \brief Return the number of slots used in this attribute list. This is

View File

@ -183,7 +183,7 @@ std::string Attribute::getAsString() const {
AttrBuilder::AttrBuilder(AttributeSet AS, unsigned Idx) AttrBuilder::AttrBuilder(AttributeSet AS, unsigned Idx)
: Alignment(0), StackAlignment(0) { : Alignment(0), StackAlignment(0) {
AttributeSetImpl *pImpl = AS.AttrList; AttributeSetImpl *pImpl = AS.pImpl;
if (!pImpl) return; if (!pImpl) return;
ArrayRef<AttributeWithIndex> AttrList = pImpl->getAttributes(); ArrayRef<AttributeWithIndex> AttrList = pImpl->getAttributes();
@ -569,16 +569,16 @@ AttributeSetImpl(LLVMContext &C,
AttributeSet AttributeSet::getParamAttributes(unsigned Idx) const { AttributeSet AttributeSet::getParamAttributes(unsigned Idx) const {
// FIXME: Remove. // FIXME: Remove.
return AttrList && hasAttributes(Idx) ? return pImpl && hasAttributes(Idx) ?
AttributeSet::get(AttrList->getContext(), AttributeSet::get(pImpl->getContext(),
AttributeWithIndex::get(Idx, getAttributes(Idx))) : AttributeWithIndex::get(Idx, getAttributes(Idx))) :
AttributeSet(); AttributeSet();
} }
AttributeSet AttributeSet::getRetAttributes() const { AttributeSet AttributeSet::getRetAttributes() const {
// FIXME: Remove. // FIXME: Remove.
return AttrList && hasAttributes(ReturnIndex) ? return pImpl && hasAttributes(ReturnIndex) ?
AttributeSet::get(AttrList->getContext(), AttributeSet::get(pImpl->getContext(),
AttributeWithIndex::get(ReturnIndex, AttributeWithIndex::get(ReturnIndex,
getAttributes(ReturnIndex))) : getAttributes(ReturnIndex))) :
AttributeSet(); AttributeSet();
@ -586,8 +586,8 @@ AttributeSet AttributeSet::getRetAttributes() const {
AttributeSet AttributeSet::getFnAttributes() const { AttributeSet AttributeSet::getFnAttributes() const {
// FIXME: Remove. // FIXME: Remove.
return AttrList && hasAttributes(FunctionIndex) ? return pImpl && hasAttributes(FunctionIndex) ?
AttributeSet::get(AttrList->getContext(), AttributeSet::get(pImpl->getContext(),
AttributeWithIndex::get(FunctionIndex, AttributeWithIndex::get(FunctionIndex,
getAttributes(FunctionIndex))) : getAttributes(FunctionIndex))) :
AttributeSet(); AttributeSet();
@ -651,15 +651,15 @@ AttributeSet AttributeSet::get(LLVMContext &C, ArrayRef<AttributeSet> Attrs) {
for (ArrayRef<AttributeSet>::iterator I = Attrs.begin(), E = Attrs.end(); for (ArrayRef<AttributeSet>::iterator I = Attrs.begin(), E = Attrs.end();
I != E; ++I) { I != E; ++I) {
AttributeSet AS = *I; AttributeSet AS = *I;
if (!AS.AttrList) continue; if (!AS.pImpl) continue;
AttrList.append(AS.AttrList->AttrList.begin(), AS.AttrList->AttrList.end()); AttrList.append(AS.pImpl->AttrList.begin(), AS.pImpl->AttrList.end());
} }
return get(C, AttrList); return get(C, AttrList);
} }
const AttributeSet &AttributeSet::operator=(const AttributeSet &RHS) { const AttributeSet &AttributeSet::operator=(const AttributeSet &RHS) {
AttrList = RHS.AttrList; pImpl = RHS.pImpl;
return *this; return *this;
} }
@ -667,19 +667,19 @@ const AttributeSet &AttributeSet::operator=(const AttributeSet &RHS) {
/// This is the number of arguments that have an attribute set on them /// This is the number of arguments that have an attribute set on them
/// (including the function itself). /// (including the function itself).
unsigned AttributeSet::getNumSlots() const { unsigned AttributeSet::getNumSlots() const {
return AttrList ? AttrList->getNumAttributes() : 0; return pImpl ? pImpl->getNumAttributes() : 0;
} }
unsigned AttributeSet::getSlotIndex(unsigned Slot) const { unsigned AttributeSet::getSlotIndex(unsigned Slot) const {
assert(AttrList && Slot < AttrList->getNumAttributes() && assert(pImpl && Slot < pImpl->getNumAttributes() &&
"Slot # out of range!"); "Slot # out of range!");
return AttrList->getSlotIndex(Slot); return pImpl->getSlotIndex(Slot);
} }
AttributeSet AttributeSet::getSlotAttributes(unsigned Slot) const { AttributeSet AttributeSet::getSlotAttributes(unsigned Slot) const {
assert(AttrList && Slot < AttrList->getNumAttributes() && assert(pImpl && Slot < pImpl->getNumAttributes() &&
"Slot # out of range!"); "Slot # out of range!");
return AttrList->getSlotAttributes(Slot); return pImpl->getSlotAttributes(Slot);
} }
bool AttributeSet::hasAttribute(unsigned Index, Attribute::AttrKind Kind) const{ bool AttributeSet::hasAttribute(unsigned Index, Attribute::AttrKind Kind) const{
@ -709,9 +709,9 @@ uint64_t AttributeSet::Raw(unsigned Index) const {
/// getAttributes - The attributes for the specified index are returned. /// getAttributes - The attributes for the specified index are returned.
Attribute AttributeSet::getAttributes(unsigned Idx) const { Attribute AttributeSet::getAttributes(unsigned Idx) const {
if (AttrList == 0) return Attribute(); if (pImpl == 0) return Attribute();
ArrayRef<AttributeWithIndex> Attrs = AttrList->getAttributes(); ArrayRef<AttributeWithIndex> Attrs = pImpl->getAttributes();
for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i) for (unsigned i = 0, e = Attrs.size(); i != e && Attrs[i].Index <= Idx; ++i)
if (Attrs[i].Index == Idx) if (Attrs[i].Index == Idx)
return Attrs[i].Attrs; return Attrs[i].Attrs;
@ -722,9 +722,9 @@ Attribute AttributeSet::getAttributes(unsigned Idx) const {
/// hasAttrSomewhere - Return true if the specified attribute is set for at /// hasAttrSomewhere - Return true if the specified attribute is set for at
/// least one parameter or for the return value. /// least one parameter or for the return value.
bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr) const { bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr) const {
if (AttrList == 0) return false; if (pImpl == 0) return false;
ArrayRef<AttributeWithIndex> Attrs = AttrList->getAttributes(); ArrayRef<AttributeWithIndex> Attrs = pImpl->getAttributes();
for (unsigned i = 0, e = Attrs.size(); i != e; ++i) for (unsigned i = 0, e = Attrs.size(); i != e; ++i)
if (Attrs[i].Attrs.hasAttribute(Attr)) if (Attrs[i].Attrs.hasAttribute(Attr))
return true; return true;
@ -760,10 +760,10 @@ AttributeSet AttributeSet::addAttr(LLVMContext &C, unsigned Idx,
return *this; return *this;
SmallVector<AttributeWithIndex, 8> NewAttrList; SmallVector<AttributeWithIndex, 8> NewAttrList;
if (AttrList == 0) if (pImpl == 0)
NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs)); NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
else { else {
ArrayRef<AttributeWithIndex> OldAttrList = AttrList->getAttributes(); ArrayRef<AttributeWithIndex> OldAttrList = pImpl->getAttributes();
unsigned i = 0, e = OldAttrList.size(); unsigned i = 0, e = OldAttrList.size();
// Copy attributes for arguments before this one. // Copy attributes for arguments before this one.
for (; i != e && OldAttrList[i].Index < Idx; ++i) for (; i != e && OldAttrList[i].Index < Idx; ++i)
@ -805,7 +805,7 @@ AttributeSet AttributeSet::removeAttr(LLVMContext &C, unsigned Idx,
assert(!Attrs.hasAttribute(Attribute::Alignment) && assert(!Attrs.hasAttribute(Attribute::Alignment) &&
"Attempt to exclude alignment!"); "Attempt to exclude alignment!");
#endif #endif
if (AttrList == 0) return AttributeSet(); if (pImpl == 0) return AttributeSet();
Attribute OldAttrs = getAttributes(Idx); Attribute OldAttrs = getAttributes(Idx);
AttrBuilder NewAttrs = AttrBuilder NewAttrs =
@ -814,7 +814,7 @@ AttributeSet AttributeSet::removeAttr(LLVMContext &C, unsigned Idx,
return *this; return *this;
SmallVector<AttributeWithIndex, 8> NewAttrList; SmallVector<AttributeWithIndex, 8> NewAttrList;
ArrayRef<AttributeWithIndex> OldAttrList = AttrList->getAttributes(); ArrayRef<AttributeWithIndex> OldAttrList = pImpl->getAttributes();
unsigned i = 0, e = OldAttrList.size(); unsigned i = 0, e = OldAttrList.size();
// Copy attributes for arguments before this one. // Copy attributes for arguments before this one.