summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Windows/Path.inc
diff options
context:
space:
mode:
authorAaron Smith <aaron.smith@microsoft.com>2018-04-18 15:26:26 +0000
committerAaron Smith <aaron.smith@microsoft.com>2018-04-18 15:26:26 +0000
commit02caafd7e5594123d44556a800545d7c71b175ff (patch)
treeccc7a89a56ce92fb918e13a9e8c1dcb715cbe5f8 /llvm/lib/Support/Windows/Path.inc
parent10831f594a1d2691a8603584b790dd95e4055a27 (diff)
downloadbcm5719-llvm-02caafd7e5594123d44556a800545d7c71b175ff.tar.gz
bcm5719-llvm-02caafd7e5594123d44556a800545d7c71b175ff.zip
[support] Revert the changes made to Path.inc for the default Windows code page
Path.inc/widenPath tries to decode the path using both UTF-8 and the default Windows code page. This is no longer necessary with the new InitLLVM method which ensures that the command line arguemnts are already UTF-8 on Windows. llvm-svn: 330266
Diffstat (limited to 'llvm/lib/Support/Windows/Path.inc')
-rw-r--r--llvm/lib/Support/Windows/Path.inc16
1 files changed, 5 insertions, 11 deletions
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc
index 3621ac4ad86..6ff9b126a5b 100644
--- a/llvm/lib/Support/Windows/Path.inc
+++ b/llvm/lib/Support/Windows/Path.inc
@@ -63,7 +63,7 @@ namespace llvm {
namespace sys {
namespace path {
-// Convert a (likely) UTF-8 path to UTF-16. Also, if the absolute equivalent of the
+// Convert a UTF-8 path to UTF-16. Also, if the absolute equivalent of the
// path is longer than CreateDirectory can tolerate, make it absolute and
// prefixed by '\\?\'.
std::error_code widenPath(const Twine &Path8,
@@ -72,7 +72,7 @@ std::error_code widenPath(const Twine &Path8,
// Several operations would convert Path8 to SmallString; more efficient to
// do it once up front.
- SmallString<2*MAX_PATH> Path8Str;
+ SmallString<128> Path8Str;
Path8.toVector(Path8Str);
// If we made this path absolute, how much longer would it get?
@@ -112,17 +112,11 @@ std::error_code widenPath(const Twine &Path8,
else
llvm::sys::path::append(FullPath, *I);
}
- Path8Str = FullPath;
+ return UTF8ToUTF16(FullPath, Path16);
}
- // Path8Str now contains the full path or the original path
- // If the conversion from UTF8 to UTF16 fails because of ERROR_NO_UNICODE_TRANSLATION,
- // we also try using the current code page before giving up
- auto ec = UTF8ToUTF16(Path8Str, Path16);
- if (ec == mapWindowsError(ERROR_NO_UNICODE_TRANSLATION)) {
- ec = CurCPToUTF16(Path8Str, Path16);
- }
- return ec;
+ // Just use the caller's original path.
+ return UTF8ToUTF16(Path8Str, Path16);
}
} // end namespace path
OpenPOWER on IntegriCloud