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 | 2dd5e1e64d718a0aeaaf988a54d5acc0ec70f243 (patch) | |
tree | 1908fbdea6aed677d64bb5999c603dc9c94b9e26 /lib/CodeGen/AsmPrinter/DwarfAccelTable.h | |
parent | e77546c3c3634863a79ffc3adea52882685db454 (diff) |
Move the hash function to using and taking a StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144024 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfAccelTable.h')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfAccelTable.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfAccelTable.h b/lib/CodeGen/AsmPrinter/DwarfAccelTable.h index 4fc6118274..a0f64f040b 100644 --- a/lib/CodeGen/AsmPrinter/DwarfAccelTable.h +++ b/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 |