[gold-plugin] - Fix compilation after LLVM update (r314883). NFC.
authorGeorge Rimar <grimar@accesssoftek.com>
Wed, 4 Oct 2017 11:00:30 +0000 (11:00 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Wed, 4 Oct 2017 11:00:30 +0000 (11:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314899 91177308-0d34-0410-b5e6-96231b3b80d8

tools/gold/gold-plugin.cpp

index b0538b359f02e35b3c5e21dc2760770edaad73f3..9c6de14af65937c854115eb64e81a13eda5adcff 100644 (file)
@@ -608,16 +608,11 @@ static std::string getThinLTOObjectFileName(StringRef Path, StringRef OldSuffix,
   return NewNewPath;
 }
 
-static bool isAlpha(char C) {
-  return ('a' <= C && C <= 'z') || ('A' <= C && C <= 'Z') || C == '_';
-}
-
-static bool isAlnum(char C) { return isAlpha(C) || ('0' <= C && C <= '9'); }
-
 // Returns true if S is valid as a C language identifier.
 static bool 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); });
 }
 
 static void addModule(LTO &Lto, claimed_file &F, const void *View,