From b5d368e838934c1347063a20302acb0afea5f3ab Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Fri, 18 Apr 2014 22:00:22 +0000 Subject: [PATCH] ProfileData: Don't forward declare ComputeHash and make it static inline llvm-svn: 206663 --- llvm/include/llvm/ProfileData/InstrProfReader.h | 5 +---- llvm/lib/ProfileData/InstrProfIndexed.h | 2 +- llvm/lib/ProfileData/InstrProfReader.cpp | 5 +++++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/llvm/include/llvm/ProfileData/InstrProfReader.h b/llvm/include/llvm/ProfileData/InstrProfReader.h index a9793cf28f20..5b0c6257a631 100644 --- a/llvm/include/llvm/ProfileData/InstrProfReader.h +++ b/llvm/include/llvm/ProfileData/InstrProfReader.h @@ -198,7 +198,6 @@ typedef RawInstrProfReader RawInstrProfReader64; namespace IndexedInstrProf { enum class HashT : uint32_t; -uint64_t ComputeHash(HashT Type, StringRef K); } /// Trait for lookups into the on-disk hash table for the binary instrprof @@ -218,9 +217,7 @@ public: static bool EqualKey(StringRef A, StringRef B) { return A == B; } static StringRef GetInternalKey(StringRef K) { return K; } - hash_value_type ComputeHash(StringRef K) { - return IndexedInstrProf::ComputeHash(HashType, K); - } + hash_value_type ComputeHash(StringRef K); static std::pair ReadKeyDataLength(const unsigned char *&D) { diff --git a/llvm/lib/ProfileData/InstrProfIndexed.h b/llvm/lib/ProfileData/InstrProfIndexed.h index 87eb4c3a0272..ede5368ca2c2 100644 --- a/llvm/lib/ProfileData/InstrProfIndexed.h +++ b/llvm/lib/ProfileData/InstrProfIndexed.h @@ -36,7 +36,7 @@ static inline uint64_t MD5Hash(StringRef Str) { return endian::read(Result); } -uint64_t ComputeHash(HashT Type, StringRef K) { +static inline uint64_t ComputeHash(HashT Type, StringRef K) { switch (Type) { case HashT::MD5: return IndexedInstrProf::MD5Hash(K); diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp index c8d2c2781c7d..4f110a571224 100644 --- a/llvm/lib/ProfileData/InstrProfReader.cpp +++ b/llvm/lib/ProfileData/InstrProfReader.cpp @@ -243,6 +243,11 @@ template class RawInstrProfReader; template class RawInstrProfReader; } +InstrProfLookupTrait::hash_value_type +InstrProfLookupTrait::ComputeHash(StringRef K) { + return IndexedInstrProf::ComputeHash(HashType, K); +} + bool IndexedInstrProfReader::hasFormat(const MemoryBuffer &DataBuffer) { if (DataBuffer.getBufferSize() < 8) return false; -- GitLab