[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
This commit is contained in:
Andrew Ng 2020-02-11 12:28:17 +00:00
parent a0c4d6a1cc
commit a01f774bf4

View File

@ -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 @@ static bool comparePaths(StringRef Path1, StringRef Path2) {
// 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;