Skip to content

Commit b96c012

Browse files
[MC] Use range-based for loops (NFC) (#98604)
1 parent 5272762 commit b96c012

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

llvm/lib/MC/MCELFStreamer.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -699,17 +699,16 @@ void MCELFStreamer::setAttributeItems(unsigned Attribute, unsigned IntValue,
699699

700700
MCELFStreamer::AttributeItem *
701701
MCELFStreamer::getAttributeItem(unsigned Attribute) {
702-
for (size_t I = 0; I < Contents.size(); ++I)
703-
if (Contents[I].Tag == Attribute)
704-
return &Contents[I];
702+
for (AttributeItem &Item : Contents)
703+
if (Item.Tag == Attribute)
704+
return &Item;
705705
return nullptr;
706706
}
707707

708708
size_t
709709
MCELFStreamer::calculateContentSize(SmallVector<AttributeItem, 64> &AttrsVec) {
710710
size_t Result = 0;
711-
for (size_t I = 0; I < AttrsVec.size(); ++I) {
712-
AttributeItem Item = AttrsVec[I];
711+
for (const AttributeItem &Item : AttrsVec) {
713712
switch (Item.Type) {
714713
case AttributeItem::HiddenAttribute:
715714
break;
@@ -770,8 +769,7 @@ void MCELFStreamer::createAttributesSection(
770769

771770
// Size should have been accounted for already, now
772771
// emit each field as its type (ULEB or String)
773-
for (size_t I = 0; I < AttrsVec.size(); ++I) {
774-
AttributeItem Item = AttrsVec[I];
772+
for (const AttributeItem &Item : AttrsVec) {
775773
emitULEB128IntValue(Item.Tag);
776774
switch (Item.Type) {
777775
default:

0 commit comments

Comments
 (0)