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

Felipe de Azevedo Piovezan via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 14:35:40 PDT 2024


================
@@ -1808,9 +1808,9 @@ class ModuleSummaryIndex {
   /// the ThinLTO backends.
   TypeIdSummary &getOrInsertTypeIdSummary(StringRef TypeId) {
     auto TidIter = TypeIdMap.equal_range(GlobalValue::getGUID(TypeId));
-    for (auto It = TidIter.first; It != TidIter.second; ++It)
-      if (It->second.first == TypeId)
-        return It->second.second;
+    for (auto &KV : make_range(TidIter))
----------------
felipepiovezan wrote:

yeah, given how the original code is already using auto anyway, I think this is a big win because it would also allow renaming each entry of the pair with a more meaningful name

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


More information about the llvm-commits mailing list