[lld] r293142 - Use StringRef::lower only once instead of calling ::tolower many times.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 18:58:39 PST 2017


Author: ruiu
Date: Wed Jan 25 20:58:39 2017
New Revision: 293142

URL: http://llvm.org/viewvc/llvm-project?rev=293142&view=rev
Log:
Use StringRef::lower only once instead of calling ::tolower many times.

Modified:
    lld/trunk/ELF/LinkerScript.cpp

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=293142&r1=293141&r2=293142&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Jan 25 20:58:39 2017
@@ -2054,18 +2054,20 @@ std::pair<uint32_t, uint32_t> ScriptPars
   uint32_t Flags = 0;
   uint32_t NotFlags = 0;
   bool Invert = false;
-  for (char C : next()) {
+
+  for (char C : next().lower()) {
     uint32_t Flag = 0;
     if (C == '!')
       Invert = !Invert;
-    else if (tolower(C) == 'w')
+    else if (C == 'w')
       Flag = SHF_WRITE;
-    else if (tolower(C) == 'x')
+    else if (C == 'x')
       Flag = SHF_EXECINSTR;
-    else if (tolower(C) == 'a')
+    else if (C == 'a')
       Flag = SHF_ALLOC;
-    else if (tolower(C) != 'r')
+    else if (C != 'r')
       setError("invalid memory region attribute");
+
     if (Invert)
       NotFlags |= Flag;
     else




More information about the llvm-commits mailing list