https://github.com/hahnjo created 
https://github.com/llvm/llvm-project/pull/214438

This also avoids copying the list of `ModuleIDs`.

>From 07dd71fb1c196c48a3472c3d1ad9fe252c39a865 Mon Sep 17 00:00:00 2001
From: Jonas Hahnfeld <[email protected]>
Date: Thu, 6 Aug 2026 11:37:14 +0200
Subject: [PATCH] [Serialization] Use range-based for loop in GlobalModuleIndex
 (NFC)

This also avoids copying the list of ModuleIDs.
---
 clang/lib/Serialization/GlobalModuleIndex.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp 
b/clang/lib/Serialization/GlobalModuleIndex.cpp
index 3f6b8e68e38f3..6d0678141fa73 100644
--- a/clang/lib/Serialization/GlobalModuleIndex.cpp
+++ b/clang/lib/Serialization/GlobalModuleIndex.cpp
@@ -318,9 +318,8 @@ bool GlobalModuleIndex::lookupIdentifier(StringRef Name, 
HitSet &Hits) {
     return false;
   }
 
-  SmallVector<unsigned, 2> ModuleIDs = *Known;
-  for (unsigned I = 0, N = ModuleIDs.size(); I != N; ++I) {
-    if (ModuleFile *MF = Modules[ModuleIDs[I]].File)
+  for (unsigned ModuleID : *Known) {
+    if (ModuleFile *MF = Modules[ModuleID].File)
       Hits.insert(MF);
   }
 

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to