[PATCH] D74477: [llvm-ar] Simplify Windows comparePaths NFCI
Andrew Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 12 03:56:02 PST 2020
andrewng created this revision.
andrewng added reviewers: rupprecht, grimar.
Herald added a project: LLVM.
Replace use of widenPath in comparePaths with UTF8ToUTF16. widenPath
does a lot more than just conversion from UTF-8 to UTF-16. This is not
necessary for CompareStringOrdinal and could possibly even cause
problems.
https://reviews.llvm.org/D74477
Files:
llvm/tools/llvm-ar/llvm-ar.cpp
Index: llvm/tools/llvm-ar/llvm-ar.cpp
===================================================================
--- llvm/tools/llvm-ar/llvm-ar.cpp
+++ llvm/tools/llvm-ar/llvm-ar.cpp
@@ -21,6 +21,7 @@
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/Chrono.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Format.h"
@@ -518,8 +519,8 @@
// binary equivalence and allows for case insensitivity.
#ifdef _WIN32
SmallVector<wchar_t, 128> WPath1, WPath2;
- failIfError(sys::path::widenPath(normalizePath(Path1), WPath1));
- failIfError(sys::path::widenPath(normalizePath(Path2), WPath2));
+ failIfError(sys::windows::UTF8ToUTF16(normalizePath(Path1), WPath1));
+ failIfError(sys::windows::UTF8ToUTF16(normalizePath(Path2), WPath2));
return CompareStringOrdinal(WPath1.data(), WPath1.size(), WPath2.data(),
WPath2.size(), true) == CSTR_EQUAL;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74477.244122.patch
Type: text/x-patch
Size: 1011 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200212/e272c059/attachment.bin>
More information about the llvm-commits
mailing list