Skip to content

Commit da38e1d

Browse files
[modularize] Avoid repeated hash lookups (NFC) (#109508)
Co-authored-by: Nikita Popov <[email protected]>
1 parent f264d9a commit da38e1d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

clang-tools-extra/modularize/Modularize.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -508,13 +508,10 @@ class EntityMap : public std::map<std::string, SmallVector<Entry, 2>> {
508508
// Sort contents.
509509
llvm::sort(H->second);
510510

511-
// Check whether we've seen this header before.
512-
auto KnownH = AllHeaderContents.find(H->first);
513-
if (KnownH == AllHeaderContents.end()) {
514-
// We haven't seen this header before; record its contents.
515-
AllHeaderContents.insert(*H);
511+
// Record this header and its contents if we haven't seen it before.
512+
auto [KnownH, Inserted] = AllHeaderContents.insert(*H);
513+
if (Inserted)
516514
continue;
517-
}
518515

519516
// If the header contents are the same, we're done.
520517
if (H->second == KnownH->second)

0 commit comments

Comments
 (0)