[ELF] - Update after LLVM r314883 change. NFC.

llvm-svn: 314884
This commit is contained in:
George Rimar 2017-10-04 08:50:34 +00:00
parent 099960d322
commit ed906d8e63
3 changed files with 4 additions and 12 deletions

View File

@ -933,7 +933,7 @@ template <class ELFT> void BinaryFile::parse() {
// characters in a filename are replaced with underscore.
std::string S = "_binary_" + MB.getBufferIdentifier().str();
for (size_t I = 0; I < S.size(); ++I)
if (!elf::isAlnum(S[I]))
if (!isAlnum(S[I]))
S[I] = '_';
Symtab->addRegular<ELFT>(Saver.save(S + "_start"), STV_DEFAULT, STT_OBJECT,

View File

@ -54,18 +54,11 @@ std::vector<uint8_t> elf::parseHex(StringRef S) {
return Hex;
}
static bool isAlpha(char C) {
return ('a' <= C && C <= 'z') || ('A' <= C && C <= 'Z') || C == '_';
}
// Returns true if C is a valid letter, digit or underscore as defined in the
// "C" locale.
bool elf::isAlnum(char C) { return isAlpha(C) || ('0' <= C && C <= '9'); }
// Returns true if S is valid as a C language identifier.
bool elf::isValidCIdentifier(StringRef S) {
return !S.empty() && isAlpha(S[0]) &&
std::all_of(S.begin() + 1, S.end(), isAlnum);
return !S.empty() && (isAlpha(S[0]) || S[0] == '_') &&
std::all_of(S.begin() + 1, S.end(),
[](char C) { return C == '_' || isAlnum(C); });
}
// Returns the demangled C++ symbol name for Name.

View File

@ -22,7 +22,6 @@ namespace lld {
namespace elf {
std::vector<uint8_t> parseHex(StringRef S);
bool isAlnum(char C);
bool isValidCIdentifier(StringRef S);
// This is a lazy version of StringRef. String size is computed lazily