summaryrefslogtreecommitdiff
path: root/lib/Support/Windows/Path.inc
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-07-31 00:10:25 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-07-31 00:10:25 +0000
commit9ce8b2818d0c143fd58f4772d2002a15653079dd (patch)
treea5f87d57bacd9e521b7a5ea12c79e6bc3d76c877 /lib/Support/Windows/Path.inc
parent605b3427a9423c1e291a9e9ab94fd7202ca864ae (diff)
downloadllvm-9ce8b2818d0c143fd58f4772d2002a15653079dd.tar.gz
llvm-9ce8b2818d0c143fd58f4772d2002a15653079dd.tar.bz2
llvm-9ce8b2818d0c143fd58f4772d2002a15653079dd.tar.xz
Fix windows' implementation of status when a file doesn't exist.
The unix one was returning no_such_file_or_directory, but the windows one was return success. Update the one one caller that was depending on the old behavior. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187463 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Windows/Path.inc')
-rw-r--r--lib/Support/Windows/Path.inc17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc
index c1dac91863..52284d94f1 100644
--- a/lib/Support/Windows/Path.inc
+++ b/lib/Support/Windows/Path.inc
@@ -399,8 +399,15 @@ error_code remove(const Twine &path, bool &existed) {
SmallVector<wchar_t, 128> path_utf16;
file_status st;
- if (error_code ec = status(path, st))
- return ec;
+ error_code EC = status(path, st);
+ if (EC) {
+ if (EC == windows_error::file_not_found ||
+ EC == windows_error::path_not_found) {
+ existed = false;
+ return error_code::success();
+ }
+ return EC;
+ }
if (error_code ec = UTF8ToUTF16(path.toStringRef(path_storage),
path_utf16))
@@ -611,11 +618,9 @@ handle_status_error:
Result = file_status(file_type::file_not_found);
else if (EC == windows_error::sharing_violation)
Result = file_status(file_type::type_unknown);
- else {
+ else
Result = file_status(file_type::status_error);
- return EC;
- }
- return error_code::success();
+ return EC;
}
error_code status(const Twine &path, file_status &result) {