summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
authorAmaury Sechet <deadalnix@gmail.com>2016-06-14 22:04:16 +0000
committerAmaury Sechet <deadalnix@gmail.com>2016-06-14 22:04:16 +0000
commit24c84fd1be63e3992ff3a017457a85b9ddacea52 (patch)
tree6cd6b8b41b0f6492fdf174c8b943d62595f6888e /llvm/lib/IR/Attributes.cpp
parent65c65ce897a3f23582a731533e9d283c1c70e508 (diff)
downloadbcm5719-llvm-24c84fd1be63e3992ff3a017457a85b9ddacea52.tar.gz
bcm5719-llvm-24c84fd1be63e3992ff3a017457a85b9ddacea52.zip
Rename AttributeSetImpl::NumAttrs and AttributeSetImpl::getNumAttributes to reflect that they work on slots rather than attributes. NFC
Summary: The current naming not only doesn't convey the meaning of what this does, but worse, it convey the wrong meaning. This was a major source of confusion understanding the code, so I'm applying the boy scout rule here and making it better after I leave. Reviewers: void, bkramer, whitequark Differential Revision: http://reviews.llvm.org/D21264 llvm-svn: 272725
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r--llvm/lib/IR/Attributes.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index 6117cdbcddf..3675bad2fb0 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -643,7 +643,7 @@ std::string AttributeSetNode::getAsString(bool InAttrGrp) const {
//===----------------------------------------------------------------------===//
uint64_t AttributeSetImpl::Raw(unsigned Index) const {
- for (unsigned I = 0, E = getNumAttributes(); I != E; ++I) {
+ for (unsigned I = 0, E = getNumSlots(); I != E; ++I) {
if (getSlotIndex(I) != Index) continue;
const AttributeSetNode *ASN = getSlotNode(I);
uint64_t Mask = 0;
@@ -814,7 +814,7 @@ AttributeSet AttributeSet::get(LLVMContext &C, ArrayRef<AttributeSet> Attrs) {
SmallVector<std::pair<unsigned, AttributeSetNode*>, 8> AttrNodeVec;
AttributeSetImpl *A0 = Attrs[0].pImpl;
if (A0)
- AttrNodeVec.append(A0->getNode(0), A0->getNode(A0->getNumAttributes()));
+ AttrNodeVec.append(A0->getNode(0), A0->getNode(A0->getNumSlots()));
// Copy all attributes from Attrs into AttrNodeVec while keeping AttrNodeVec
// ordered by index. Because we know that each list in Attrs is ordered by
// index we only need to merge each successive list in rather than doing a
@@ -825,7 +825,7 @@ AttributeSet AttributeSet::get(LLVMContext &C, ArrayRef<AttributeSet> Attrs) {
SmallVector<std::pair<unsigned, AttributeSetNode *>, 8>::iterator
ANVI = AttrNodeVec.begin(), ANVE;
for (const IndexAttrPair *AI = AS->getNode(0),
- *AE = AS->getNode(AS->getNumAttributes());
+ *AE = AS->getNode(AS->getNumSlots());
AI != AE; ++AI) {
ANVE = AttrNodeVec.end();
while (ANVI != ANVE && ANVI->first <= AI->first)
@@ -853,7 +853,7 @@ AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Index,
AttributeSet AttributeSet::addAttribute(LLVMContext &C,
ArrayRef<unsigned> Indices,
Attribute A) const {
- unsigned I = 0, E = pImpl ? pImpl->getNumAttributes() : 0;
+ unsigned I = 0, E = pImpl ? pImpl->getNumSlots() : 0;
auto IdxI = Indices.begin(), IdxE = Indices.end();
SmallVector<AttributeSet, 4> AttrSet;
@@ -896,7 +896,7 @@ AttributeSet AttributeSet::addAttributes(LLVMContext &C, unsigned Index,
// Add the attribute slots before the one we're trying to add.
SmallVector<AttributeSet, 4> AttrSet;
- uint64_t NumAttrs = pImpl->getNumAttributes();
+ uint64_t NumAttrs = pImpl->getNumSlots();
AttributeSet AS;
uint64_t LastIndex = 0;
for (unsigned I = 0, E = NumAttrs; I != E; ++I) {
@@ -912,7 +912,7 @@ AttributeSet AttributeSet::addAttributes(LLVMContext &C, unsigned Index,
// AttributeSet there.
AttrBuilder B(AS, Index);
- for (unsigned I = 0, E = Attrs.pImpl->getNumAttributes(); I != E; ++I)
+ for (unsigned I = 0, E = Attrs.pImpl->getNumSlots(); I != E; ++I)
if (Attrs.getSlotIndex(I) == Index) {
for (AttributeSetImpl::iterator II = Attrs.pImpl->begin(I),
IE = Attrs.pImpl->end(I); II != IE; ++II)
@@ -947,7 +947,7 @@ AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index,
// Add the attribute slots before the one we're trying to add.
SmallVector<AttributeSet, 4> AttrSet;
- uint64_t NumAttrs = pImpl->getNumAttributes();
+ uint64_t NumAttrs = pImpl->getNumSlots();
AttributeSet AS;
uint64_t LastIndex = 0;
for (unsigned I = 0, E = NumAttrs; I != E; ++I) {
@@ -963,7 +963,7 @@ AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index,
// AttributeSet there.
AttrBuilder B(AS, Index);
- for (unsigned I = 0, E = Attrs.pImpl->getNumAttributes(); I != E; ++I)
+ for (unsigned I = 0, E = Attrs.pImpl->getNumSlots(); I != E; ++I)
if (Attrs.getSlotIndex(I) == Index) {
B.removeAttributes(Attrs.pImpl->getSlotAttributes(I), Index);
break;
@@ -988,7 +988,7 @@ AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index,
// Add the attribute slots before the one we're trying to add.
SmallVector<AttributeSet, 4> AttrSet;
- uint64_t NumAttrs = pImpl->getNumAttributes();
+ uint64_t NumAttrs = pImpl->getNumSlots();
AttributeSet AS;
uint64_t LastIndex = 0;
for (unsigned I = 0, E = NumAttrs; I != E; ++I) {
@@ -1094,7 +1094,7 @@ bool AttributeSet::hasFnAttribute(Attribute::AttrKind Kind) const {
bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr) const {
if (!pImpl) return false;
- for (unsigned I = 0, E = pImpl->getNumAttributes(); I != E; ++I)
+ for (unsigned I = 0, E = pImpl->getNumSlots(); I != E; ++I)
for (AttributeSetImpl::iterator II = pImpl->begin(I),
IE = pImpl->end(I); II != IE; ++II)
if (II->hasAttribute(Attr))
@@ -1150,7 +1150,7 @@ AttributeSetNode *AttributeSet::getAttributes(unsigned Index) const {
if (!pImpl) return nullptr;
// Loop through to find the attribute node we want.
- for (unsigned I = 0, E = pImpl->getNumAttributes(); I != E; ++I)
+ for (unsigned I = 0, E = pImpl->getNumSlots(); I != E; ++I)
if (pImpl->getSlotIndex(I) == Index)
return pImpl->getSlotNode(I);
@@ -1174,17 +1174,17 @@ AttributeSet::iterator AttributeSet::end(unsigned Slot) const {
//===----------------------------------------------------------------------===//
unsigned AttributeSet::getNumSlots() const {
- return pImpl ? pImpl->getNumAttributes() : 0;
+ return pImpl ? pImpl->getNumSlots() : 0;
}
unsigned AttributeSet::getSlotIndex(unsigned Slot) const {
- assert(pImpl && Slot < pImpl->getNumAttributes() &&
+ assert(pImpl && Slot < pImpl->getNumSlots() &&
"Slot # out of range!");
return pImpl->getSlotIndex(Slot);
}
AttributeSet AttributeSet::getSlotAttributes(unsigned Slot) const {
- assert(pImpl && Slot < pImpl->getNumAttributes() &&
+ assert(pImpl && Slot < pImpl->getNumSlots() &&
"Slot # out of range!");
return pImpl->getSlotAttributes(Slot);
}
@@ -1220,7 +1220,7 @@ AttrBuilder::AttrBuilder(AttributeSet AS, unsigned Index)
AttributeSetImpl *pImpl = AS.pImpl;
if (!pImpl) return;
- for (unsigned I = 0, E = pImpl->getNumAttributes(); I != E; ++I) {
+ for (unsigned I = 0, E = pImpl->getNumSlots(); I != E; ++I) {
if (pImpl->getSlotIndex(I) != Index) continue;
for (AttributeSetImpl::iterator II = pImpl->begin(I),
OpenPOWER on IntegriCloud