[lld] r193173 - [PECOFF] /manifestuac option is case insensitive.

Rui Ueyama ruiu at google.com
Tue Oct 22 10:56:55 PDT 2013


Author: ruiu
Date: Tue Oct 22 12:56:55 2013
New Revision: 193173

URL: http://llvm.org/viewvc/llvm-project?rev=193173&view=rev
Log:
[PECOFF] /manifestuac option is case insensitive.

Modified:
    lld/trunk/lib/Driver/WinLinkDriver.cpp

Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=193173&r1=193172&r2=193173&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Tue Oct 22 12:56:55 2013
@@ -161,6 +161,13 @@ bool parseManifest(StringRef option, boo
   return true;
 }
 
+// Returns true if \p str starts with \p prefix, ignoring case.
+bool startswith_lower(StringRef str, StringRef prefix) {
+  if (str.size() < prefix.size())
+    return false;
+  return str.substr(0, prefix.size()).equals_lower(prefix);
+}
+
 // Parse /manifestuac:(level=<string>|uiAccess=<string>).
 //
 // The arguments will be embedded to the manifest XML file with no error check,
@@ -172,15 +179,15 @@ bool parseManifestUac(StringRef option,
     option = option.ltrim();
     if (option.empty())
       return true;
-    if (option.startswith("level=")) {
+    if (startswith_lower(option, "level=")) {
       option = option.substr(strlen("level="));
       StringRef value;
       llvm::tie(value, option) = option.split(" ");
       level = value.str();
       continue;
     }
-    if (option.startswith("uiAccess=")) {
-      option = option.substr(strlen("uiAccess="));
+    if (startswith_lower(option, "uiaccess=")) {
+      option = option.substr(strlen("uiaccess="));
       StringRef value;
       llvm::tie(value, option) = option.split(" ");
       uiAccess = value.str();





More information about the llvm-commits mailing list