Skip to content

Commit 3905403

Browse files
Only hit cache once, not twice
1 parent eff9ec4 commit 3905403

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/ClangImporter/ImportName.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,9 +1781,11 @@ ImportedName NameImporter::importName(const clang::NamedDecl *decl,
17811781
ImportNameVersion version,
17821782
clang::DeclarationName givenName) {
17831783
CacheKeyType key(decl, version);
1784-
if (importNameCache.count(key) && !givenName) {
1785-
++ImportNameNumCacheHits;
1786-
return importNameCache[key];
1784+
if (!givenName) {
1785+
if (auto cachedRes = importNameCache[key]) {
1786+
++ImportNameNumCacheHits;
1787+
return cachedRes;
1788+
}
17871789
}
17881790
++ImportNameNumCacheMisses;
17891791
auto res = importNameImpl(decl, version, givenName);

0 commit comments

Comments
 (0)