Skip to content

Commit 12c0281

Browse files
committed
[Lex] Replace hash_combine with a stable hash
1 parent 8472862 commit 12c0281

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clang/lib/Lex/HeaderSearch.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,19 @@
2525
#include "clang/Lex/Preprocessor.h"
2626
#include "llvm/ADT/APInt.h"
2727
#include "llvm/ADT/Hashing.h"
28+
#include "llvm/ADT/STLExtras.h"
2829
#include "llvm/ADT/SmallString.h"
2930
#include "llvm/ADT/SmallVector.h"
3031
#include "llvm/ADT/Statistic.h"
3132
#include "llvm/ADT/StringRef.h"
32-
#include "llvm/ADT/STLExtras.h"
3333
#include "llvm/Support/Allocator.h"
3434
#include "llvm/Support/Capacity.h"
3535
#include "llvm/Support/Errc.h"
3636
#include "llvm/Support/ErrorHandling.h"
3737
#include "llvm/Support/FileSystem.h"
3838
#include "llvm/Support/Path.h"
3939
#include "llvm/Support/VirtualFileSystem.h"
40+
#include "llvm/Support/xxhash.h"
4041
#include <algorithm>
4142
#include <cassert>
4243
#include <cstddef>
@@ -282,10 +283,10 @@ std::string HeaderSearch::getCachedModuleFileNameImpl(StringRef ModuleName,
282283
if (getModuleMap().canonicalizeModuleMapPath(CanonicalPath))
283284
return {};
284285

285-
llvm::hash_code Hash = llvm::hash_combine(CanonicalPath.str().lower());
286+
auto Hash = llvm::xxh3_64bits(CanonicalPath.str().lower());
286287

287288
SmallString<128> HashStr;
288-
llvm::APInt(64, size_t(Hash)).toStringUnsigned(HashStr, /*Radix*/36);
289+
llvm::APInt(64, Hash).toStringUnsigned(HashStr, /*Radix*/36);
289290
llvm::sys::path::append(Result, ModuleName + "-" + HashStr + ".pcm");
290291
}
291292
return Result.str().str();

0 commit comments

Comments
 (0)