https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/200634
#200595 changed DenseMap to no longer create tombstone buckets, so DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead definitions and dead tombstone branches. >From 508817e91a252899cfc34c939f497af9ea4e9b27 Mon Sep 17 00:00:00 2001 From: Fangrui Song <[email protected]> Date: Sat, 30 May 2026 22:11:46 -0700 Subject: [PATCH] [clang][clang-tools-extra] Remove unused DenseMapInfo::getTombstoneKey #200595 changed DenseMap to no longer create tombstone buckets, so DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead definitions and dead tombstone branches. --- .../SpecialMemberFunctionsCheck.h | 8 ------- .../utils/RenamerClangTidyCheck.cpp | 8 ------- clang-tools-extra/clangd/Config.h | 3 --- clang-tools-extra/clangd/Headers.h | 4 ---- clang-tools-extra/clangd/Protocol.h | 5 ---- .../clangd/SystemIncludeExtractor.cpp | 5 ---- clang-tools-extra/clangd/index/Ref.h | 4 ---- clang-tools-extra/clangd/index/SymbolID.h | 4 ---- clang-tools-extra/clangd/index/dex/Token.h | 4 ---- clang-tools-extra/clangd/index/dex/Trigram.h | 5 +--- .../include/clang-include-cleaner/Types.h | 7 ------ clang/include/clang/AST/APValue.h | 1 - clang/include/clang/AST/ASTContext.h | 11 --------- clang/include/clang/AST/ASTTypeTraits.h | 13 ---------- clang/include/clang/AST/BaseSubobject.h | 6 ----- clang/include/clang/AST/CharUnits.h | 7 ------ clang/include/clang/AST/DeclID.h | 8 ------- clang/include/clang/AST/DeclarationName.h | 10 -------- clang/include/clang/AST/GlobalDecl.h | 5 ---- clang/include/clang/AST/NestedNameSpecifier.h | 9 ------- clang/include/clang/AST/Redeclarable.h | 6 ----- clang/include/clang/AST/TypeOrdering.h | 10 -------- .../Analysis/Analyses/LifetimeSafety/Utils.h | 4 ---- clang/include/clang/Analysis/CallGraph.h | 6 ----- .../FlowSensitive/DataflowAnalysisContext.h | 1 - .../clang/Analysis/FlowSensitive/Formula.h | 1 - clang/include/clang/Analysis/ProgramPoint.h | 7 ------ .../clang/Analysis/RetainSummaryManager.h | 5 ---- clang/include/clang/Basic/DirectoryEntry.h | 15 +++--------- clang/include/clang/Basic/FileEntry.h | 14 +++-------- clang/include/clang/Basic/IdentifierTable.h | 8 ------- clang/include/clang/Basic/Module.h | 4 ---- clang/include/clang/Basic/SourceLocation.h | 13 ---------- clang/include/clang/Basic/TokenKinds.h | 3 --- .../DependencyScanning/DependencyGraph.h | 3 --- clang/include/clang/Sema/ScopeInfo.h | 4 ---- clang/include/clang/Sema/SemaCUDA.h | 4 ---- clang/include/clang/Sema/Weak.h | 3 --- .../include/clang/Serialization/ASTBitCodes.h | 8 ------- .../Tooling/Inclusions/StandardLibrary.h | 8 ------- clang/lib/APINotes/APINotesFormat.h | 18 -------------- clang/lib/AST/APValue.cpp | 7 ------ clang/lib/AST/ExprConstant.cpp | 3 --- clang/lib/AST/ItaniumCXXABI.cpp | 15 +----------- clang/lib/CodeGen/CGDebugInfo.cpp | 2 +- .../CodeGen/CGObjCMacConstantLiteralUtil.h | 24 +++++-------------- clang/lib/CodeGen/CodeGenTBAA.h | 10 -------- clang/lib/Sema/SemaStmt.cpp | 7 +----- clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 5 ---- .../ClangLinkerWrapper.cpp | 3 --- clang/tools/libclang/CXCursor.cpp | 3 --- clang/tools/libclang/Indexing.cpp | 3 --- 52 files changed, 16 insertions(+), 338 deletions(-) diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h index ecf43468eea20..e3ed12de4fd3e 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h @@ -87,14 +87,8 @@ struct DenseMapInfo< return {DenseMapInfo<clang::SourceLocation>::getEmptyKey(), "EMPTY"}; } - static ClassDefId getTombstoneKey() { - return {DenseMapInfo<clang::SourceLocation>::getTombstoneKey(), - "TOMBSTONE"}; - } - static unsigned getHashValue(const ClassDefId &Val) { assert(Val != getEmptyKey() && "Cannot hash the empty key!"); - assert(Val != getTombstoneKey() && "Cannot hash the tombstone key!"); const std::hash<ClassDefId::second_type> SecondHash; return Val.first.getHashValue() + SecondHash(Val.second); @@ -103,8 +97,6 @@ struct DenseMapInfo< static bool isEqual(const ClassDefId &LHS, const ClassDefId &RHS) { if (RHS == getEmptyKey()) return LHS == getEmptyKey(); - if (RHS == getTombstoneKey()) - return LHS == getTombstoneKey(); return LHS == RHS; } }; diff --git a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp index 0e4a6f49116da..c4b800d2c9e19 100644 --- a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp +++ b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp @@ -34,14 +34,8 @@ struct DenseMapInfo<clang::tidy::RenamerClangTidyCheck::NamingCheckId> { return {DenseMapInfo<clang::SourceLocation>::getEmptyKey(), "EMPTY"}; } - static NamingCheckId getTombstoneKey() { - return {DenseMapInfo<clang::SourceLocation>::getTombstoneKey(), - "TOMBSTONE"}; - } - static unsigned getHashValue(NamingCheckId Val) { assert(Val != getEmptyKey() && "Cannot hash the empty key!"); - assert(Val != getTombstoneKey() && "Cannot hash the tombstone key!"); return DenseMapInfo<clang::SourceLocation>::getHashValue(Val.first) + DenseMapInfo<StringRef>::getHashValue(Val.second); @@ -50,8 +44,6 @@ struct DenseMapInfo<clang::tidy::RenamerClangTidyCheck::NamingCheckId> { static bool isEqual(const NamingCheckId &LHS, const NamingCheckId &RHS) { if (RHS == getEmptyKey()) return LHS == getEmptyKey(); - if (RHS == getTombstoneKey()) - return LHS == getTombstoneKey(); return LHS == RHS; } }; diff --git a/clang-tools-extra/clangd/Config.h b/clang-tools-extra/clangd/Config.h index 56d7ac453deeb..450ca6ea93ddc 100644 --- a/clang-tools-extra/clangd/Config.h +++ b/clang-tools-extra/clangd/Config.h @@ -232,9 +232,6 @@ template <> struct DenseMapInfo<clang::clangd::Config::ExternalIndexSpec> { static inline ExternalIndexSpec getEmptyKey() { return {ExternalIndexSpec::File, "", ""}; } - static inline ExternalIndexSpec getTombstoneKey() { - return {ExternalIndexSpec::File, "TOMB", "STONE"}; - } static unsigned getHashValue(const ExternalIndexSpec &Val) { return llvm::hash_combine(Val.Kind, Val.Location, Val.MountPoint); } diff --git a/clang-tools-extra/clangd/Headers.h b/clang-tools-extra/clangd/Headers.h index b91179da253e9..05536529b22b9 100644 --- a/clang-tools-extra/clangd/Headers.h +++ b/clang-tools-extra/clangd/Headers.h @@ -277,10 +277,6 @@ template <> struct DenseMapInfo<clang::clangd::IncludeStructure::HeaderID> { return static_cast<clang::clangd::IncludeStructure::HeaderID>(-1); } - static inline clang::clangd::IncludeStructure::HeaderID getTombstoneKey() { - return static_cast<clang::clangd::IncludeStructure::HeaderID>(-2); - } - static unsigned getHashValue(const clang::clangd::IncludeStructure::HeaderID &Tag) { return hash_value(static_cast<unsigned>(Tag)); diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h index 9c1bb9d9bb059..67aea52ef43d4 100644 --- a/clang-tools-extra/clangd/Protocol.h +++ b/clang-tools-extra/clangd/Protocol.h @@ -2113,11 +2113,6 @@ template <> struct DenseMapInfo<clang::clangd::Range> { static Range R{Tomb, Tomb}; return R; } - static inline Range getTombstoneKey() { - static clang::clangd::Position Tomb{-2, -2}; - static Range R{Tomb, Tomb}; - return R; - } static unsigned getHashValue(const Range &Val) { return llvm::hash_combine(Val.start.line, Val.start.character, Val.end.line, Val.end.character); diff --git a/clang-tools-extra/clangd/SystemIncludeExtractor.cpp b/clang-tools-extra/clangd/SystemIncludeExtractor.cpp index e781f355aa3e1..8809426f8130a 100644 --- a/clang-tools-extra/clangd/SystemIncludeExtractor.cpp +++ b/clang-tools-extra/clangd/SystemIncludeExtractor.cpp @@ -222,11 +222,6 @@ template <> struct DenseMapInfo<DriverArgs> { Driver.Driver = "EMPTY_KEY"; return Driver; } - static DriverArgs getTombstoneKey() { - auto Driver = DriverArgs::getEmpty(); - Driver.Driver = "TOMBSTONE_KEY"; - return Driver; - } static unsigned getHashValue(const DriverArgs &Val) { unsigned FixedFieldsHash = llvm::hash_value(std::tuple{ Val.Driver, diff --git a/clang-tools-extra/clangd/index/Ref.h b/clang-tools-extra/clangd/index/Ref.h index 1241cb8361384..aa7c88443e909 100644 --- a/clang-tools-extra/clangd/index/Ref.h +++ b/clang-tools-extra/clangd/index/Ref.h @@ -175,10 +175,6 @@ template <> struct DenseMapInfo<clang::clangd::RefSlab::Builder::Entry> { static Entry E{clang::clangd::SymbolID(""), {}}; return E; } - static inline Entry getTombstoneKey() { - static Entry E{clang::clangd::SymbolID("TOMBSTONE"), {}}; - return E; - } static unsigned getHashValue(const Entry &Val) { return llvm::hash_combine( Val.Symbol, reinterpret_cast<uintptr_t>(Val.Reference.Location.FileURI), diff --git a/clang-tools-extra/clangd/index/SymbolID.h b/clang-tools-extra/clangd/index/SymbolID.h index e8aa462e96c17..929004aa70a25 100644 --- a/clang-tools-extra/clangd/index/SymbolID.h +++ b/clang-tools-extra/clangd/index/SymbolID.h @@ -85,10 +85,6 @@ template <> struct DenseMapInfo<clang::clangd::SymbolID> { static clang::clangd::SymbolID EmptyKey("EMPTYKEY"); return EmptyKey; } - static inline clang::clangd::SymbolID getTombstoneKey() { - static clang::clangd::SymbolID TombstoneKey("TOMBSTONEKEY"); - return TombstoneKey; - } static unsigned getHashValue(const clang::clangd::SymbolID &Sym) { return hash_value(Sym); } diff --git a/clang-tools-extra/clangd/index/dex/Token.h b/clang-tools-extra/clangd/index/dex/Token.h index c1ff0ad978a8d..f69d8f1f117ef 100644 --- a/clang-tools-extra/clangd/index/dex/Token.h +++ b/clang-tools-extra/clangd/index/dex/Token.h @@ -119,10 +119,6 @@ template <> struct DenseMapInfo<clang::clangd::dex::Token> { return {clang::clangd::dex::Token::Kind::Sentinel, "EmptyKey"}; } - static inline clang::clangd::dex::Token getTombstoneKey() { - return {clang::clangd::dex::Token::Kind::Sentinel, "TombstoneKey"}; - } - static unsigned getHashValue(const clang::clangd::dex::Token &Tag) { return hash_value(Tag); } diff --git a/clang-tools-extra/clangd/index/dex/Trigram.h b/clang-tools-extra/clangd/index/dex/Trigram.h index 3fe975e76fe88..f523404cd82e0 100644 --- a/clang-tools-extra/clangd/index/dex/Trigram.h +++ b/clang-tools-extra/clangd/index/dex/Trigram.h @@ -38,7 +38,7 @@ namespace dex { class Trigram { std::array<char, 4> Data; // Last element is length. // Steal some invalid bit patterns for DenseMap sentinels. - enum class Sentinel { Tombstone = 4, Empty = 5 }; + enum class Sentinel { Empty = 5 }; Trigram(Sentinel S) : Data{0, 0, 0, static_cast<char>(S)} {} uint32_t id() const { return llvm::bit_cast<uint32_t>(Data); } @@ -93,9 +93,6 @@ template <> struct DenseMapInfo<clang::clangd::dex::Trigram> { static inline Trigram getEmptyKey() { return Trigram(Trigram::Sentinel::Empty); } - static inline Trigram getTombstoneKey() { - return Trigram(Trigram::Sentinel::Tombstone); - } static unsigned getHashValue(Trigram V) { // Finalize step from MurmurHash3. uint32_t X = V.id(); diff --git a/clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h b/clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h index 660d8eb227cca..99d65266bf53d 100644 --- a/clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h +++ b/clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h @@ -222,9 +222,6 @@ template <> struct DenseMapInfo<clang::include_cleaner::Symbol> { static Outer getEmptyKey() { return {Outer::SentinelTag{}, Base::getEmptyKey()}; } - static Outer getTombstoneKey() { - return {Outer::SentinelTag{}, Base::getTombstoneKey()}; - } static unsigned getHashValue(const Outer &Val) { return Base::getHashValue(Val.Storage); } @@ -237,7 +234,6 @@ template <> struct DenseMapInfo<clang::include_cleaner::Macro> { using Base = DenseMapInfo<decltype(Outer::Definition)>; static Outer getEmptyKey() { return {nullptr, Base::getEmptyKey()}; } - static Outer getTombstoneKey() { return {nullptr, Base::getTombstoneKey()}; } static unsigned getHashValue(const Outer &Val) { return Base::getHashValue(Val.Definition); } @@ -252,9 +248,6 @@ template <> struct DenseMapInfo<clang::include_cleaner::Header> { static Outer getEmptyKey() { return {Outer::SentinelTag{}, Base::getEmptyKey()}; } - static Outer getTombstoneKey() { - return {Outer::SentinelTag{}, Base::getTombstoneKey()}; - } static unsigned getHashValue(const Outer &Val) { return Base::getHashValue(Val.Storage); } diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h index 3961e4e7fdfe0..22f0ad18caee4 100644 --- a/clang/include/clang/AST/APValue.h +++ b/clang/include/clang/AST/APValue.h @@ -839,7 +839,6 @@ class APValue { namespace llvm { template<> struct DenseMapInfo<clang::APValue::LValueBase> { static clang::APValue::LValueBase getEmptyKey(); - static clang::APValue::LValueBase getTombstoneKey(); static unsigned getHashValue(const clang::APValue::LValueBase &Base); static bool isEqual(const clang::APValue::LValueBase &LHS, const clang::APValue::LValueBase &RHS); diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index c952b8d46974c..134e1f1422e52 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -73,9 +73,6 @@ template <> struct DenseMapInfo<ScalableVecTyKey> { static inline ScalableVecTyKey getEmptyKey() { return {DenseMapInfo<clang::QualType>::getEmptyKey(), ~0U, ~0U}; } - static inline ScalableVecTyKey getTombstoneKey() { - return {DenseMapInfo<clang::QualType>::getTombstoneKey(), ~0U, ~0U}; - } static unsigned getHashValue(const ScalableVecTyKey &Val) { return hash_combine(DenseMapInfo<clang::QualType>::getHashValue(Val.EltTy), Val.NumElts, Val.NumFields); @@ -4009,14 +4006,6 @@ typename clang::LazyGenerationalUpdatePtr<Owner, T, Update>::ValueType template <> struct llvm::DenseMapInfo<llvm::FoldingSetNodeID> { static FoldingSetNodeID getEmptyKey() { return FoldingSetNodeID{}; } - static FoldingSetNodeID getTombstoneKey() { - FoldingSetNodeID ID; - for (size_t I = 0; I < sizeof(ID) / sizeof(unsigned); ++I) { - ID.AddInteger(std::numeric_limits<unsigned>::max()); - } - return ID; - } - static unsigned getHashValue(const FoldingSetNodeID &Val) { return Val.ComputeHash(); } diff --git a/clang/include/clang/AST/ASTTypeTraits.h b/clang/include/clang/AST/ASTTypeTraits.h index e0925551ef1a2..e8a18725645c0 100644 --- a/clang/include/clang/AST/ASTTypeTraits.h +++ b/clang/include/clang/AST/ASTTypeTraits.h @@ -110,11 +110,6 @@ class ASTNodeKind { struct DenseMapInfo { // ASTNodeKind() is a good empty key because it is represented as a 0. static inline ASTNodeKind getEmptyKey() { return ASTNodeKind(); } - // NKI_NumberOfKinds is not a valid value, so it is good for a - // tombstone key. - static inline ASTNodeKind getTombstoneKey() { - return ASTNodeKind(NKI_NumberOfKinds); - } static unsigned getHashValue(const ASTNodeKind &Val) { return Val.KindId; } static bool isEqual(const ASTNodeKind &LHS, const ASTNodeKind &RHS) { return LHS.KindId == RHS.KindId; @@ -379,11 +374,6 @@ class DynTypedNode { Node.NodeKind = ASTNodeKind::DenseMapInfo::getEmptyKey(); return Node; } - static inline DynTypedNode getTombstoneKey() { - DynTypedNode Node; - Node.NodeKind = ASTNodeKind::DenseMapInfo::getTombstoneKey(); - return Node; - } static unsigned getHashValue(const DynTypedNode &Val) { // FIXME: Add hashing support for the remaining types. if (ASTNodeKind::getFromNodeKind<TypeLoc>().isBaseOf(Val.NodeKind)) { @@ -405,11 +395,8 @@ class DynTypedNode { } static bool isEqual(const DynTypedNode &LHS, const DynTypedNode &RHS) { auto Empty = ASTNodeKind::DenseMapInfo::getEmptyKey(); - auto TombStone = ASTNodeKind::DenseMapInfo::getTombstoneKey(); return (ASTNodeKind::DenseMapInfo::isEqual(LHS.NodeKind, Empty) && ASTNodeKind::DenseMapInfo::isEqual(RHS.NodeKind, Empty)) || - (ASTNodeKind::DenseMapInfo::isEqual(LHS.NodeKind, TombStone) && - ASTNodeKind::DenseMapInfo::isEqual(RHS.NodeKind, TombStone)) || LHS == RHS; } }; diff --git a/clang/include/clang/AST/BaseSubobject.h b/clang/include/clang/AST/BaseSubobject.h index 15600f02fcefb..f98c323a0b110 100644 --- a/clang/include/clang/AST/BaseSubobject.h +++ b/clang/include/clang/AST/BaseSubobject.h @@ -61,12 +61,6 @@ template<> struct DenseMapInfo<clang::BaseSubobject> { clang::CharUnits::fromQuantity(DenseMapInfo<int64_t>::getEmptyKey())); } - static clang::BaseSubobject getTombstoneKey() { - return clang::BaseSubobject( - DenseMapInfo<const clang::CXXRecordDecl *>::getTombstoneKey(), - clang::CharUnits::fromQuantity(DenseMapInfo<int64_t>::getTombstoneKey())); - } - static unsigned getHashValue(const clang::BaseSubobject &Base) { using PairTy = std::pair<const clang::CXXRecordDecl *, clang::CharUnits>; diff --git a/clang/include/clang/AST/CharUnits.h b/clang/include/clang/AST/CharUnits.h index e570bfae69524..e6e6b93e0c192 100644 --- a/clang/include/clang/AST/CharUnits.h +++ b/clang/include/clang/AST/CharUnits.h @@ -237,13 +237,6 @@ template<> struct DenseMapInfo<clang::CharUnits> { return clang::CharUnits::fromQuantity(Quantity); } - static clang::CharUnits getTombstoneKey() { - clang::CharUnits::QuantityType Quantity = - DenseMapInfo<clang::CharUnits::QuantityType>::getTombstoneKey(); - - return clang::CharUnits::fromQuantity(Quantity); - } - static unsigned getHashValue(const clang::CharUnits &CU) { clang::CharUnits::QuantityType Quantity = CU.getQuantity(); return DenseMapInfo<clang::CharUnits::QuantityType>::getHashValue(Quantity); diff --git a/clang/include/clang/AST/DeclID.h b/clang/include/clang/AST/DeclID.h index 47ae05b2747ae..8a173e3d96349 100644 --- a/clang/include/clang/AST/DeclID.h +++ b/clang/include/clang/AST/DeclID.h @@ -252,10 +252,6 @@ template <> struct DenseMapInfo<clang::GlobalDeclID> { return GlobalDeclID(DenseMapInfo<DeclID>::getEmptyKey()); } - static GlobalDeclID getTombstoneKey() { - return GlobalDeclID(DenseMapInfo<DeclID>::getTombstoneKey()); - } - static unsigned getHashValue(const GlobalDeclID &Key) { return DenseMapInfo<DeclID>::getHashValue(Key.getRawValue()); } @@ -273,10 +269,6 @@ template <> struct DenseMapInfo<clang::LocalDeclID> { return LocalDeclID(DenseMapInfo<DeclID>::getEmptyKey()); } - static LocalDeclID getTombstoneKey() { - return LocalDeclID(DenseMapInfo<DeclID>::getTombstoneKey()); - } - static unsigned getHashValue(const LocalDeclID &Key) { return DenseMapInfo<DeclID>::getHashValue(Key.getRawValue()); } diff --git a/clang/include/clang/AST/DeclarationName.h b/clang/include/clang/AST/DeclarationName.h index 56d66e1b5e110..2cd7efcae5088 100644 --- a/clang/include/clang/AST/DeclarationName.h +++ b/clang/include/clang/AST/DeclarationName.h @@ -558,12 +558,6 @@ class DeclarationName { return Name; } - static DeclarationName getTombstoneMarker() { - DeclarationName Name; - Name.Ptr = uintptr_t(-2); - return Name; - } - static int compare(DeclarationName LHS, DeclarationName RHS); void print(raw_ostream &OS, const PrintingPolicy &Policy) const; @@ -934,10 +928,6 @@ struct DenseMapInfo<clang::DeclarationName> { return clang::DeclarationName::getEmptyMarker(); } - static inline clang::DeclarationName getTombstoneKey() { - return clang::DeclarationName::getTombstoneMarker(); - } - static unsigned getHashValue(clang::DeclarationName Name) { return DenseMapInfo<void*>::getHashValue(Name.getAsOpaquePtr()); } diff --git a/clang/include/clang/AST/GlobalDecl.h b/clang/include/clang/AST/GlobalDecl.h index 97caff0198cb0..b9a06afc271ca 100644 --- a/clang/include/clang/AST/GlobalDecl.h +++ b/clang/include/clang/AST/GlobalDecl.h @@ -219,11 +219,6 @@ namespace llvm { return clang::GlobalDecl(); } - static inline clang::GlobalDecl getTombstoneKey() { - return clang::GlobalDecl:: - getFromOpaquePtr(reinterpret_cast<void*>(-1)); - } - static unsigned getHashValue(clang::GlobalDecl GD) { return DenseMapInfo<void*>::getHashValue(GD.getAsOpaquePtr()); } diff --git a/clang/include/clang/AST/NestedNameSpecifier.h b/clang/include/clang/AST/NestedNameSpecifier.h index f198a8bca9078..ac1439c70ce7b 100644 --- a/clang/include/clang/AST/NestedNameSpecifier.h +++ b/clang/include/clang/AST/NestedNameSpecifier.h @@ -255,10 +255,6 @@ namespace llvm { template <> struct DenseMapInfo<clang::NestedNameSpecifier> { static clang::NestedNameSpecifier getEmptyKey() { return std::nullopt; } - static clang::NestedNameSpecifier getTombstoneKey() { - return clang::NestedNameSpecifier::getInvalid(); - } - static unsigned getHashValue(const clang::NestedNameSpecifier &V) { return hash_combine(V.getAsVoidPointer()); } @@ -273,11 +269,6 @@ template <> struct DenseMapInfo<clang::NestedNameSpecifierLoc> { SecondInfo::getEmptyKey()); } - static clang::NestedNameSpecifierLoc getTombstoneKey() { - return clang::NestedNameSpecifierLoc(FirstInfo::getTombstoneKey(), - SecondInfo::getTombstoneKey()); - } - static unsigned getHashValue(const clang::NestedNameSpecifierLoc &PairVal) { return hash_combine( FirstInfo::getHashValue(PairVal.getNestedNameSpecifier()), diff --git a/clang/include/clang/AST/Redeclarable.h b/clang/include/clang/AST/Redeclarable.h index 68516c66aaf65..6a3f485a5f5da 100644 --- a/clang/include/clang/AST/Redeclarable.h +++ b/clang/include/clang/AST/Redeclarable.h @@ -391,12 +391,6 @@ struct DenseMapInfo<clang::CanonicalDeclPtr<decl_type>> { return P; } - static CanonicalDeclPtr getTombstoneKey() { - CanonicalDeclPtr P; - P.Ptr = BaseInfo::getTombstoneKey(); - return P; - } - static unsigned getHashValue(const CanonicalDeclPtr &P) { return BaseInfo::getHashValue(P); } diff --git a/clang/include/clang/AST/TypeOrdering.h b/clang/include/clang/AST/TypeOrdering.h index 8037f98cc9651..0626cb97217f2 100644 --- a/clang/include/clang/AST/TypeOrdering.h +++ b/clang/include/clang/AST/TypeOrdering.h @@ -38,11 +38,6 @@ namespace llvm { template<> struct DenseMapInfo<clang::QualType> { static inline clang::QualType getEmptyKey() { return clang::QualType(); } - static inline clang::QualType getTombstoneKey() { - using clang::QualType; - return QualType::getFromOpaquePtr(reinterpret_cast<clang::Type *>(-1)); - } - static unsigned getHashValue(clang::QualType Val) { return (unsigned)((uintptr_t)Val.getAsOpaquePtr()) ^ ((unsigned)((uintptr_t)Val.getAsOpaquePtr() >> 9)); @@ -58,11 +53,6 @@ namespace llvm { return clang::CanQualType(); } - static inline clang::CanQualType getTombstoneKey() { - using clang::CanQualType; - return CanQualType::getFromOpaquePtr(reinterpret_cast<clang::Type *>(-1)); - } - static unsigned getHashValue(clang::CanQualType Val) { return (unsigned)((uintptr_t)Val.getAsOpaquePtr()) ^ ((unsigned)((uintptr_t)Val.getAsOpaquePtr() >> 9)); diff --git a/clang/include/clang/Analysis/Analyses/LifetimeSafety/Utils.h b/clang/include/clang/Analysis/Analyses/LifetimeSafety/Utils.h index 4183cabe860a7..0a89de4dcfeb1 100644 --- a/clang/include/clang/Analysis/Analyses/LifetimeSafety/Utils.h +++ b/clang/include/clang/Analysis/Analyses/LifetimeSafety/Utils.h @@ -103,10 +103,6 @@ struct DenseMapInfo<clang::lifetimes::internal::utils::ID<Tag>> { return {DenseMapInfo<uint32_t>::getEmptyKey()}; } - static inline ID getTombstoneKey() { - return {DenseMapInfo<uint32_t>::getTombstoneKey()}; - } - static unsigned getHashValue(const ID &Val) { return DenseMapInfo<uint32_t>::getHashValue(Val.Value); } diff --git a/clang/include/clang/Analysis/CallGraph.h b/clang/include/clang/Analysis/CallGraph.h index f1c0d7a88643a..4c4b940ef110a 100644 --- a/clang/include/clang/Analysis/CallGraph.h +++ b/clang/include/clang/Analysis/CallGraph.h @@ -220,12 +220,6 @@ template <> struct DenseMapInfo<clang::CallGraphNode::CallRecord> { DenseMapInfo<clang::Expr *>::getEmptyKey()); } - static inline clang::CallGraphNode::CallRecord getTombstoneKey() { - return clang::CallGraphNode::CallRecord( - DenseMapInfo<clang::CallGraphNode *>::getTombstoneKey(), - DenseMapInfo<clang::Expr *>::getTombstoneKey()); - } - static unsigned getHashValue(const clang::CallGraphNode::CallRecord &Val) { // NOTE: we are comparing based on the callee only. // Different call records with the same callee will compare equal! diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h index 4b6306eb21dc3..3d51a07599fd4 100644 --- a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h +++ b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h @@ -248,7 +248,6 @@ class DataflowAnalysisContext { } using DenseMapInfo::getHashValue; - using DenseMapInfo::getTombstoneKey; using DenseMapInfo::isEqual; }; diff --git a/clang/include/clang/Analysis/FlowSensitive/Formula.h b/clang/include/clang/Analysis/FlowSensitive/Formula.h index 3959bc98619b9..4bd2b28e7567a 100644 --- a/clang/include/clang/Analysis/FlowSensitive/Formula.h +++ b/clang/include/clang/Analysis/FlowSensitive/Formula.h @@ -138,7 +138,6 @@ template <> struct DenseMapInfo<clang::dataflow::Atom> { using Underlying = std::underlying_type_t<Atom>; static inline Atom getEmptyKey() { return Atom(Underlying(-1)); } - static inline Atom getTombstoneKey() { return Atom(Underlying(-2)); } static unsigned getHashValue(const Atom &Val) { return DenseMapInfo<Underlying>::getHashValue(Underlying(Val)); } diff --git a/clang/include/clang/Analysis/ProgramPoint.h b/clang/include/clang/Analysis/ProgramPoint.h index b18090ce6b8c3..b0fedea2fd8ee 100644 --- a/clang/include/clang/Analysis/ProgramPoint.h +++ b/clang/include/clang/Analysis/ProgramPoint.h @@ -758,13 +758,6 @@ static inline clang::ProgramPoint getEmptyKey() { nullptr); } -static inline clang::ProgramPoint getTombstoneKey() { - uintptr_t x = - reinterpret_cast<uintptr_t>(DenseMapInfo<void*>::getTombstoneKey()) & ~0x7; - return clang::BlockEntrance(nullptr, reinterpret_cast<clang::CFGBlock *>(x), - nullptr); -} - static unsigned getHashValue(const clang::ProgramPoint &Loc) { return Loc.getHashValue(); } diff --git a/clang/include/clang/Analysis/RetainSummaryManager.h b/clang/include/clang/Analysis/RetainSummaryManager.h index 86865b9da4214..868c916ccc803 100644 --- a/clang/include/clang/Analysis/RetainSummaryManager.h +++ b/clang/include/clang/Analysis/RetainSummaryManager.h @@ -251,11 +251,6 @@ template <> struct DenseMapInfo<ObjCSummaryKey> { DenseMapInfo<Selector>::getEmptyKey()); } - static inline ObjCSummaryKey getTombstoneKey() { - return ObjCSummaryKey(DenseMapInfo<IdentifierInfo*>::getTombstoneKey(), - DenseMapInfo<Selector>::getTombstoneKey()); - } - static unsigned getHashValue(const ObjCSummaryKey &V) { typedef std::pair<IdentifierInfo*, Selector> PairTy; return DenseMapInfo<PairTy>::getHashValue(PairTy(V.getIdentifier(), diff --git a/clang/include/clang/Basic/DirectoryEntry.h b/clang/include/clang/Basic/DirectoryEntry.h index 69656125e422a..4502789439776 100644 --- a/clang/include/clang/Basic/DirectoryEntry.h +++ b/clang/include/clang/Basic/DirectoryEntry.h @@ -96,16 +96,12 @@ class DirectoryEntryRef { friend struct llvm::DenseMapInfo<DirectoryEntryRef>; struct dense_map_empty_tag {}; - struct dense_map_tombstone_tag {}; - // Private constructors for use by DenseMapInfo. + // Private constructor for use by DenseMapInfo. DirectoryEntryRef(dense_map_empty_tag) : ME(llvm::DenseMapInfo<const MapEntry *>::getEmptyKey()) {} - DirectoryEntryRef(dense_map_tombstone_tag) - : ME(llvm::DenseMapInfo<const MapEntry *>::getTombstoneKey()) {} bool isSpecialDenseMapKey() const { - return isSameRef(DirectoryEntryRef(dense_map_empty_tag())) || - isSameRef(DirectoryEntryRef(dense_map_tombstone_tag())); + return isSameRef(DirectoryEntryRef(dense_map_empty_tag())); } const MapEntry *ME; @@ -208,18 +204,13 @@ template <> struct DenseMapInfo<clang::DirectoryEntryRef> { clang::DirectoryEntryRef::dense_map_empty_tag()); } - static inline clang::DirectoryEntryRef getTombstoneKey() { - return clang::DirectoryEntryRef( - clang::DirectoryEntryRef::dense_map_tombstone_tag()); - } - static unsigned getHashValue(clang::DirectoryEntryRef Val) { return hash_value(Val); } static bool isEqual(clang::DirectoryEntryRef LHS, clang::DirectoryEntryRef RHS) { - // Catch the easy cases: both empty, both tombstone, or the same ref. + // Catch the easy cases: both empty or the same ref. if (LHS.isSameRef(RHS)) return true; diff --git a/clang/include/clang/Basic/FileEntry.h b/clang/include/clang/Basic/FileEntry.h index e7091fd1def59..481ef32d7d27d 100644 --- a/clang/include/clang/Basic/FileEntry.h +++ b/clang/include/clang/Basic/FileEntry.h @@ -184,16 +184,12 @@ class FileEntryRef { friend struct llvm::DenseMapInfo<FileEntryRef>; struct dense_map_empty_tag {}; - struct dense_map_tombstone_tag {}; - // Private constructors for use by DenseMapInfo. + // Private constructor for use by DenseMapInfo. FileEntryRef(dense_map_empty_tag) : ME(llvm::DenseMapInfo<const MapEntry *>::getEmptyKey()) {} - FileEntryRef(dense_map_tombstone_tag) - : ME(llvm::DenseMapInfo<const MapEntry *>::getTombstoneKey()) {} bool isSpecialDenseMapKey() const { - return isSameRef(FileEntryRef(dense_map_empty_tag())) || - isSameRef(FileEntryRef(dense_map_tombstone_tag())); + return isSameRef(FileEntryRef(dense_map_empty_tag())); } const MapEntry *ME; @@ -243,16 +239,12 @@ template <> struct DenseMapInfo<clang::FileEntryRef> { return clang::FileEntryRef(clang::FileEntryRef::dense_map_empty_tag()); } - static inline clang::FileEntryRef getTombstoneKey() { - return clang::FileEntryRef(clang::FileEntryRef::dense_map_tombstone_tag()); - } - static unsigned getHashValue(clang::FileEntryRef Val) { return hash_value(Val); } static bool isEqual(clang::FileEntryRef LHS, clang::FileEntryRef RHS) { - // Catch the easy cases: both empty, both tombstone, or the same ref. + // Catch the easy cases: both empty or the same ref. if (LHS.isSameRef(RHS)) return true; diff --git a/clang/include/clang/Basic/IdentifierTable.h b/clang/include/clang/Basic/IdentifierTable.h index ff5864bc31927..41420ece94bf4 100644 --- a/clang/include/clang/Basic/IdentifierTable.h +++ b/clang/include/clang/Basic/IdentifierTable.h @@ -1189,10 +1189,6 @@ class Selector { return Selector(uintptr_t(-1)); } - static Selector getTombstoneMarker() { - return Selector(uintptr_t(-2)); - } - static ObjCInstanceTypeFamily getInstTypeMethodFamily(Selector sel); }; @@ -1277,10 +1273,6 @@ struct DenseMapInfo<clang::Selector> { return clang::Selector::getEmptyMarker(); } - static clang::Selector getTombstoneKey() { - return clang::Selector::getTombstoneMarker(); - } - static unsigned getHashValue(clang::Selector S); static bool isEqual(clang::Selector LHS, clang::Selector RHS) { diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h index 96a22435bc567..c239f02dc6867 100644 --- a/clang/include/clang/Basic/Module.h +++ b/clang/include/clang/Basic/Module.h @@ -1160,10 +1160,6 @@ template <> struct llvm::DenseMapInfo<clang::ModuleFileKey> { return DenseMapInfo<const void *>::getEmptyKey(); } - static clang::ModuleFileKey getTombstoneKey() { - return DenseMapInfo<const void *>::getTombstoneKey(); - } - static unsigned getHashValue(const clang::ModuleFileKey &Val) { return hash_combine(Val.Ptr, Val.ImplicitModulePathSuffix); } diff --git a/clang/include/clang/Basic/SourceLocation.h b/clang/include/clang/Basic/SourceLocation.h index b73b43d953662..37ed9a3bd4f40 100644 --- a/clang/include/clang/Basic/SourceLocation.h +++ b/clang/include/clang/Basic/SourceLocation.h @@ -498,10 +498,6 @@ namespace llvm { return {}; } - static clang::FileID getTombstoneKey() { - return clang::FileID::getSentinel(); - } - static unsigned getHashValue(clang::FileID S) { return S.getHashValue(); } @@ -520,11 +516,6 @@ namespace llvm { return clang::SourceLocation::getFromRawEncoding(~Zero); } - static clang::SourceLocation getTombstoneKey() { - constexpr clang::SourceLocation::UIntTy Zero = 0; - return clang::SourceLocation::getFromRawEncoding(~Zero - 1); - } - static unsigned getHashValue(clang::SourceLocation Loc) { return Loc.getHashValue(); } @@ -544,10 +535,6 @@ namespace llvm { return DenseMapInfo<clang::SourceLocation>::getEmptyKey(); } - static clang::SourceRange getTombstoneKey() { - return DenseMapInfo<clang::SourceLocation>::getTombstoneKey(); - } - static unsigned getHashValue(clang::SourceRange Range) { return detail::combineHashValue(Range.getBegin().getHashValue(), Range.getEnd().getHashValue()); diff --git a/clang/include/clang/Basic/TokenKinds.h b/clang/include/clang/Basic/TokenKinds.h index c0316257d9d97..37181b9533422 100644 --- a/clang/include/clang/Basic/TokenKinds.h +++ b/clang/include/clang/Basic/TokenKinds.h @@ -136,9 +136,6 @@ template <> struct DenseMapInfo<clang::tok::PPKeywordKind> { static inline clang::tok::PPKeywordKind getEmptyKey() { return clang::tok::PPKeywordKind::pp_not_keyword; } - static inline clang::tok::PPKeywordKind getTombstoneKey() { - return clang::tok::PPKeywordKind::NUM_PP_KEYWORDS; - } static unsigned getHashValue(const clang::tok::PPKeywordKind &Val) { return static_cast<unsigned>(Val); } diff --git a/clang/include/clang/DependencyScanning/DependencyGraph.h b/clang/include/clang/DependencyScanning/DependencyGraph.h index 7e8bd0f735ea2..331fe5d6fbb3b 100644 --- a/clang/include/clang/DependencyScanning/DependencyGraph.h +++ b/clang/include/clang/DependencyScanning/DependencyGraph.h @@ -207,9 +207,6 @@ inline hash_code hash_value(const clang::dependencies::ModuleID &ID) { template <> struct DenseMapInfo<clang::dependencies::ModuleID> { using ModuleID = clang::dependencies::ModuleID; static inline ModuleID getEmptyKey() { return ModuleID{"", ""}; } - static inline ModuleID getTombstoneKey() { - return ModuleID{"~", "~"}; // ~ is not a valid module name or context hash - } static unsigned getHashValue(const ModuleID &ID) { return hash_value(ID); } static bool isEqual(const ModuleID &LHS, const ModuleID &RHS) { return LHS == RHS; diff --git a/clang/include/clang/Sema/ScopeInfo.h b/clang/include/clang/Sema/ScopeInfo.h index f334f58ebd0a7..3545f9ce1e4aa 100644 --- a/clang/include/clang/Sema/ScopeInfo.h +++ b/clang/include/clang/Sema/ScopeInfo.h @@ -332,10 +332,6 @@ class FunctionScopeInfo { return WeakObjectProfileTy(); } - static inline WeakObjectProfileTy getTombstoneKey() { - return WeakObjectProfileTy::getSentinel(); - } - static unsigned getHashValue(const WeakObjectProfileTy &Val) { using Pair = std::pair<BaseInfoTy, const NamedDecl *>; diff --git a/clang/include/clang/Sema/SemaCUDA.h b/clang/include/clang/Sema/SemaCUDA.h index 594ad4a754ec3..43ac11be44bb5 100644 --- a/clang/include/clang/Sema/SemaCUDA.h +++ b/clang/include/clang/Sema/SemaCUDA.h @@ -308,10 +308,6 @@ template <> struct DenseMapInfo<clang::SemaCUDA::FunctionDeclAndLoc> { return {FDBaseInfo::getEmptyKey(), clang::SourceLocation()}; } - static FunctionDeclAndLoc getTombstoneKey() { - return {FDBaseInfo::getTombstoneKey(), clang::SourceLocation()}; - } - static unsigned getHashValue(const FunctionDeclAndLoc &FDL) { return hash_combine(FDBaseInfo::getHashValue(FDL.FD), FDL.Loc.getHashValue()); diff --git a/clang/include/clang/Sema/Weak.h b/clang/include/clang/Sema/Weak.h index 877b47d2474ea..8608d574184a4 100644 --- a/clang/include/clang/Sema/Weak.h +++ b/clang/include/clang/Sema/Weak.h @@ -39,9 +39,6 @@ class WeakInfo { static inline WeakInfo getEmptyKey() { return WeakInfo(DenseMapInfo::getEmptyKey(), SourceLocation()); } - static inline WeakInfo getTombstoneKey() { - return WeakInfo(DenseMapInfo::getTombstoneKey(), SourceLocation()); - } static unsigned getHashValue(const WeakInfo &W) { return DenseMapInfo::getHashValue(W.getAlias()); } diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h index 3c8f3ba59a07e..412f87e9da43e 100644 --- a/clang/include/clang/Serialization/ASTBitCodes.h +++ b/clang/include/clang/Serialization/ASTBitCodes.h @@ -138,10 +138,6 @@ struct UnsafeQualTypeDenseMapInfo { return QualType::getFromOpaquePtr((void *)1); } - static QualType getTombstoneKey() { - return QualType::getFromOpaquePtr((void *)2); - } - static unsigned getHashValue(QualType T) { assert(!T.getLocalFastQualifiers() && "hash invalid for types with fast quals"); @@ -2218,10 +2214,6 @@ template <> struct DenseMapInfo<clang::serialization::DeclarationNameKey> { return clang::serialization::DeclarationNameKey(-1, 1); } - static clang::serialization::DeclarationNameKey getTombstoneKey() { - return clang::serialization::DeclarationNameKey(-1, 2); - } - static unsigned getHashValue(const clang::serialization::DeclarationNameKey &Key) { return Key.getHash(); diff --git a/clang/include/clang/Tooling/Inclusions/StandardLibrary.h b/clang/include/clang/Tooling/Inclusions/StandardLibrary.h index 147f505ade058..66cbe0d49b5f6 100644 --- a/clang/include/clang/Tooling/Inclusions/StandardLibrary.h +++ b/clang/include/clang/Tooling/Inclusions/StandardLibrary.h @@ -124,10 +124,6 @@ template <> struct DenseMapInfo<clang::tooling::stdlib::Header> { return clang::tooling::stdlib::Header(-1, clang::tooling::stdlib::Lang::CXX); } - static inline clang::tooling::stdlib::Header getTombstoneKey() { - return clang::tooling::stdlib::Header(-2, - clang::tooling::stdlib::Lang::CXX); - } static unsigned getHashValue(const clang::tooling::stdlib::Header &H) { return hash_value(H.ID); } @@ -142,10 +138,6 @@ template <> struct DenseMapInfo<clang::tooling::stdlib::Symbol> { return clang::tooling::stdlib::Symbol(-1, clang::tooling::stdlib::Lang::CXX); } - static inline clang::tooling::stdlib::Symbol getTombstoneKey() { - return clang::tooling::stdlib::Symbol(-2, - clang::tooling::stdlib::Lang::CXX); - } static unsigned getHashValue(const clang::tooling::stdlib::Symbol &S) { return hash_value(S.ID); } diff --git a/clang/lib/APINotes/APINotesFormat.h b/clang/lib/APINotes/APINotesFormat.h index 4cb89fecedd3f..7f99fb92e6cbd 100644 --- a/clang/lib/APINotes/APINotesFormat.h +++ b/clang/lib/APINotes/APINotesFormat.h @@ -366,11 +366,6 @@ template <> struct DenseMapInfo<clang::api_notes::StoredObjCSelector> { {}}; } - static inline clang::api_notes::StoredObjCSelector getTombstoneKey() { - return clang::api_notes::StoredObjCSelector{UnsignedInfo::getTombstoneKey(), - {}}; - } - static unsigned getHashValue(const clang::api_notes::StoredObjCSelector &Selector) { auto hash = llvm::hash_value(Selector.NumArgs); @@ -393,13 +388,6 @@ template <> struct DenseMapInfo<clang::api_notes::ContextTableKey> { return clang::api_notes::ContextTableKey(); } - static inline clang::api_notes::ContextTableKey getTombstoneKey() { - return clang::api_notes::ContextTableKey{ - DenseMapInfo<uint32_t>::getTombstoneKey(), - DenseMapInfo<uint8_t>::getTombstoneKey(), - DenseMapInfo<uint32_t>::getTombstoneKey()}; - } - static unsigned getHashValue(const clang::api_notes::ContextTableKey &value) { return value.hashValue(); } @@ -415,12 +403,6 @@ template <> struct DenseMapInfo<clang::api_notes::SingleDeclTableKey> { return clang::api_notes::SingleDeclTableKey(); } - static inline clang::api_notes::SingleDeclTableKey getTombstoneKey() { - return clang::api_notes::SingleDeclTableKey{ - DenseMapInfo<uint32_t>::getTombstoneKey(), - DenseMapInfo<uint32_t>::getTombstoneKey()}; - } - static unsigned getHashValue(const clang::api_notes::SingleDeclTableKey &value) { return value.hashValue(); diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp index 95b6f7f745ccb..91689a4961a1f 100644 --- a/clang/lib/AST/APValue.cpp +++ b/clang/lib/AST/APValue.cpp @@ -191,13 +191,6 @@ llvm::DenseMapInfo<clang::APValue::LValueBase>::getEmptyKey() { return B; } -clang::APValue::LValueBase -llvm::DenseMapInfo<clang::APValue::LValueBase>::getTombstoneKey() { - clang::APValue::LValueBase B; - B.Ptr = DenseMapInfo<const ValueDecl*>::getTombstoneKey(); - return B; -} - namespace clang { llvm::hash_code hash_value(const APValue::LValueBase &Base) { if (Base.is<TypeInfoLValue>() || Base.is<DynamicAllocLValue>()) diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 808c9b4f89ed9..5343e1d6f4e3b 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -735,9 +735,6 @@ template<> struct DenseMapInfo<ObjectUnderConstruction> { using Base = DenseMapInfo<APValue::LValueBase>; static ObjectUnderConstruction getEmptyKey() { return {Base::getEmptyKey(), {}}; } - static ObjectUnderConstruction getTombstoneKey() { - return {Base::getTombstoneKey(), {}}; - } static unsigned getHashValue(const ObjectUnderConstruction &Object) { return hash_value(Object); } diff --git a/clang/lib/AST/ItaniumCXXABI.cpp b/clang/lib/AST/ItaniumCXXABI.cpp index adef1584fd9b6..89fd536d32af2 100644 --- a/clang/lib/AST/ItaniumCXXABI.cpp +++ b/clang/lib/AST/ItaniumCXXABI.cpp @@ -78,11 +78,6 @@ template <typename T> static bool isDenseMapKeyEmpty(T V) { return llvm::DenseMapInfo<T>::isEqual( V, llvm::DenseMapInfo<T>::getEmptyKey()); } -template <typename T> static bool isDenseMapKeyTombstone(T V) { - return llvm::DenseMapInfo<T>::isEqual( - V, llvm::DenseMapInfo<T>::getTombstoneKey()); -} - template <typename T> static std::optional<bool> areDenseMapKeysEqualSpecialValues(T LHS, T RHS) { bool LHSEmpty = isDenseMapKeyEmpty(LHS); @@ -90,11 +85,6 @@ static std::optional<bool> areDenseMapKeysEqualSpecialValues(T LHS, T RHS) { if (LHSEmpty || RHSEmpty) return LHSEmpty && RHSEmpty; - bool LHSTombstone = isDenseMapKeyTombstone(LHS); - bool RHSTombstone = isDenseMapKeyTombstone(RHS); - if (LHSTombstone || RHSTombstone) - return LHSTombstone && RHSTombstone; - return std::nullopt; } @@ -104,11 +94,8 @@ struct DenseMapInfo<DecompositionDeclName> { static DecompositionDeclName getEmptyKey() { return {ArrayInfo::getEmptyKey()}; } - static DecompositionDeclName getTombstoneKey() { - return {ArrayInfo::getTombstoneKey()}; - } static unsigned getHashValue(DecompositionDeclName Key) { - assert(!isEqual(Key, getEmptyKey()) && !isEqual(Key, getTombstoneKey())); + assert(!isEqual(Key, getEmptyKey())); return llvm::hash_combine_range(Key); } static bool isEqual(DecompositionDeclName LHS, DecompositionDeclName RHS) { diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 0d45df02a2a21..3d429d0d78e82 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -3627,7 +3627,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const ObjCInterfaceType *Ty, }; { // Use 'char' for the isClassProperty bit as DenseSet requires space for - // empty/tombstone keys in the data type (and bool is too small for that). + // the empty key in the data type (and bool is too small for that). typedef std::pair<char, const IdentifierInfo *> IsClassAndIdent; /// List of already emitted properties. Two distinct class and instance /// properties can share the same identifier (but not two instance diff --git a/clang/lib/CodeGen/CGObjCMacConstantLiteralUtil.h b/clang/lib/CodeGen/CGObjCMacConstantLiteralUtil.h index f9eb54bec9aaf..27b4ef8ca6c16 100644 --- a/clang/lib/CodeGen/CGObjCMacConstantLiteralUtil.h +++ b/clang/lib/CodeGen/CGObjCMacConstantLiteralUtil.h @@ -31,7 +31,6 @@ class NSConstantNumberMapInfo { enum class MapInfoType { Empty, - Tombstone, Int, Float, }; @@ -41,13 +40,11 @@ class NSConstantNumberMapInfo { llvm::APSInt Int; llvm::APFloat Float; - /// Default constructor that can create Empty or Tombstone info entries + /// Default constructor that can create an Empty info entry. explicit NSConstantNumberMapInfo(MapInfoType I = MapInfoType::Empty) : InfoType(I), QType(), Int(), Float(0.0) {} - bool isEmptyOrTombstone() const { - return InfoType == MapInfoType::Empty || InfoType == MapInfoType::Tombstone; - } + bool isEmpty() const { return InfoType == MapInfoType::Empty; } public: NSConstantNumberMapInfo(CanQualType QT, const llvm::APSInt &V) @@ -56,10 +53,9 @@ class NSConstantNumberMapInfo { : InfoType(MapInfoType::Float), QType(QT), Int(), Float(V) {} unsigned getHashValue() const { - assert(!isEmptyOrTombstone() && "Cannot hash empty or tombstone map info!"); + assert(!isEmpty() && "Cannot hash empty map info!"); - unsigned QTypeHash = llvm::DenseMapInfo<QualType>::getHashValue( - llvm::DenseMapInfo<QualType>::getTombstoneKey()); + unsigned QTypeHash = llvm::DenseMapInfo<QualType>::getHashValue(QType); if (InfoType == MapInfoType::Int) return llvm::detail::combineHashValue((unsigned)Int.getZExtValue(), @@ -74,16 +70,12 @@ class NSConstantNumberMapInfo { return NSConstantNumberMapInfo(); } - static inline NSConstantNumberMapInfo getTombstoneKey() { - return NSConstantNumberMapInfo(MapInfoType::Tombstone); - } - bool operator==(const NSConstantNumberMapInfo &RHS) const { if (InfoType != RHS.InfoType || QType != RHS.QType) return false; - // Handle the empty and tombstone equality - if (isEmptyOrTombstone()) + // Handle the empty equality. + if (isEmpty()) return true; if (InfoType == MapInfoType::Int) @@ -171,10 +163,6 @@ template <> struct DenseMapInfo<NSConstantNumberMapInfo> { return NSConstantNumberMapInfo::getEmptyKey(); } - static NSConstantNumberMapInfo getTombstoneKey() { - return NSConstantNumberMapInfo::getTombstoneKey(); - } - static unsigned getHashValue(const NSConstantNumberMapInfo &S) { return S.getHashValue(); } diff --git a/clang/lib/CodeGen/CodeGenTBAA.h b/clang/lib/CodeGen/CodeGenTBAA.h index 0aae171d168df..f3345274c8f55 100644 --- a/clang/lib/CodeGen/CodeGenTBAA.h +++ b/clang/lib/CodeGen/CodeGenTBAA.h @@ -238,16 +238,6 @@ template<> struct DenseMapInfo<clang::CodeGen::TBAAAccessInfo> { DenseMapInfo<uint64_t>::getEmptyKey()); } - static clang::CodeGen::TBAAAccessInfo getTombstoneKey() { - unsigned UnsignedKey = DenseMapInfo<unsigned>::getTombstoneKey(); - return clang::CodeGen::TBAAAccessInfo( - static_cast<clang::CodeGen::TBAAAccessKind>(UnsignedKey), - DenseMapInfo<MDNode *>::getTombstoneKey(), - DenseMapInfo<MDNode *>::getTombstoneKey(), - DenseMapInfo<uint64_t>::getTombstoneKey(), - DenseMapInfo<uint64_t>::getTombstoneKey()); - } - static unsigned getHashValue(const clang::CodeGen::TBAAAccessInfo &Val) { auto KindValue = static_cast<unsigned>(Val.Kind); return DenseMapInfo<unsigned>::getHashValue(KindValue) ^ diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index 1d3c462833c7d..33c42b20b15ad 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -4276,7 +4276,7 @@ class CatchHandlerType { unsigned IsPointer : 1; // This is a special constructor to be used only with DenseMapInfo's - // getEmptyKey() and getTombstoneKey() functions. + // getEmptyKey() function. friend struct llvm::DenseMapInfo<CatchHandlerType>; enum Unique { ForDenseMap }; CatchHandlerType(QualType QT, Unique) : QT(QT), IsPointer(false) {} @@ -4321,11 +4321,6 @@ template <> struct DenseMapInfo<CatchHandlerType> { CatchHandlerType::ForDenseMap); } - static CatchHandlerType getTombstoneKey() { - return CatchHandlerType(DenseMapInfo<QualType>::getTombstoneKey(), - CatchHandlerType::ForDenseMap); - } - static unsigned getHashValue(const CatchHandlerType &Base) { return DenseMapInfo<QualType>::getHashValue(Base.underlying()); } diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp index f1784ff3fa684..c3ea0f41f3b78 100644 --- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp +++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp @@ -1242,11 +1242,6 @@ template <> struct DenseMapInfo<PrivateMethodKey> { return {InterfaceInfo::getEmptyKey(), SelectorInfo::getEmptyKey(), false}; } - static inline PrivateMethodKey getTombstoneKey() { - return {InterfaceInfo::getTombstoneKey(), SelectorInfo::getTombstoneKey(), - true}; - } - static unsigned getHashValue(const PrivateMethodKey &Key) { return llvm::hash_combine( llvm::hash_code(InterfaceInfo::getHashValue(Key.Interface)), diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp index c648bb38edf71..24900a43dbcc2 100644 --- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp +++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp @@ -143,9 +143,6 @@ namespace llvm { // Provide DenseMapInfo so that OffloadKind can be used in a DenseMap. template <> struct DenseMapInfo<OffloadKind> { static inline OffloadKind getEmptyKey() { return OFK_LAST; } - static inline OffloadKind getTombstoneKey() { - return static_cast<OffloadKind>(OFK_LAST + 1); - } static unsigned getHashValue(const OffloadKind &Val) { return Val; } static bool isEqual(const OffloadKind &LHS, const OffloadKind &RHS) { diff --git a/clang/tools/libclang/CXCursor.cpp b/clang/tools/libclang/CXCursor.cpp index 242380c68c667..d513f9f4cf97b 100644 --- a/clang/tools/libclang/CXCursor.cpp +++ b/clang/tools/libclang/CXCursor.cpp @@ -1625,9 +1625,6 @@ template <> struct DenseMapInfo<CXCursor> { static inline CXCursor getEmptyKey() { return MakeCXCursorInvalid(CXCursor_InvalidFile); } - static inline CXCursor getTombstoneKey() { - return MakeCXCursorInvalid(CXCursor_NoDeclFound); - } static inline unsigned getHashValue(const CXCursor &cursor) { return llvm::DenseMapInfo<std::pair<const void *, const void *>>:: getHashValue(std::make_pair(cursor.data[0], cursor.data[1])); diff --git a/clang/tools/libclang/Indexing.cpp b/clang/tools/libclang/Indexing.cpp index 4e57b63490112..5783bd0125462 100644 --- a/clang/tools/libclang/Indexing.cpp +++ b/clang/tools/libclang/Indexing.cpp @@ -99,9 +99,6 @@ namespace llvm { static inline PPRegion getEmptyKey() { return PPRegion(llvm::sys::fs::UniqueID(0, 0), unsigned(-1), 0); } - static inline PPRegion getTombstoneKey() { - return PPRegion(llvm::sys::fs::UniqueID(0, 0), unsigned(-2), 0); - } static unsigned getHashValue(const PPRegion &S) { llvm::FoldingSetNodeID ID; _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
