https://github.com/localspook created https://github.com/llvm/llvm-project/pull/174524
None >From 0f765712a6c5586478656998f15a3b581f09d704 Mon Sep 17 00:00:00 2001 From: Victor Chernyakin <[email protected]> Date: Mon, 5 Jan 2026 19:24:37 -0800 Subject: [PATCH] [LLVM][ADT] Add specialization of `DenseMapInfo` for `SourceRange` --- clang/include/clang/Basic/SourceLocation.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/clang/include/clang/Basic/SourceLocation.h b/clang/include/clang/Basic/SourceLocation.h index 14543cc41a38e..85fe65901d207 100644 --- a/clang/include/clang/Basic/SourceLocation.h +++ b/clang/include/clang/Basic/SourceLocation.h @@ -521,6 +521,27 @@ namespace llvm { static void Profile(const clang::SourceLocation &X, FoldingSetNodeID &ID); }; + template <> struct DenseMapInfo<clang::SourceRange, void> { + static clang::SourceRange getEmptyKey() { + return {DenseMapInfo<clang::SourceLocation>::getEmptyKey(), + DenseMapInfo<clang::SourceLocation>::getEmptyKey()}; + } + + static clang::SourceRange getTombstoneKey() { + return {DenseMapInfo<clang::SourceLocation>::getTombstoneKey(), + DenseMapInfo<clang::SourceLocation>::getTombstoneKey()}; + } + + static unsigned getHashValue(clang::SourceRange Range) { + return detail::combineHashValue(Range.getBegin().getHashValue(), + Range.getEnd().getHashValue()); + } + + static bool isEqual(clang::SourceRange LHS, clang::SourceRange RHS) { + return LHS == RHS; + } + }; + } // namespace llvm #endif // LLVM_CLANG_BASIC_SOURCELOCATION_H _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
