diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-31 00:10:25 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-31 00:10:25 +0000 |
commit | 107b74c6c36b832924a061db9cc12a8a9428d6a4 (patch) | |
tree | c1bb6f47d239c3271a37ce5521932ad2187f4639 /llvm/lib/Support/Windows/Path.inc | |
parent | c7be519dc004a51cbb2db1ab8c450eec9d2305eb (diff) | |
download | bcm5719-llvm-107b74c6c36b832924a061db9cc12a8a9428d6a4.tar.gz bcm5719-llvm-107b74c6c36b832924a061db9cc12a8a9428d6a4.zip |
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.
llvm-svn: 187463
Diffstat (limited to 'llvm/lib/Support/Windows/Path.inc')
-rw-r--r-- | llvm/lib/Support/Windows/Path.inc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc index c1dac918635..52284d94f1a 100644 --- a/llvm/lib/Support/Windows/Path.inc +++ b/llvm/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) { |