[clang] [DependencyScanning] Avoid repeated hash lookups (NFC) (PR #111088)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 3 19:58:37 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/111088

None

>From 5e09bfd855a7ebee4dd07dc64bcdc157e89f6aa4 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 3 Oct 2024 08:47:01 -0700
Subject: [PATCH] [DependencyScanning] Avoid repeated hash lookups (NFC)

---
 clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index 677f426590ab9e..77f9d07175c2c1 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -549,7 +549,7 @@ void ModuleDepCollectorPP::EndOfMainFile() {
     auto It = MDC.ModularDeps.find(M);
     // Only report direct dependencies that were successfully handled.
     if (It != MDC.ModularDeps.end())
-      MDC.Consumer.handleDirectModuleDependency(MDC.ModularDeps[M]->ID);
+      MDC.Consumer.handleDirectModuleDependency(It->second->ID);
   }
 
   for (auto &&I : MDC.FileDeps)



More information about the cfe-commits mailing list