[llvm] r221932 - Avoid usage of char16_t as MSVC "14" doesn't appear to support it

Reid Kleckner reid at kleckner.net
Thu Nov 13 14:09:56 PST 2014


Author: rnk
Date: Thu Nov 13 16:09:56 2014
New Revision: 221932

URL: http://llvm.org/viewvc/llvm-project?rev=221932&view=rev
Log:
Avoid usage of char16_t as MSVC "14" doesn't appear to support it

Fixes the MSVC "14" build.

Modified:
    llvm/trunk/lib/Support/Windows/Program.inc

Modified: llvm/trunk/lib/Support/Windows/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Program.inc?rev=221932&r1=221931&r2=221932&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Program.inc (original)
+++ llvm/trunk/lib/Support/Windows/Program.inc Thu Nov 13 16:09:56 2014
@@ -39,13 +39,13 @@ ErrorOr<std::string> sys::findProgramByN
   if (Name.find_first_of("/\\") != StringRef::npos)
     return std::string(Name);
 
-  const char16_t *Path = nullptr;
-  std::u16string PathStorage;
+  const wchar_t *Path = nullptr;
+  std::wstring PathStorage;
   if (!Paths.empty()) {
     PathStorage.reserve(Paths.size() * MAX_PATH);
     for (unsigned i = 0; i < Paths.size(); ++i) {
       if (i)
-        PathStorage.push_back(';');
+        PathStorage.push_back(L';');
       StringRef P = Paths[i];
       SmallVector<wchar_t, MAX_PATH> TmpPath;
       if (std::error_code EC = windows::UTF8ToUTF16(P, TmpPath))
@@ -73,7 +73,7 @@ ErrorOr<std::string> sys::findProgramByN
 
     do {
       U16Result.reserve(Len);
-      Len = ::SearchPathW((const wchar_t *)Path, c_str(U16Name),
+      Len = ::SearchPathW(Path, c_str(U16Name),
                           U16Ext.empty() ? nullptr : c_str(U16Ext),
                           U16Result.capacity(), U16Result.data(), nullptr);
     } while (Len > U16Result.capacity());





More information about the llvm-commits mailing list