diff options
author | Fangrui Song <i@maskray.me> | 2021-03-11 09:38:15 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2021-03-11 09:38:15 -0800 |
commit | 0890b39ee91d0a6f168e8ba56ecabf0498a8f6e1 (patch) | |
tree | 8a482b0ae3b8095b6edf69953cc49f260bee6310 /lld/Common | |
parent | 49173ca4db21e4d1576c2440b79ebff48c6c4156 (diff) | |
download | llvm-0890b39ee91d0a6f168e8ba56ecabf0498a8f6e1.tar.gz |
[ELF] Simplify isValidCIdentifier. NFC
Diffstat (limited to 'lld/Common')
-rw-r--r-- | lld/Common/Strings.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lld/Common/Strings.cpp b/lld/Common/Strings.cpp index e3148d3d974d..7bf336490dae 100644 --- a/lld/Common/Strings.cpp +++ b/lld/Common/Strings.cpp @@ -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 |