[lld] r314884 - [ELF] - Update after LLVM r314883 change. NFC.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 4 01:50:35 PDT 2017
Author: grimar
Date: Wed Oct 4 01:50:34 2017
New Revision: 314884
URL: http://llvm.org/viewvc/llvm-project?rev=314884&view=rev
Log:
[ELF] - Update after LLVM r314883 change. NFC.
Modified:
lld/trunk/ELF/InputFiles.cpp
lld/trunk/ELF/Strings.cpp
lld/trunk/ELF/Strings.h
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=314884&r1=314883&r2=314884&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Wed Oct 4 01:50:34 2017
@@ -933,7 +933,7 @@ template <class ELFT> void BinaryFile::p
// 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,
Modified: lld/trunk/ELF/Strings.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Strings.cpp?rev=314884&r1=314883&r2=314884&view=diff
==============================================================================
--- lld/trunk/ELF/Strings.cpp (original)
+++ lld/trunk/ELF/Strings.cpp Wed Oct 4 01:50:34 2017
@@ -54,18 +54,11 @@ std::vector<uint8_t> elf::parseHex(Strin
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.
Modified: lld/trunk/ELF/Strings.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Strings.h?rev=314884&r1=314883&r2=314884&view=diff
==============================================================================
--- lld/trunk/ELF/Strings.h (original)
+++ lld/trunk/ELF/Strings.h Wed Oct 4 01:50:34 2017
@@ -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
More information about the llvm-commits
mailing list