Skip to content

[Serialization] Use specialized decl hash function for GlobalDeclID #95730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion clang/include/clang/AST/DeclID.h
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
#define LLVM_CLANG_AST_DECLID_H

#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/iterator.h"

#include <climits>
@@ -230,7 +231,11 @@ template <> struct DenseMapInfo<clang::GlobalDeclID> {
}

static unsigned getHashValue(const GlobalDeclID &Key) {
return DenseMapInfo<DeclID>::getHashValue(Key.get());
// Our default hash algorithm for 64 bits integer may not be very good.
// In GlobalDeclID's case, it is pretty common that the lower 32 bits can
// be same.
// FIXME: Remove this when we fix the underlying issue.
return llvm::hash_value(Key.get());
}

static bool isEqual(const GlobalDeclID &L, const GlobalDeclID &R) {