diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h --- a/llvm/include/llvm/ADT/Hashing.h +++ b/llvm/include/llvm/ADT/Hashing.h @@ -683,4 +683,16 @@ } // namespace llvm +/// Implement std::hash so that hash_code can be used in STL containers. +namespace std { + +template<> +struct hash { + size_t operator()(llvm::hash_code const& Val) const { + return Val; + } +}; + +} // namespace std; + #endif diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h --- a/llvm/include/llvm/ProfileData/SampleProf.h +++ b/llvm/include/llvm/ProfileData/SampleProf.h @@ -1412,7 +1412,7 @@ /// Note: when populating container, make sure to assign the SampleContext to /// the mapped value immediately because the key no longer holds it. class SampleProfileMap - : public HashKeyMap { + : public HashKeyMap { public: // Convenience method because this is being used in many places. Set the // FunctionSamples' context if its newly inserted. @@ -1424,12 +1424,12 @@ } iterator find(const SampleContext &Ctx) { - return HashKeyMap::find( + return HashKeyMap::find( Ctx); } const_iterator find(const SampleContext &Ctx) const { - return HashKeyMap::find( + return HashKeyMap::find( Ctx); } @@ -1449,8 +1449,8 @@ } size_t erase(const SampleContext &Ctx) { - return HashKeyMap::erase( - Ctx); + return HashKeyMap:: + erase(Ctx); } size_t erase(const key_type &Key) { return base_type::erase(Key); }