[clang] d5ef2c0 - [AST] Avoid repeated hash lookups (NFC) (#123285)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 17 08:47:18 PST 2025
Author: Kazu Hirata
Date: 2025-01-17T08:47:15-08:00
New Revision: d5ef2c054d26d0ad2ea8022060d5140f4b663801
URL: https://github.com/llvm/llvm-project/commit/d5ef2c054d26d0ad2ea8022060d5140f4b663801
DIFF: https://github.com/llvm/llvm-project/commit/d5ef2c054d26d0ad2ea8022060d5140f4b663801.diff
LOG: [AST] Avoid repeated hash lookups (NFC) (#123285)
Added:
Modified:
clang/lib/AST/VTableBuilder.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/VTableBuilder.cpp b/clang/lib/AST/VTableBuilder.cpp
index e941c3bedb0a7e..fa3055dd1206f4 100644
--- a/clang/lib/AST/VTableBuilder.cpp
+++ b/clang/lib/AST/VTableBuilder.cpp
@@ -3831,8 +3831,8 @@ const VirtualBaseInfo &MicrosoftVTableContext::computeVBTableRelatedInformation(
unsigned VBTableIndex = 1 + VBI->VBTableIndices.size();
for (const auto &VB : RD->vbases()) {
const CXXRecordDecl *CurVBase = VB.getType()->getAsCXXRecordDecl();
- if (!VBI->VBTableIndices.count(CurVBase))
- VBI->VBTableIndices[CurVBase] = VBTableIndex++;
+ if (VBI->VBTableIndices.try_emplace(CurVBase, VBTableIndex).second)
+ ++VBTableIndex;
}
return *VBI;
More information about the cfe-commits
mailing list