Author: Kazu Hirata Date: 2024-09-21T14:01:16-07:00 New Revision: da38e1d5a962b45fd95034fc0a00f26526ec3c70
URL: https://github.com/llvm/llvm-project/commit/da38e1d5a962b45fd95034fc0a00f26526ec3c70 DIFF: https://github.com/llvm/llvm-project/commit/da38e1d5a962b45fd95034fc0a00f26526ec3c70.diff LOG: [modularize] Avoid repeated hash lookups (NFC) (#109508) Co-authored-by: Nikita Popov <git...@npopov.com> Added: Modified: clang-tools-extra/modularize/Modularize.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/modularize/Modularize.cpp b/clang-tools-extra/modularize/Modularize.cpp index f3e7dfc20b027d..2c00c76c855336 100644 --- a/clang-tools-extra/modularize/Modularize.cpp +++ b/clang-tools-extra/modularize/Modularize.cpp @@ -508,13 +508,10 @@ class EntityMap : public std::map<std::string, SmallVector<Entry, 2>> { // Sort contents. llvm::sort(H->second); - // Check whether we've seen this header before. - auto KnownH = AllHeaderContents.find(H->first); - if (KnownH == AllHeaderContents.end()) { - // We haven't seen this header before; record its contents. - AllHeaderContents.insert(*H); + // Record this header and its contents if we haven't seen it before. + auto [KnownH, Inserted] = AllHeaderContents.insert(*H); + if (Inserted) continue; - } // If the header contents are the same, we're done. if (H->second == KnownH->second) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits