diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-03-04 10:55:27 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-03-04 10:55:27 +0000 |
commit | ca99ad3f0dfd67d8c3f0873e90afc27ff11c8545 (patch) | |
tree | 76415a3e10929fa0978a20b8ea9056c35474ad19 /llvm/lib/Support/StringRef.cpp | |
parent | 97b935962308680e9f18bba06bcbdd05fdd7b4db (diff) | |
download | bcm5719-llvm-ca99ad3f0dfd67d8c3f0873e90afc27ff11c8545.tar.gz bcm5719-llvm-ca99ad3f0dfd67d8c3f0873e90afc27ff11c8545.zip |
Add generic support for hashing StringRef objects using the new hashing library.
llvm-svn: 152003
Diffstat (limited to 'llvm/lib/Support/StringRef.cpp')
-rw-r--r-- | llvm/lib/Support/StringRef.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp index 44e73254035..1c28bf879e0 100644 --- a/llvm/lib/Support/StringRef.cpp +++ b/llvm/lib/Support/StringRef.cpp @@ -10,6 +10,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/ADT/APInt.h" #include "llvm/ADT/OwningPtr.h" +#include "llvm/ADT/Hashing.h" #include "llvm/ADT/edit_distance.h" #include <bitset> @@ -447,3 +448,9 @@ bool StringRef::getAsInteger(unsigned Radix, APInt &Result) const { return false; } + + +// Implementation of StringRef hashing. +hash_code llvm::hash_value(StringRef S) { + return hash_combine_range(S.begin(), S.end()); +} |