summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CacheTokens.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-02-26 11:30:13 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-02-26 11:30:13 +0000
commitb9ad17593511a6ea513c237bd4efd760c9fb762b (patch)
tree7ad47c3bc9e83216580843c7e5f0552187f482e8 /clang/lib/Frontend/CacheTokens.cpp
parentb84e158df7ff87d16141d798a47de3dc430036df (diff)
downloadbcm5719-llvm-b9ad17593511a6ea513c237bd4efd760c9fb762b.tar.gz
bcm5719-llvm-b9ad17593511a6ea513c237bd4efd760c9fb762b.zip
[Support] Replace HashString with djbHash.
This removes the HashString function from StringExtraces and replaces its uses with calls to djbHash from DJB.h This is *almost* NFC. While the algorithm is identical, the djbHash implementation in StringExtras used 0 as its seed while the implementation in DJB uses 5381. The latter has been shown to result in less collisions and improved avalanching. https://reviews.llvm.org/D43615 (cherry picked from commit 77f7f965bc9499a9ae768a296ca5a1f7347d1d2c) llvm-svn: 326081
Diffstat (limited to 'clang/lib/Frontend/CacheTokens.cpp')
-rw-r--r--clang/lib/Frontend/CacheTokens.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CacheTokens.cpp b/clang/lib/Frontend/CacheTokens.cpp
index 851ea25e9b1..f3569edc695 100644
--- a/clang/lib/Frontend/CacheTokens.cpp
+++ b/clang/lib/Frontend/CacheTokens.cpp
@@ -21,8 +21,8 @@
#include "clang/Lex/Lexer.h"
#include "clang/Lex/PTHManager.h"
#include "clang/Lex/Preprocessor.h"
-#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
+#include "llvm/Support/DJB.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -128,7 +128,7 @@ public:
typedef unsigned offset_type;
static hash_value_type ComputeHash(PTHEntryKeyVariant V) {
- return llvm::HashString(V.getString());
+ return llvm::djbHash(V.getString());
}
static std::pair<unsigned,unsigned>
@@ -625,7 +625,7 @@ public:
typedef unsigned offset_type;
static hash_value_type ComputeHash(PTHIdKey* key) {
- return llvm::HashString(key->II->getName());
+ return llvm::djbHash(key->II->getName());
}
static std::pair<unsigned,unsigned>
OpenPOWER on IntegriCloud