We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dc74bf7 commit 8c97bd8Copy full SHA for 8c97bd8
llvm/lib/Support/Windows/Path.inc
@@ -623,6 +623,10 @@ std::error_code access(const Twine &Path, AccessMode Mode) {
623
DWORD Attributes = ::GetFileAttributesW(PathUtf16.begin());
624
625
if (Attributes == INVALID_FILE_ATTRIBUTES) {
626
+ // Avoid returning unexpected error codes when querying for existence.
627
+ if (Mode == AccessMode::Exist)
628
+ return errc::no_such_file_or_directory;
629
+
630
// See if the file didn't actually exist.
631
DWORD LastError = ::GetLastError();
632
if (LastError != ERROR_FILE_NOT_FOUND && LastError != ERROR_PATH_NOT_FOUND)
0 commit comments