[llvm] [MC] Use range-based for loops (NFC) (PR #98604)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 09:35:04 PDT 2024


================
@@ -699,17 +699,16 @@ void MCELFStreamer::setAttributeItems(unsigned Attribute, unsigned IntValue,
 
 MCELFStreamer::AttributeItem *
 MCELFStreamer::getAttributeItem(unsigned Attribute) {
-  for (size_t I = 0; I < Contents.size(); ++I)
-    if (Contents[I].Tag == Attribute)
-      return &Contents[I];
+  for (AttributeItem &Item : Contents)
----------------
dwblaikie wrote:

Could use llvm::find_if here, but might not be better - up to you.

https://github.com/llvm/llvm-project/pull/98604


More information about the llvm-commits mailing list