[clang] [Lex] Avoid repeated hash lookups (NFC) (PR #126462)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 9 21:21:58 PST 2025


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

None

>From b976daf87b4b1e50b8aabd90fcb49afb45268083 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 9 Feb 2025 13:55:00 -0800
Subject: [PATCH] [Lex] Avoid repeated hash lookups (NFC)

---
 clang/lib/Lex/ModuleMap.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index ccf94f6345ff280..998e2b977d109ba 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -2928,9 +2928,10 @@ void ModuleMapParser::parseInferredModuleDecl(bool Framework, bool Explicit) {
     ActiveModule->InferExplicitSubmodules = Explicit;
   } else {
     // We'll be inferring framework modules for this directory.
-    Map.InferredDirectories[Directory].InferModules = true;
-    Map.InferredDirectories[Directory].Attrs = Attrs;
-    Map.InferredDirectories[Directory].ModuleMapFID = ModuleMapFID;
+    auto &InfDir = Map.InferredDirectories[Directory];
+    InfDir.InferModules = true;
+    InfDir.Attrs = Attrs;
+    InfDir.ModuleMapFID = ModuleMapFID;
     // FIXME: Handle the 'framework' keyword.
   }
 



More information about the cfe-commits mailing list