llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-analysis

Author: Fangrui Song (MaskRay)

<details>
<summary>Changes</summary>

After #<!-- -->201281 DenseMapInfo&lt;T&gt;::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.


---

Patch is 43.82 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/201987.diff


51 Files Affected:

- (modified) 
clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h 
(-8) 
- (modified) clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp (-8) 
- (modified) clang-tools-extra/clangd/Config.h (-3) 
- (modified) clang-tools-extra/clangd/Headers.h (-4) 
- (modified) clang-tools-extra/clangd/Protocol.h (-5) 
- (modified) clang-tools-extra/clangd/SystemIncludeExtractor.cpp (-5) 
- (modified) clang-tools-extra/clangd/index/Ref.h (-4) 
- (modified) clang-tools-extra/clangd/index/SymbolID.h (-4) 
- (modified) clang-tools-extra/clangd/index/dex/Token.h (-4) 
- (modified) clang-tools-extra/clangd/index/dex/Trigram.h (-3) 
- (modified) 
clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h (-7) 
- (modified) clang/include/clang/AST/APValue.h (-1) 
- (modified) clang/include/clang/AST/ASTContext.h (-5) 
- (modified) clang/include/clang/AST/ASTTypeTraits.h (+1-10) 
- (modified) clang/include/clang/AST/BaseSubobject.h (-6) 
- (modified) clang/include/clang/AST/CharUnits.h (-7) 
- (modified) clang/include/clang/AST/DeclID.h (-8) 
- (modified) clang/include/clang/AST/DeclarationName.h (-4) 
- (modified) clang/include/clang/AST/GlobalDecl.h (-4) 
- (modified) clang/include/clang/AST/NestedNameSpecifier.h (-7) 
- (modified) clang/include/clang/AST/Redeclarable.h (-8) 
- (modified) clang/include/clang/AST/TypeOrdering.h (-6) 
- (modified) clang/include/clang/Analysis/Analyses/LifetimeSafety/Utils.h (-4) 
- (modified) clang/include/clang/Analysis/CallGraph.h (-6) 
- (modified) 
clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h (-5) 
- (modified) clang/include/clang/Analysis/FlowSensitive/Formula.h (-1) 
- (modified) clang/include/clang/Analysis/ProgramPoint.h (-7) 
- (modified) clang/include/clang/Analysis/RetainSummaryManager.h (-5) 
- (modified) clang/include/clang/Basic/DirectoryEntry.h (-20) 
- (modified) clang/include/clang/Basic/FileEntry.h (-21) 
- (modified) clang/include/clang/Basic/IdentifierTable.h (-4) 
- (modified) clang/include/clang/Basic/Module.h (-4) 
- (modified) clang/include/clang/Basic/SourceLocation.h (-13) 
- (modified) clang/include/clang/Basic/TokenKinds.h (-3) 
- (modified) clang/include/clang/DependencyScanning/DependencyGraph.h (-1) 
- (modified) clang/include/clang/Sema/ScopeInfo.h (-4) 
- (modified) clang/include/clang/Sema/SemaCUDA.h (-4) 
- (modified) clang/include/clang/Sema/Weak.h (-3) 
- (modified) clang/include/clang/Serialization/ASTBitCodes.h (-8) 
- (modified) clang/include/clang/Tooling/Inclusions/StandardLibrary.h (-8) 
- (modified) clang/lib/APINotes/APINotesFormat.h (-13) 
- (modified) clang/lib/AST/APValue.cpp (-7) 
- (modified) clang/lib/AST/ExprConstant.cpp (-3) 
- (modified) clang/lib/AST/ItaniumCXXABI.cpp (-22) 
- (modified) clang/lib/CodeGen/CGObjCMacConstantLiteralUtil.h (-8) 
- (modified) clang/lib/CodeGen/CodeGenTBAA.h (-10) 
- (modified) clang/lib/Sema/SemaStmt.cpp (-9) 
- (modified) clang/lib/StaticAnalyzer/Core/CallEvent.cpp (-4) 
- (modified) clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp (-1) 
- (modified) clang/tools/libclang/CXCursor.cpp (-3) 
- (modified) clang/tools/libclang/Indexing.cpp (-4) 


``````````diff
diff --git 
a/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h 
b/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
index e3ed12de4fd3e..78447df5a1b36 100644
--- 
a/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
+++ 
b/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
@@ -83,20 +83,12 @@ struct DenseMapInfo<
   using ClassDefId =
       clang::tidy::cppcoreguidelines::SpecialMemberFunctionsCheck::ClassDefId;
 
-  static ClassDefId getEmptyKey() {
-    return {DenseMapInfo<clang::SourceLocation>::getEmptyKey(), "EMPTY"};
-  }
-
   static unsigned getHashValue(const ClassDefId &Val) {
-    assert(Val != getEmptyKey() && "Cannot hash the empty key!");
-
     const std::hash<ClassDefId::second_type> SecondHash;
     return Val.first.getHashValue() + SecondHash(Val.second);
   }
 
   static bool isEqual(const ClassDefId &LHS, const ClassDefId &RHS) {
-    if (RHS == getEmptyKey())
-      return LHS == getEmptyKey();
     return LHS == RHS;
   }
 };
diff --git a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp 
b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
index c4b800d2c9e19..cb7ef19827675 100644
--- a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
@@ -30,20 +30,12 @@ template <>
 struct DenseMapInfo<clang::tidy::RenamerClangTidyCheck::NamingCheckId> {
   using NamingCheckId = clang::tidy::RenamerClangTidyCheck::NamingCheckId;
 
-  static NamingCheckId getEmptyKey() {
-    return {DenseMapInfo<clang::SourceLocation>::getEmptyKey(), "EMPTY"};
-  }
-
   static unsigned getHashValue(NamingCheckId Val) {
-    assert(Val != getEmptyKey() && "Cannot hash the empty key!");
-
     return DenseMapInfo<clang::SourceLocation>::getHashValue(Val.first) +
            DenseMapInfo<StringRef>::getHashValue(Val.second);
   }
 
   static bool isEqual(const NamingCheckId &LHS, const NamingCheckId &RHS) {
-    if (RHS == getEmptyKey())
-      return LHS == getEmptyKey();
     return LHS == RHS;
   }
 };
diff --git a/clang-tools-extra/clangd/Config.h 
b/clang-tools-extra/clangd/Config.h
index 450ca6ea93ddc..a94a1727199bd 100644
--- a/clang-tools-extra/clangd/Config.h
+++ b/clang-tools-extra/clangd/Config.h
@@ -229,9 +229,6 @@ struct Config {
 namespace llvm {
 template <> struct DenseMapInfo<clang::clangd::Config::ExternalIndexSpec> {
   using ExternalIndexSpec = clang::clangd::Config::ExternalIndexSpec;
-  static inline ExternalIndexSpec getEmptyKey() {
-    return {ExternalIndexSpec::File, "", ""};
-  }
   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 05536529b22b9..050d972f24a29 100644
--- a/clang-tools-extra/clangd/Headers.h
+++ b/clang-tools-extra/clangd/Headers.h
@@ -273,10 +273,6 @@ namespace llvm {
 
 // Support HeaderIDs as DenseMap keys.
 template <> struct DenseMapInfo<clang::clangd::IncludeStructure::HeaderID> {
-  static inline clang::clangd::IncludeStructure::HeaderID getEmptyKey() {
-    return static_cast<clang::clangd::IncludeStructure::HeaderID>(-1);
-  }
-
   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 67aea52ef43d4..b511ca495e47f 100644
--- a/clang-tools-extra/clangd/Protocol.h
+++ b/clang-tools-extra/clangd/Protocol.h
@@ -2108,11 +2108,6 @@ namespace llvm {
 
 template <> struct DenseMapInfo<clang::clangd::Range> {
   using Range = clang::clangd::Range;
-  static inline Range getEmptyKey() {
-    static clang::clangd::Position Tomb{-1, -1};
-    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 8809426f8130a..b4dbc1df1d636 100644
--- a/clang-tools-extra/clangd/SystemIncludeExtractor.cpp
+++ b/clang-tools-extra/clangd/SystemIncludeExtractor.cpp
@@ -217,11 +217,6 @@ struct DriverArgs {
 namespace llvm {
 using DriverArgs = clang::clangd::DriverArgs;
 template <> struct DenseMapInfo<DriverArgs> {
-  static DriverArgs getEmptyKey() {
-    auto Driver = DriverArgs::getEmpty();
-    Driver.Driver = "EMPTY_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 aa7c88443e909..b71f09611fed1 100644
--- a/clang-tools-extra/clangd/index/Ref.h
+++ b/clang-tools-extra/clangd/index/Ref.h
@@ -171,10 +171,6 @@ class RefSlab {
 namespace llvm {
 template <> struct DenseMapInfo<clang::clangd::RefSlab::Builder::Entry> {
   using Entry = clang::clangd::RefSlab::Builder::Entry;
-  static inline Entry getEmptyKey() {
-    static Entry E{clang::clangd::SymbolID(""), {}};
-    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 929004aa70a25..d13eea1a9028b 100644
--- a/clang-tools-extra/clangd/index/SymbolID.h
+++ b/clang-tools-extra/clangd/index/SymbolID.h
@@ -81,10 +81,6 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const 
SymbolID &ID);
 namespace llvm {
 // Support SymbolIDs as DenseMap keys.
 template <> struct DenseMapInfo<clang::clangd::SymbolID> {
-  static inline clang::clangd::SymbolID getEmptyKey() {
-    static clang::clangd::SymbolID EmptyKey("EMPTYKEY");
-    return EmptyKey;
-  }
   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 f69d8f1f117ef..98a504c4c3fa2 100644
--- a/clang-tools-extra/clangd/index/dex/Token.h
+++ b/clang-tools-extra/clangd/index/dex/Token.h
@@ -115,10 +115,6 @@ namespace llvm {
 
 // Support Tokens as DenseMap keys.
 template <> struct DenseMapInfo<clang::clangd::dex::Token> {
-  static inline clang::clangd::dex::Token getEmptyKey() {
-    return {clang::clangd::dex::Token::Kind::Sentinel, "EmptyKey"};
-  }
-
   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 6bdb72f0caf7e..bad3c4378598f 100644
--- a/clang-tools-extra/clangd/index/dex/Trigram.h
+++ b/clang-tools-extra/clangd/index/dex/Trigram.h
@@ -90,9 +90,6 @@ std::vector<Token> generateQueryTrigrams(llvm::StringRef 
Query);
 namespace llvm {
 template <> struct DenseMapInfo<clang::clangd::dex::Trigram> {
   using Trigram = clang::clangd::dex::Trigram;
-  static inline Trigram getEmptyKey() {
-    return Trigram(Trigram::Sentinel::Empty);
-  }
   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 99d65266bf53d..341cf1851142b 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
@@ -219,9 +219,6 @@ template <> struct 
DenseMapInfo<clang::include_cleaner::Symbol> {
   using Outer = clang::include_cleaner::Symbol;
   using Base = DenseMapInfo<decltype(Outer::Storage)>;
 
-  static Outer getEmptyKey() {
-    return {Outer::SentinelTag{}, Base::getEmptyKey()};
-  }
   static unsigned getHashValue(const Outer &Val) {
     return Base::getHashValue(Val.Storage);
   }
@@ -233,7 +230,6 @@ template <> struct 
DenseMapInfo<clang::include_cleaner::Macro> {
   using Outer = clang::include_cleaner::Macro;
   using Base = DenseMapInfo<decltype(Outer::Definition)>;
 
-  static Outer getEmptyKey() { return {nullptr, Base::getEmptyKey()}; }
   static unsigned getHashValue(const Outer &Val) {
     return Base::getHashValue(Val.Definition);
   }
@@ -245,9 +241,6 @@ template <> struct 
DenseMapInfo<clang::include_cleaner::Header> {
   using Outer = clang::include_cleaner::Header;
   using Base = DenseMapInfo<decltype(Outer::Storage)>;
 
-  static Outer getEmptyKey() {
-    return {Outer::SentinelTag{}, Base::getEmptyKey()};
-  }
   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 22f0ad18caee4..acbd922ba5319 100644
--- a/clang/include/clang/AST/APValue.h
+++ b/clang/include/clang/AST/APValue.h
@@ -838,7 +838,6 @@ class APValue {
 
 namespace llvm {
 template<> struct DenseMapInfo<clang::APValue::LValueBase> {
-  static clang::APValue::LValueBase getEmptyKey();
   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 54c046f5fab4a..6cdcb0ec1eb0b 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -70,9 +70,6 @@ struct ScalableVecTyKey {
 // Provide a DenseMapInfo specialization so that ScalableVecTyKey can be used
 // as a key in DenseMap.
 template <> struct DenseMapInfo<ScalableVecTyKey> {
-  static inline ScalableVecTyKey getEmptyKey() {
-    return {DenseMapInfo<clang::QualType>::getEmptyKey(), ~0U, ~0U};
-  }
   static unsigned getHashValue(const ScalableVecTyKey &Val) {
     return hash_combine(DenseMapInfo<clang::QualType>::getHashValue(Val.EltTy),
                         Val.NumElts, Val.NumFields);
@@ -4005,8 +4002,6 @@ typename clang::LazyGenerationalUpdatePtr<Owner, T, 
Update>::ValueType
   return Value;
 }
 template <> struct llvm::DenseMapInfo<llvm::FoldingSetNodeID> {
-  static FoldingSetNodeID getEmptyKey() { return FoldingSetNodeID{}; }
-
   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 e8a18725645c0..40d715390e757 100644
--- a/clang/include/clang/AST/ASTTypeTraits.h
+++ b/clang/include/clang/AST/ASTTypeTraits.h
@@ -109,7 +109,6 @@ class ASTNodeKind {
   /// Hooks for using ASTNodeKind as a key in a DenseMap.
   struct DenseMapInfo {
     // ASTNodeKind() is a good empty key because it is represented as a 0.
-    static inline ASTNodeKind getEmptyKey() { return ASTNodeKind(); }
     static unsigned getHashValue(const ASTNodeKind &Val) { return Val.KindId; }
     static bool isEqual(const ASTNodeKind &LHS, const ASTNodeKind &RHS) {
       return LHS.KindId == RHS.KindId;
@@ -369,11 +368,6 @@ class DynTypedNode {
 
   /// Hooks for using DynTypedNode as a key in a DenseMap.
   struct DenseMapInfo {
-    static inline DynTypedNode getEmptyKey() {
-      DynTypedNode Node;
-      Node.NodeKind = ASTNodeKind::DenseMapInfo::getEmptyKey();
-      return Node;
-    }
     static unsigned getHashValue(const DynTypedNode &Val) {
       // FIXME: Add hashing support for the remaining types.
       if (ASTNodeKind::getFromNodeKind<TypeLoc>().isBaseOf(Val.NodeKind)) {
@@ -394,10 +388,7 @@ class DynTypedNode {
       return llvm::hash_value(Val.getMemoizationData());
     }
     static bool isEqual(const DynTypedNode &LHS, const DynTypedNode &RHS) {
-      auto Empty = ASTNodeKind::DenseMapInfo::getEmptyKey();
-      return (ASTNodeKind::DenseMapInfo::isEqual(LHS.NodeKind, Empty) &&
-              ASTNodeKind::DenseMapInfo::isEqual(RHS.NodeKind, Empty)) ||
-             LHS == RHS;
+      return LHS == RHS;
     }
   };
 
diff --git a/clang/include/clang/AST/BaseSubobject.h 
b/clang/include/clang/AST/BaseSubobject.h
index f98c323a0b110..328572802d582 100644
--- a/clang/include/clang/AST/BaseSubobject.h
+++ b/clang/include/clang/AST/BaseSubobject.h
@@ -55,12 +55,6 @@ class BaseSubobject {
 namespace llvm {
 
 template<> struct DenseMapInfo<clang::BaseSubobject> {
-  static clang::BaseSubobject getEmptyKey() {
-    return clang::BaseSubobject(
-      DenseMapInfo<const clang::CXXRecordDecl *>::getEmptyKey(),
-      clang::CharUnits::fromQuantity(DenseMapInfo<int64_t>::getEmptyKey()));
-  }
-
   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 e6e6b93e0c192..aee838e60f948 100644
--- a/clang/include/clang/AST/CharUnits.h
+++ b/clang/include/clang/AST/CharUnits.h
@@ -230,13 +230,6 @@ inline clang::CharUnits operator* 
(clang::CharUnits::QuantityType Scale,
 namespace llvm {
 
 template<> struct DenseMapInfo<clang::CharUnits> {
-  static clang::CharUnits getEmptyKey() {
-    clang::CharUnits::QuantityType Quantity =
-      DenseMapInfo<clang::CharUnits::QuantityType>::getEmptyKey();
-
-    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 8a173e3d96349..dab8ddc601843 100644
--- a/clang/include/clang/AST/DeclID.h
+++ b/clang/include/clang/AST/DeclID.h
@@ -248,10 +248,6 @@ template <> struct DenseMapInfo<clang::GlobalDeclID> {
   using GlobalDeclID = clang::GlobalDeclID;
   using DeclID = GlobalDeclID::DeclID;
 
-  static GlobalDeclID getEmptyKey() {
-    return GlobalDeclID(DenseMapInfo<DeclID>::getEmptyKey());
-  }
-
   static unsigned getHashValue(const GlobalDeclID &Key) {
     return DenseMapInfo<DeclID>::getHashValue(Key.getRawValue());
   }
@@ -265,10 +261,6 @@ template <> struct DenseMapInfo<clang::LocalDeclID> {
   using LocalDeclID = clang::LocalDeclID;
   using DeclID = LocalDeclID::DeclID;
 
-  static LocalDeclID getEmptyKey() {
-    return LocalDeclID(DenseMapInfo<DeclID>::getEmptyKey());
-  }
-
   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 2cd7efcae5088..3a272c506ca8d 100644
--- a/clang/include/clang/AST/DeclarationName.h
+++ b/clang/include/clang/AST/DeclarationName.h
@@ -924,10 +924,6 @@ namespace llvm {
 /// in DenseMap and DenseSets.
 template<>
 struct DenseMapInfo<clang::DeclarationName> {
-  static inline clang::DeclarationName getEmptyKey() {
-    return clang::DeclarationName::getEmptyMarker();
-  }
-
   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 b9a06afc271ca..0f9ff9496ff88 100644
--- a/clang/include/clang/AST/GlobalDecl.h
+++ b/clang/include/clang/AST/GlobalDecl.h
@@ -215,10 +215,6 @@ class GlobalDecl {
 namespace llvm {
 
   template<> struct DenseMapInfo<clang::GlobalDecl> {
-    static inline clang::GlobalDecl getEmptyKey() {
-      return clang::GlobalDecl();
-    }
-
     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 ac1439c70ce7b..b7d24d5397077 100644
--- a/clang/include/clang/AST/NestedNameSpecifier.h
+++ b/clang/include/clang/AST/NestedNameSpecifier.h
@@ -253,8 +253,6 @@ SourceRange NestedNameSpecifierLocBuilder::getSourceRange() 
const {
 namespace llvm {
 
 template <> struct DenseMapInfo<clang::NestedNameSpecifier> {
-  static clang::NestedNameSpecifier getEmptyKey() { return std::nullopt; }
-
   static unsigned getHashValue(const clang::NestedNameSpecifier &V) {
     return hash_combine(V.getAsVoidPointer());
   }
@@ -264,11 +262,6 @@ template <> struct 
DenseMapInfo<clang::NestedNameSpecifierLoc> {
   using FirstInfo = DenseMapInfo<clang::NestedNameSpecifier>;
   using SecondInfo = DenseMapInfo<void *>;
 
-  static clang::NestedNameSpecifierLoc getEmptyKey() {
-    return clang::NestedNameSpecifierLoc(FirstInfo::getEmptyKey(),
-                                         SecondInfo::getEmptyKey());
-  }
-
   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 6a3f485a5f5da..28fff4f43823c 100644
--- a/clang/include/clang/AST/Redeclarable.h
+++ b/clang/include/clang/AST/Redeclarable.h
@@ -383,14 +383,6 @@ struct DenseMapInfo<clang::CanonicalDeclPtr<decl_type>> {
   using CanonicalDeclPtr = clang::CanonicalDeclPtr<decl_type>;
   using BaseInfo = DenseMapInfo<decl_type *>;
 
-  static CanonicalDeclPtr getEmptyKey() {
-    // Construct our CanonicalDeclPtr this way because the regular constructor
-    // would dereference P.Ptr, which is not allowed.
-    CanonicalDeclPtr P;
-    P.Ptr = BaseInfo::getEmptyKey();
-    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 0626cb97217f2..dd858c8c0b0ca 100644
--- a/clang/include/clang/AST/TypeOrdering.h
+++ b/clang/include/clang/AST/TypeOrdering.h
@@ -36,8 +36,6 @@ struct QualTypeOrdering {
 namespace llvm {
 
   template<> struct DenseMapInfo<clang::QualType> {
-    static inline clang::QualType getEmptyKey() { return clang::QualType(); }
-
     static unsigned getHashValue(clang::QualType Val) {
       return (unsigned)((uintptr_t)Val.getAsOpaquePtr()) ^
             ((unsigned)((uintptr_t)Val.getAsOpaquePtr() >> 9));
@@ -49,10 +47,6 @@ namespace llvm {
   };
 
   template<> struct DenseMapInfo<clang::CanQualType> {
-    static inline clang::CanQualType getEmptyKey() {
-      return clang::CanQualType();
-    }
-
     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 0a89de4dcfeb1..61e01787e3db8 100644
--- a/clang/include/clang/Analysis/Analyses/LifetimeSafety/Utils.h
+++ b/clang/include/clang/Analysis/Analyses/LifetimeSafety/Utils.h
@@ -99,10 +99,6 @@ template <typename Tag>
 struct DenseMapInfo<clang::lifetimes::internal::utils::ID<Tag>> {
   using ID = clang::lifetimes::internal::utils::ID<Tag>;
 
-  static inline ID getEmptyKey() {
-    return {DenseMapInfo<uint32_t>::getEmptyKey()};
-  }
-
   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 4c4b940ef110a..76d1bd1dc9f34 100644
--- a/clang/include/clang/Analysis/CallGraph.h
+++ b/clang/include/clang/Analysis/CallGraph.h
@@ -214,12 +214,6 @@ namespace llvm {
 
 // Specialize DenseMapInfo for clang::CallGraphNode::CallRecord.
 template <> struct DenseMapInfo<clang::CallGraphNode::CallRecord> {
-  static inline clang::CallGraphNode::CallRecord getEmptyKey() {
-    return clang::CallGraphNode::CallRecord(
-        DenseMapInfo<clang::CallGraphNode *>::getEmptyKey(),
-        DenseMapInfo<clang::Expr *>::getEmptyKey());
-  }
-
   static unsigned getHashValue(const clang::CallGraphNode::CallRecord &Val) {
     // NOTE: we are comparing based on the callee only.
  ...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/201987
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to