[llvm] r314899 - [gold-plugin] - Fix compilation after LLVM update (r314883). NFC.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 04:00:30 PDT 2017


Author: grimar
Date: Wed Oct  4 04:00:30 2017
New Revision: 314899

URL: http://llvm.org/viewvc/llvm-project?rev=314899&view=rev
Log:
[gold-plugin] - Fix compilation after LLVM update (r314883). NFC.


Modified:
    llvm/trunk/tools/gold/gold-plugin.cpp

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=314899&r1=314898&r2=314899&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Oct  4 04:00:30 2017
@@ -608,16 +608,11 @@ static std::string getThinLTOObjectFileN
   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,




More information about the llvm-commits mailing list