summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
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/Lex
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/Lex')
-rw-r--r--clang/lib/Lex/PTHLexer.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Lex/PTHLexer.cpp b/clang/lib/Lex/PTHLexer.cpp
index d6c20a13d27..be6f6843a29 100644
--- a/clang/lib/Lex/PTHLexer.cpp
+++ b/clang/lib/Lex/PTHLexer.cpp
@@ -23,8 +23,8 @@
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/Token.h"
#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/DJB.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/FileSystem.h"
@@ -145,7 +145,7 @@ bool PTHLexer::LexEndOfFile(Token &Result) {
ParsingPreprocessorDirective = false; // Done parsing the "line".
return true; // Have a token.
}
-
+
assert(!LexingRawMode);
// If we are in a #if directive, emit an error.
@@ -336,7 +336,7 @@ public:
using offset_type = unsigned;
static hash_value_type ComputeHash(internal_key_type x) {
- return llvm::HashString(x.second);
+ return llvm::djbHash(x.second);
}
static std::pair<unsigned, unsigned>
@@ -396,7 +396,7 @@ public:
}
static hash_value_type ComputeHash(const internal_key_type& a) {
- return llvm::HashString(StringRef(a.first, a.second));
+ return llvm::djbHash(StringRef(a.first, a.second));
}
// This hopefully will just get inlined and removed by the optimizer.
OpenPOWER on IntegriCloud