diff options
| author | Eric Christopher <echristo@apple.com> | 2011-11-07 21:49:35 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@apple.com> | 2011-11-07 21:49:35 +0000 |
| commit | ff2edf1499a85114f8a9c8feacd7fbf44ac27953 (patch) | |
| tree | 2048a7a1ede524b040613bc300adcf31cca20b0b /llvm/lib | |
| parent | b6205d8b49646813f0473db3c9dca77ca10940e7 (diff) | |
| download | bcm5719-llvm-ff2edf1499a85114f8a9c8feacd7fbf44ac27953.tar.gz bcm5719-llvm-ff2edf1499a85114f8a9c8feacd7fbf44ac27953.zip | |
Move the hash function to using and taking a StringRef.
llvm-svn: 144024
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.h b/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.h index 4fc6118274e..a0f64f040b4 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfAccelTable.h @@ -69,10 +69,10 @@ class DwarfAccelTable { eHashFunctionDJB = 0u }; - static uint32_t HashDJB (const char *s) { + static uint32_t HashDJB (StringRef Str) { uint32_t h = 5381; - for (unsigned char c = *s; c; c = *++s) - h = ((h << 5) + h) + c; + for (unsigned i = 0, e = Str.size(); i != e; ++i) + h = ((h << 5) + h) + Str[i]; return h; } @@ -190,7 +190,7 @@ public: MCSymbol *Sym; std::vector<uint32_t> DIEOffsets; // offsets HashData(StringRef S) : Str(S) { - HashValue = DwarfAccelTable::HashDJB(S.str().c_str()); + HashValue = DwarfAccelTable::HashDJB(S); } void addOffset(uint32_t off) { DIEOffsets.push_back(off); } #ifndef NDEBUG |

