Skip to content

Commit 2a4c484

Browse files
[Support] Avoid repeated hash lookups (NFC) (llvm#123503)
1 parent 24892b8 commit 2a4c484

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Support/VirtualFileSystem.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,11 +1708,12 @@ class llvm::vfs::RedirectingFileSystemParser {
17081708
// false on error
17091709
bool checkDuplicateOrUnknownKey(yaml::Node *KeyNode, StringRef Key,
17101710
DenseMap<StringRef, KeyStatus> &Keys) {
1711-
if (!Keys.count(Key)) {
1711+
auto It = Keys.find(Key);
1712+
if (It == Keys.end()) {
17121713
error(KeyNode, "unknown key");
17131714
return false;
17141715
}
1715-
KeyStatus &S = Keys[Key];
1716+
KeyStatus &S = It->second;
17161717
if (S.Seen) {
17171718
error(KeyNode, Twine("duplicate key '") + Key + "'");
17181719
return false;

0 commit comments

Comments
 (0)