[Lldb-commits] [lldb] [lldb] Remove unused DenseMapInfo::getTombstoneKey (PR #200635)
via lldb-commits
lldb-commits at lists.llvm.org
Sat May 30 22:18:59 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Fangrui Song (MaskRay)
<details>
<summary>Changes</summary>
#<!-- -->200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.
---
Full diff: https://github.com/llvm/llvm-project/pull/200635.diff
10 Files Affected:
- (modified) lldb/include/lldb/Core/Highlighter.h (-3)
- (modified) lldb/include/lldb/Host/HostThread.h (-4)
- (modified) lldb/include/lldb/Symbol/SymbolContext.h (+2-12)
- (modified) lldb/include/lldb/Utility/ConstString.h (-4)
- (modified) lldb/include/lldb/Utility/FileSpec.h (-3)
- (modified) lldb/include/lldb/Utility/UUID.h (-5)
- (modified) lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h (-1)
- (modified) lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (+3-3)
- (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (-3)
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+1-2)
``````````diff
diff --git a/lldb/include/lldb/Core/Highlighter.h b/lldb/include/lldb/Core/Highlighter.h
index ffd2418a07f46..5384309088b8d 100644
--- a/lldb/include/lldb/Core/Highlighter.h
+++ b/lldb/include/lldb/Core/Highlighter.h
@@ -159,9 +159,6 @@ template <> struct DenseMapInfo<lldb::LanguageType> {
static inline lldb::LanguageType getEmptyKey() {
return lldb::eNumLanguageTypes;
}
- static inline lldb::LanguageType getTombstoneKey() {
- return lldb::eNumLanguageTypes;
- }
static unsigned getHashValue(lldb::LanguageType language_type) {
return static_cast<unsigned>(language_type);
}
diff --git a/lldb/include/lldb/Host/HostThread.h b/lldb/include/lldb/Host/HostThread.h
index bb82c369855b2..e3c103ead1f2d 100644
--- a/lldb/include/lldb/Host/HostThread.h
+++ b/lldb/include/lldb/Host/HostThread.h
@@ -58,10 +58,6 @@ template <> struct DenseMapInfo<lldb_private::HostThread> {
return lldb_private::HostThread(
DenseMapInfo<lldb::thread_t>::getEmptyKey());
}
- static inline lldb_private::HostThread getTombstoneKey() {
- return lldb_private::HostThread(
- DenseMapInfo<lldb::thread_t>::getTombstoneKey());
- }
static unsigned getHashValue(const lldb_private::HostThread &val);
static bool isEqual(const lldb_private::HostThread &lhs,
const lldb_private::HostThread &rhs);
diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h
index f7295cdaaebc3..786ebe39b0ce8 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -523,12 +523,6 @@ template <> struct DenseMapInfo<lldb_private::SymbolContext> {
return sc;
}
- static inline lldb_private::SymbolContext getTombstoneKey() {
- lldb_private::SymbolContext sc;
- sc.function = DenseMapInfo<lldb_private::Function *>::getTombstoneKey();
- return sc;
- }
-
static unsigned getHashValue(const lldb_private::SymbolContext &sc) {
// Hash all fields EXCEPT symbol, since
// CompareConsideringPossiblyNullSymbol ignores it.
@@ -547,15 +541,11 @@ template <> struct DenseMapInfo<lldb_private::SymbolContext> {
static bool isEqual(const lldb_private::SymbolContext &lhs,
const lldb_private::SymbolContext &rhs) {
- // Check for empty/tombstone keys first, since these are invalid pointers we
+ // Check for empty keys first, since these are invalid pointers we
// don't want to accidentally dereference them in
// CompareConsideringPossiblyNullSymbol.
if (lhs.function == DenseMapInfo<lldb_private::Function *>::getEmptyKey() ||
- rhs.function == DenseMapInfo<lldb_private::Function *>::getEmptyKey() ||
- lhs.function ==
- DenseMapInfo<lldb_private::Function *>::getTombstoneKey() ||
- rhs.function ==
- DenseMapInfo<lldb_private::Function *>::getTombstoneKey())
+ rhs.function == DenseMapInfo<lldb_private::Function *>::getEmptyKey())
return lhs.function == rhs.function;
return lldb_private::SymbolContext::CompareConsideringPossiblyNullSymbol(
diff --git a/lldb/include/lldb/Utility/ConstString.h b/lldb/include/lldb/Utility/ConstString.h
index 3d85a14a7ae39..04008371d1910 100644
--- a/lldb/include/lldb/Utility/ConstString.h
+++ b/lldb/include/lldb/Utility/ConstString.h
@@ -431,10 +431,6 @@ template <> struct DenseMapInfo<lldb_private::ConstString> {
return lldb_private::ConstString::FromStringPoolPointer(
DenseMapInfo<const char *>::getEmptyKey());
}
- static inline lldb_private::ConstString getTombstoneKey() {
- return lldb_private::ConstString::FromStringPoolPointer(
- DenseMapInfo<const char *>::getTombstoneKey());
- }
static unsigned getHashValue(lldb_private::ConstString val) {
return DenseMapInfo<const char *>::getHashValue(val.m_string);
}
diff --git a/lldb/include/lldb/Utility/FileSpec.h b/lldb/include/lldb/Utility/FileSpec.h
index bc5154763b12b..56257e0dd91f1 100644
--- a/lldb/include/lldb/Utility/FileSpec.h
+++ b/lldb/include/lldb/Utility/FileSpec.h
@@ -473,9 +473,6 @@ template <> struct DenseMapInfo<lldb_private::FileSpec> {
static inline lldb_private::FileSpec getEmptyKey() {
return lldb_private::FileSpec();
}
- static inline lldb_private::FileSpec getTombstoneKey() {
- return lldb_private::FileSpec();
- }
static unsigned getHashValue(lldb_private::FileSpec file_spec) {
return llvm::hash_combine(
DenseMapInfo<lldb_private::ConstString>::getHashValue(
diff --git a/lldb/include/lldb/Utility/UUID.h b/lldb/include/lldb/Utility/UUID.h
index c64dd573d9bd0..9f449ef2a8511 100644
--- a/lldb/include/lldb/Utility/UUID.h
+++ b/lldb/include/lldb/Utility/UUID.h
@@ -124,11 +124,6 @@ template <> struct DenseMapInfo<lldb_private::UUID> {
static inline lldb_private::UUID getEmptyKey() {
return lldb_private::UUID();
}
- static inline lldb_private::UUID getTombstoneKey() {
- lldb_private::UUID key;
- key.m_bytes = {0xFF};
- return key;
- }
static unsigned getHashValue(lldb_private::UUID uuid) {
return DenseMapInfo<llvm::ArrayRef<uint8_t>>::getHashValue(uuid.GetBytes());
}
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
index 858a20f326fa7..fc19da0ac0f98 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
@@ -426,7 +426,6 @@ class ObjCLanguageRuntime : public LanguageRuntime {
/// Keys are already djbHash values, so use identity as the hash function.
struct IdentityHashKeyInfo {
static constexpr uint32_t getEmptyKey() { return ~0U; }
- static constexpr uint32_t getTombstoneKey() { return ~0U - 1; }
static unsigned getHashValue(uint32_t Val) { return Val; }
static bool isEqual(uint32_t LHS, uint32_t RHS) { return LHS == RHS; }
};
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 9fe9af84ffcbc..7dc829056a7da 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -2225,10 +2225,10 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
llvm::DenseSet<addr_t> symbols_added;
// We are using a llvm::DenseSet for "symbols_added" so we must be sure we
- // do not add the tombstone or empty keys to the set.
+ // do not add the empty key to the set.
auto add_symbol_addr = [&symbols_added](lldb::addr_t file_addr) {
- // Don't add the tombstone or empty keys.
- if (file_addr == UINT64_MAX || file_addr == UINT64_MAX - 1)
+ // Don't add the empty key.
+ if (file_addr == UINT64_MAX)
return;
symbols_added.insert(file_addr);
};
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index 921dc065ee560..1c30a349dbcb6 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -494,14 +494,11 @@ class ProcessGDBRemote : public Process,
// The invariant is that all real keys will have the file and architecture
// set.
// The empty key has an empty file and an empty arch.
- // The tombstone key has an invalid arch and an empty file.
// The comparison and hash functions take the file name and architecture
// triple into account.
struct ModuleCacheInfo {
static ModuleCacheKey getEmptyKey() { return ModuleCacheKey(); }
- static ModuleCacheKey getTombstoneKey() { return ModuleCacheKey("", "T"); }
-
static unsigned getHashValue(const ModuleCacheKey &key) {
return llvm::hash_combine(key.first, key.second);
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 2df8b6acafcdc..3b22cfcec633d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1125,8 +1125,7 @@ SymbolFileDWARF::GetTypeUnitSupportFiles(DWARFTypeUnit &tu) {
dw_offset_t offset = tu.GetLineTableOffset();
if (offset == DW_INVALID_OFFSET ||
- offset == llvm::DenseMapInfo<dw_offset_t>::getEmptyKey() ||
- offset == llvm::DenseMapInfo<dw_offset_t>::getTombstoneKey())
+ offset == llvm::DenseMapInfo<dw_offset_t>::getEmptyKey())
return nullptr;
// Many type units can share a line table, so parse the support file list
``````````
</details>
https://github.com/llvm/llvm-project/pull/200635
More information about the lldb-commits
mailing list