[LLVM][ADT] Add specialization of DenseMapInfo for SourceRange#174524
Merged
localspook merged 4 commits intollvm:mainfrom Jan 6, 2026
Merged
[LLVM][ADT] Add specialization of DenseMapInfo for SourceRange#174524localspook merged 4 commits intollvm:mainfrom
DenseMapInfo for SourceRange#174524localspook merged 4 commits intollvm:mainfrom
Conversation
Member
|
@llvm/pr-subscribers-clang Author: Victor Chernyakin (localspook) ChangesFull diff: https://github.com/llvm/llvm-project/pull/174524.diff 1 Files Affected:
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
|
0f2b5b6 to
adad670
Compare
🐧 Linux x64 Test Results
✅ The build succeeded and all tests passed. |
kuhar
approved these changes
Jan 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.