From: Rafael Espindola Date: Tue, 8 Nov 2016 14:04:16 +0000 (+0000) Subject: cleanup hashSysV a bit. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=174270cc4c9554c69b50c61c49f8b82424792014;p=llvm cleanup hashSysV a bit. Don't pass a reference to a StringRef and use a range loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286232 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Object/ELF.h b/include/llvm/Object/ELF.h index 02becfdd042..95b513f293f 100644 --- a/include/llvm/Object/ELF.h +++ b/include/llvm/Object/ELF.h @@ -506,10 +506,10 @@ ErrorOr ELFFile::getSectionName(const Elf_Shdr *Section, /// This function returns the hash value for a symbol in the .dynsym section /// Name of the API remains consistent as specified in the libelf /// REF : http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#hash -static inline unsigned hashSysV(StringRef &symbolName) { +inline unsigned hashSysV(StringRef SymbolName) { unsigned h = 0, g; - for (unsigned i = 0, j = symbolName.size(); i < j; i++) { - h = (h << 4) + symbolName[i]; + for (char C : SymbolName) { + h = (h << 4) + C; g = h & 0xf0000000L; if (g != 0) h ^= g >> 24;