Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 1c60993

Browse files
committed
ProfileData: Don't forward declare ComputeHash and make it static inline
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206663 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 2e3463e commit 1c60993

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

include/llvm/ProfileData/InstrProfReader.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ typedef RawInstrProfReader<uint64_t> RawInstrProfReader64;
198198

199199
namespace IndexedInstrProf {
200200
enum class HashT : uint32_t;
201-
uint64_t ComputeHash(HashT Type, StringRef K);
202201
}
203202

204203
/// Trait for lookups into the on-disk hash table for the binary instrprof
@@ -218,9 +217,7 @@ class InstrProfLookupTrait {
218217
static bool EqualKey(StringRef A, StringRef B) { return A == B; }
219218
static StringRef GetInternalKey(StringRef K) { return K; }
220219

221-
hash_value_type ComputeHash(StringRef K) {
222-
return IndexedInstrProf::ComputeHash(HashType, K);
223-
}
220+
hash_value_type ComputeHash(StringRef K);
224221

225222
static std::pair<offset_type, offset_type>
226223
ReadKeyDataLength(const unsigned char *&D) {

lib/ProfileData/InstrProfIndexed.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static inline uint64_t MD5Hash(StringRef Str) {
3636
return endian::read<uint64_t, little, unaligned>(Result);
3737
}
3838

39-
uint64_t ComputeHash(HashT Type, StringRef K) {
39+
static inline uint64_t ComputeHash(HashT Type, StringRef K) {
4040
switch (Type) {
4141
case HashT::MD5:
4242
return IndexedInstrProf::MD5Hash(K);

lib/ProfileData/InstrProfReader.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,11 @@ template class RawInstrProfReader<uint32_t>;
243243
template class RawInstrProfReader<uint64_t>;
244244
}
245245

246+
InstrProfLookupTrait::hash_value_type
247+
InstrProfLookupTrait::ComputeHash(StringRef K) {
248+
return IndexedInstrProf::ComputeHash(HashType, K);
249+
}
250+
246251
bool IndexedInstrProfReader::hasFormat(const MemoryBuffer &DataBuffer) {
247252
if (DataBuffer.getBufferSize() < 8)
248253
return false;

0 commit comments

Comments
 (0)