/// \brief The attributes that we are managing. This can be null to represent
/// the empty attributes list.
- AttributeSetImpl *AttrList;
+ AttributeSetImpl *pImpl;
/// \brief The attributes for the specified index are returned. Attributes
/// for the result are denoted with Idx = 0.
/// N.B. this is only temporary. It will be disappearing in the future.
static AttributeSet get(LLVMContext &C, ArrayRef<AttributeWithIndex> Attrs);
- explicit AttributeSet(AttributeSetImpl *LI) : AttrList(LI) {}
+ explicit AttributeSet(AttributeSetImpl *LI) : pImpl(LI) {}
public:
- AttributeSet() : AttrList(0) {}
- AttributeSet(const AttributeSet &P) : AttrList(P.AttrList) {}
+ AttributeSet() : pImpl(0) {}
+ AttributeSet(const AttributeSet &P) : pImpl(P.pImpl) {}
const AttributeSet &operator=(const AttributeSet &RHS);
//===--------------------------------------------------------------------===//
/// operator==/!= - Provide equality predicates.
bool operator==(const AttributeSet &RHS) const {
- return AttrList == RHS.AttrList;
+ return pImpl == RHS.pImpl;
}
bool operator!=(const AttributeSet &RHS) const {
- return AttrList != RHS.AttrList;
+ return pImpl != RHS.pImpl;
}
//===--------------------------------------------------------------------===//
/// \brief Return a raw pointer that uniquely identifies this attribute list.
void *getRawPointer() const {
- return AttrList;
+ return pImpl;
}
// Attributes are stored as a dense set of slots, where there is one slot for
/// \brief Return true if there are no attributes.
bool isEmpty() const {
- return AttrList == 0;
+ return pImpl == 0;
}
/// \brief Return the number of slots used in this attribute list. This is
AttrBuilder::AttrBuilder(AttributeSet AS, unsigned Idx)
: Alignment(0), StackAlignment(0) {
- AttributeSetImpl *pImpl = AS.AttrList;
+ AttributeSetImpl *pImpl = AS.pImpl;
if (!pImpl) return;
ArrayRef<AttributeWithIndex> AttrList = pImpl->getAttributes();
AttributeSet AttributeSet::getParamAttributes(unsigned Idx) const {
// FIXME: Remove.
- return AttrList && hasAttributes(Idx) ?
- AttributeSet::get(AttrList->getContext(),
+ return pImpl && hasAttributes(Idx) ?
+ AttributeSet::get(pImpl->getContext(),
AttributeWithIndex::get(Idx, getAttributes(Idx))) :
AttributeSet();
}
AttributeSet AttributeSet::getRetAttributes() const {
// FIXME: Remove.
- return AttrList && hasAttributes(ReturnIndex) ?
- AttributeSet::get(AttrList->getContext(),
+ return pImpl && hasAttributes(ReturnIndex) ?
+ AttributeSet::get(pImpl->getContext(),
AttributeWithIndex::get(ReturnIndex,
getAttributes(ReturnIndex))) :
AttributeSet();
AttributeSet AttributeSet::getFnAttributes() const {
// FIXME: Remove.
- return AttrList && hasAttributes(FunctionIndex) ?
- AttributeSet::get(AttrList->getContext(),
+ return pImpl && hasAttributes(FunctionIndex) ?
+ AttributeSet::get(pImpl->getContext(),
AttributeWithIndex::get(FunctionIndex,
getAttributes(FunctionIndex))) :
AttributeSet();
for (ArrayRef<AttributeSet>::iterator I = Attrs.begin(), E = Attrs.end();
I != E; ++I) {
AttributeSet AS = *I;
- if (!AS.AttrList) continue;
- AttrList.append(AS.AttrList->AttrList.begin(), AS.AttrList->AttrList.end());
+ if (!AS.pImpl) continue;
+ AttrList.append(AS.pImpl->AttrList.begin(), AS.pImpl->AttrList.end());
}
return get(C, AttrList);
}
const AttributeSet &AttributeSet::operator=(const AttributeSet &RHS) {
- AttrList = RHS.AttrList;
+ pImpl = RHS.pImpl;
return *this;
}
/// This is the number of arguments that have an attribute set on them
/// (including the function itself).
unsigned AttributeSet::getNumSlots() const {
- return AttrList ? AttrList->getNumAttributes() : 0;
+ return pImpl ? pImpl->getNumAttributes() : 0;
}
unsigned AttributeSet::getSlotIndex(unsigned Slot) const {
- assert(AttrList && Slot < AttrList->getNumAttributes() &&
+ assert(pImpl && Slot < pImpl->getNumAttributes() &&
"Slot # out of range!");
- return AttrList->getSlotIndex(Slot);
+ return pImpl->getSlotIndex(Slot);
}
AttributeSet AttributeSet::getSlotAttributes(unsigned Slot) const {
- assert(AttrList && Slot < AttrList->getNumAttributes() &&
+ assert(pImpl && Slot < pImpl->getNumAttributes() &&
"Slot # out of range!");
- return AttrList->getSlotAttributes(Slot);
+ return pImpl->getSlotAttributes(Slot);
}
bool AttributeSet::hasAttribute(unsigned Index, Attribute::AttrKind Kind) const{
/// getAttributes - The attributes for the specified index are returned.
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)
if (Attrs[i].Index == Idx)
return Attrs[i].Attrs;
/// hasAttrSomewhere - Return true if the specified attribute is set for at
/// least one parameter or for the return value.
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)
if (Attrs[i].Attrs.hasAttribute(Attr))
return true;
return *this;
SmallVector<AttributeWithIndex, 8> NewAttrList;
- if (AttrList == 0)
+ if (pImpl == 0)
NewAttrList.push_back(AttributeWithIndex::get(Idx, Attrs));
else {
- ArrayRef<AttributeWithIndex> OldAttrList = AttrList->getAttributes();
+ ArrayRef<AttributeWithIndex> OldAttrList = pImpl->getAttributes();
unsigned i = 0, e = OldAttrList.size();
// Copy attributes for arguments before this one.
for (; i != e && OldAttrList[i].Index < Idx; ++i)
assert(!Attrs.hasAttribute(Attribute::Alignment) &&
"Attempt to exclude alignment!");
#endif
- if (AttrList == 0) return AttributeSet();
+ if (pImpl == 0) return AttributeSet();
Attribute OldAttrs = getAttributes(Idx);
AttrBuilder NewAttrs =
return *this;
SmallVector<AttributeWithIndex, 8> NewAttrList;
- ArrayRef<AttributeWithIndex> OldAttrList = AttrList->getAttributes();
+ ArrayRef<AttributeWithIndex> OldAttrList = pImpl->getAttributes();
unsigned i = 0, e = OldAttrList.size();
// Copy attributes for arguments before this one.