Skip to content

Commit f96a759

Browse files
authored
[Clang][NFC] Remove duplicated specialization of llvm::DenseMapInfo<llvm::FoldingSetNodeID> (#159718)
In preparation of #141776
1 parent 143551a commit f96a759

File tree

3 files changed

+21
-48
lines changed

3 files changed

+21
-48
lines changed

clang/include/clang/AST/ASTContext.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3843,4 +3843,25 @@ typename clang::LazyGenerationalUpdatePtr<Owner, T, Update>::ValueType
38433843
return Value;
38443844
}
38453845

3846+
template <> struct llvm::DenseMapInfo<llvm::FoldingSetNodeID> {
3847+
static FoldingSetNodeID getEmptyKey() { return FoldingSetNodeID{}; }
3848+
3849+
static FoldingSetNodeID getTombstoneKey() {
3850+
FoldingSetNodeID ID;
3851+
for (size_t I = 0; I < sizeof(ID) / sizeof(unsigned); ++I) {
3852+
ID.AddInteger(std::numeric_limits<unsigned>::max());
3853+
}
3854+
return ID;
3855+
}
3856+
3857+
static unsigned getHashValue(const FoldingSetNodeID &Val) {
3858+
return Val.ComputeHash();
3859+
}
3860+
3861+
static bool isEqual(const FoldingSetNodeID &LHS,
3862+
const FoldingSetNodeID &RHS) {
3863+
return LHS == RHS;
3864+
}
3865+
};
3866+
38463867
#endif // LLVM_CLANG_AST_ASTCONTEXT_H

clang/lib/AST/ASTContext.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -114,27 +114,6 @@ enum FloatingRank {
114114
Ibm128Rank
115115
};
116116

117-
template <> struct llvm::DenseMapInfo<llvm::FoldingSetNodeID> {
118-
static FoldingSetNodeID getEmptyKey() { return FoldingSetNodeID{}; }
119-
120-
static FoldingSetNodeID getTombstoneKey() {
121-
FoldingSetNodeID id;
122-
for (size_t i = 0; i < sizeof(id) / sizeof(unsigned); ++i) {
123-
id.AddInteger(std::numeric_limits<unsigned>::max());
124-
}
125-
return id;
126-
}
127-
128-
static unsigned getHashValue(const FoldingSetNodeID &Val) {
129-
return Val.ComputeHash();
130-
}
131-
132-
static bool isEqual(const FoldingSetNodeID &LHS,
133-
const FoldingSetNodeID &RHS) {
134-
return LHS == RHS;
135-
}
136-
};
137-
138117
/// \returns The locations that are relevant when searching for Doc comments
139118
/// related to \p D.
140119
static SmallVector<SourceLocation, 2>

clang/lib/Sema/SemaConcept.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,33 +1864,6 @@ NormalizedConstraint::getFoldExpandedConstraint() const {
18641864
// ------------------------ Subsumption -----------------------------------
18651865
//
18661866
//
1867-
1868-
template <> struct llvm::DenseMapInfo<llvm::FoldingSetNodeID> {
1869-
1870-
static FoldingSetNodeID getEmptyKey() {
1871-
FoldingSetNodeID ID;
1872-
ID.AddInteger(std::numeric_limits<unsigned>::max());
1873-
return ID;
1874-
}
1875-
1876-
static FoldingSetNodeID getTombstoneKey() {
1877-
FoldingSetNodeID ID;
1878-
for (unsigned I = 0; I < sizeof(ID) / sizeof(unsigned); ++I) {
1879-
ID.AddInteger(std::numeric_limits<unsigned>::max());
1880-
}
1881-
return ID;
1882-
}
1883-
1884-
static unsigned getHashValue(const FoldingSetNodeID &Val) {
1885-
return Val.ComputeHash();
1886-
}
1887-
1888-
static bool isEqual(const FoldingSetNodeID &LHS,
1889-
const FoldingSetNodeID &RHS) {
1890-
return LHS == RHS;
1891-
}
1892-
};
1893-
18941867
SubsumptionChecker::SubsumptionChecker(Sema &SemaRef,
18951868
SubsumptionCallable Callable)
18961869
: SemaRef(SemaRef), Callable(Callable), NextID(1) {}

0 commit comments

Comments
 (0)