[clang] [Clang][NFC] Remove duplicated specialization of `llvm::DenseMapInfo<llvm::FoldingSetNodeID>` (PR #159718)
Corentin Jabot via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 19 01:14:20 PDT 2025
https://github.com/cor3ntin created https://github.com/llvm/llvm-project/pull/159718
In preparation of #141776
>From de3b12cc09c5d5302e0785c1431ff11650a9c9b6 Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Fri, 19 Sep 2025 10:12:17 +0200
Subject: [PATCH] [Clang][NFC] Remove duplicated specialization of
`llvm::DenseMapInfo<llvm::FoldingSetNodeID>`
In preparation of #141776
---
clang/include/clang/AST/ASTContext.h | 21 +++++++++++++++++++++
clang/lib/AST/ASTContext.cpp | 21 ---------------------
clang/lib/Sema/SemaConcept.cpp | 27 ---------------------------
3 files changed, 21 insertions(+), 48 deletions(-)
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index b8f6de69bbb98..1bb9de70008b7 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -3843,4 +3843,25 @@ typename clang::LazyGenerationalUpdatePtr<Owner, T, Update>::ValueType
return Value;
}
+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();
+ }
+
+ static bool isEqual(const FoldingSetNodeID &LHS,
+ const FoldingSetNodeID &RHS) {
+ return LHS == RHS;
+ }
+};
+
#endif // LLVM_CLANG_AST_ASTCONTEXT_H
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 5240054c2f36b..e49ff9080571e 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -114,27 +114,6 @@ enum FloatingRank {
Ibm128Rank
};
-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();
- }
-
- static bool isEqual(const FoldingSetNodeID &LHS,
- const FoldingSetNodeID &RHS) {
- return LHS == RHS;
- }
-};
-
/// \returns The locations that are relevant when searching for Doc comments
/// related to \p D.
static SmallVector<SourceLocation, 2>
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index f114173a42c21..d238b7916a330 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -1864,33 +1864,6 @@ NormalizedConstraint::getFoldExpandedConstraint() const {
// ------------------------ Subsumption -----------------------------------
//
//
-
-template <> struct llvm::DenseMapInfo<llvm::FoldingSetNodeID> {
-
- static FoldingSetNodeID getEmptyKey() {
- FoldingSetNodeID ID;
- ID.AddInteger(std::numeric_limits<unsigned>::max());
- return ID;
- }
-
- static FoldingSetNodeID getTombstoneKey() {
- FoldingSetNodeID ID;
- for (unsigned 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();
- }
-
- static bool isEqual(const FoldingSetNodeID &LHS,
- const FoldingSetNodeID &RHS) {
- return LHS == RHS;
- }
-};
-
SubsumptionChecker::SubsumptionChecker(Sema &SemaRef,
SubsumptionCallable Callable)
: SemaRef(SemaRef), Callable(Callable), NextID(1) {}
More information about the cfe-commits
mailing list