[clang] Default-construct values with DenseMap::try_emplace (NFC) (#141373)

try_emplace can default-construct values, so we do not need to do so
on our own.
This commit is contained in:
Kazu Hirata 2025-05-24 14:47:18 -07:00 committed by GitHub
parent 1ecc291cd4
commit 4eb91b9a6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1201,7 +1201,7 @@ void SymbolCollector::addRef(SymbolID ID, const SymbolRef &SR) {
}
SymbolID SymbolCollector::getSymbolIDCached(const Decl *D) {
auto It = DeclToIDCache.try_emplace(D, SymbolID{});
auto It = DeclToIDCache.try_emplace(D);
if (It.second)
It.first->second = getSymbolID(D);
return It.first->second;
@ -1210,7 +1210,7 @@ SymbolID SymbolCollector::getSymbolIDCached(const Decl *D) {
SymbolID SymbolCollector::getSymbolIDCached(const llvm::StringRef MacroName,
const MacroInfo *MI,
const SourceManager &SM) {
auto It = MacroToIDCache.try_emplace(MI, SymbolID{});
auto It = MacroToIDCache.try_emplace(MI);
if (It.second)
It.first->second = getSymbolID(MacroName, MI, SM);
return It.first->second;