Skip to content

Commit 430fc53

Browse files
committed
[llvm-ar] Simplify Windows comparePaths NFCI
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. Differential Revision: https://reviews.llvm.org/D74477
1 parent fe6983a commit 430fc53

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/tools/llvm-ar/llvm-ar.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "llvm/Object/ObjectFile.h"
2222
#include "llvm/Support/Chrono.h"
2323
#include "llvm/Support/CommandLine.h"
24+
#include "llvm/Support/ConvertUTF.h"
2425
#include "llvm/Support/Errc.h"
2526
#include "llvm/Support/FileSystem.h"
2627
#include "llvm/Support/Format.h"
@@ -518,8 +519,8 @@ static bool comparePaths(StringRef Path1, StringRef Path2) {
518519
// binary equivalence and allows for case insensitivity.
519520
#ifdef _WIN32
520521
SmallVector<wchar_t, 128> WPath1, WPath2;
521-
failIfError(sys::path::widenPath(normalizePath(Path1), WPath1));
522-
failIfError(sys::path::widenPath(normalizePath(Path2), WPath2));
522+
failIfError(sys::windows::UTF8ToUTF16(normalizePath(Path1), WPath1));
523+
failIfError(sys::windows::UTF8ToUTF16(normalizePath(Path2), WPath2));
523524

524525
return CompareStringOrdinal(WPath1.data(), WPath1.size(), WPath2.data(),
525526
WPath2.size(), true) == CSTR_EQUAL;

0 commit comments

Comments
 (0)