mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
[ELF] Simplify isValidCIdentifier. NFC
This commit is contained in:
@@ -76,9 +76,8 @@ std::vector<uint8_t> lld::parseHex(StringRef s) {
|
||||
|
||||
// Returns true if S is valid as a C language identifier.
|
||||
bool lld::isValidCIdentifier(StringRef s) {
|
||||
return !s.empty() && (isAlpha(s[0]) || s[0] == '_') &&
|
||||
std::all_of(s.begin() + 1, s.end(),
|
||||
[](char c) { return c == '_' || isAlnum(c); });
|
||||
return !s.empty() && !isDigit(s[0]) &&
|
||||
llvm::all_of(s, [](char c) { return isAlnum(c) || c == '_'; });
|
||||
}
|
||||
|
||||
// Write the contents of the a buffer to a file
|
||||
|
||||
Reference in New Issue
Block a user