From: Daniel Dunbar Date: Sat, 17 Oct 2009 23:52:28 +0000 (+0000) Subject: Switch to llvm::HashString. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2596e429a61602312bdd149786045b8a90cd2d10;p=clang Switch to llvm::HashString. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84375 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index 96fc7d69f1..87caf77098 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -28,6 +28,7 @@ #include "clang/Basic/FileManager.h" #include "clang/Basic/TargetInfo.h" #include "clang/Basic/Version.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/Bitcode/BitstreamReader.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/MemoryBuffer.h" @@ -410,7 +411,7 @@ public: unsigned R = 5381; for (unsigned I = 0; I != N; ++I) if (IdentifierInfo *II = Sel.getIdentifierInfoForSlot(I)) - R = clang::BernsteinHashPartial(II->getName(), II->getLength(), R); + R = llvm::HashString(II->getName(), R); return R; } @@ -520,7 +521,7 @@ public: } static unsigned ComputeHash(const internal_key_type& a) { - return BernsteinHash(a.first, a.second); + return llvm::HashString(llvm::StringRef(a.first, a.second)); } // This hopefully will just get inlined and removed by the optimizer. @@ -730,7 +731,7 @@ class VISIBILITY_HIDDEN PCHStatLookupTrait { typedef PCHStatData data_type; static unsigned ComputeHash(const char *path) { - return BernsteinHash(path); + return llvm::HashString(path); } static internal_key_type GetInternalKey(const char *path) { return path; } diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp index a6ee441c86..40c9e1f085 100644 --- a/lib/Frontend/PCHWriter.cpp +++ b/lib/Frontend/PCHWriter.cpp @@ -31,6 +31,7 @@ #include "clang/Basic/Version.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/APInt.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/Bitcode/BitstreamWriter.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/MemoryBuffer.h" @@ -707,7 +708,7 @@ public: typedef const data_type& data_type_ref; static unsigned ComputeHash(const char *path) { - return BernsteinHash(path); + return llvm::HashString(path); } std::pair @@ -1295,7 +1296,7 @@ public: unsigned R = 5381; for (unsigned I = 0; I != N; ++I) if (IdentifierInfo *II = Sel.getIdentifierInfoForSlot(I)) - R = clang::BernsteinHashPartial(II->getName(), II->getLength(), R); + R = llvm::HashString(II->getName(), R); return R; } @@ -1504,7 +1505,7 @@ public: : Writer(Writer), PP(PP) { } static unsigned ComputeHash(const IdentifierInfo* II) { - return clang::BernsteinHash(II->getName()); + return llvm::HashString(II->getName()); } std::pair diff --git a/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp index f804f82c48..8ca1ec016f 100644 --- a/lib/Lex/PTHLexer.cpp +++ b/lib/Lex/PTHLexer.cpp @@ -20,8 +20,9 @@ #include "clang/Lex/PTHManager.h" #include "clang/Lex/Token.h" #include "clang/Lex/Preprocessor.h" -#include "llvm/ADT/StringMap.h" #include "llvm/ADT/OwningPtr.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringMap.h" #include "llvm/Support/MemoryBuffer.h" #include using namespace clang; @@ -308,7 +309,7 @@ public: typedef std::pair internal_key_type; static unsigned ComputeHash(internal_key_type x) { - return BernsteinHash(x.second); + return llvm::HashString(x.second); } static std::pair @@ -363,7 +364,7 @@ public: } static unsigned ComputeHash(const internal_key_type& a) { - return BernsteinHash(a.first, a.second); + return llvm::HashString(llvm::StringRef(a.first, a.second)); } // This hopefully will just get inlined and removed by the optimizer.