[clang-tools-extra] c498af7 - [clang-tidy] Avoid repeated hash lookups (NFC) (#109373)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 20 07:59:11 PDT 2024
Author: Kazu Hirata
Date: 2024-09-20T07:59:08-07:00
New Revision: c498af71d73e96e95730f3b3caaea08d3edbe62c
URL: https://github.com/llvm/llvm-project/commit/c498af71d73e96e95730f3b3caaea08d3edbe62c
DIFF: https://github.com/llvm/llvm-project/commit/c498af71d73e96e95730f3b3caaea08d3edbe62c.diff
LOG: [clang-tidy] Avoid repeated hash lookups (NFC) (#109373)
Added:
Modified:
clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
index 5e2cc207560d33..fef086c5a99d86 100644
--- a/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
+++ b/clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
@@ -116,9 +116,8 @@ void ExpandModularHeadersPPCallbacks::handleModuleFile(
if (!MF)
return;
// Avoid processing a ModuleFile more than once.
- if (VisitedModules.count(MF))
+ if (!VisitedModules.insert(MF).second)
return;
- VisitedModules.insert(MF);
// Visit all the input files of this module and mark them to record their
// contents later.
More information about the cfe-commits
mailing list