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.
2 parents 25f2be6 + 87156a3 commit f45bfccCopy full SHA for f45bfcc
llvm/lib/Support/Windows/Path.inc
@@ -629,6 +629,10 @@ std::error_code access(const Twine &Path, AccessMode Mode) {
629
DWORD Attributes = ::GetFileAttributesW(PathUtf16.begin());
630
631
if (Attributes == INVALID_FILE_ATTRIBUTES) {
632
+ // Avoid returning unexpected error codes when querying for existence.
633
+ if (Mode == AccessMode::Exist)
634
+ return errc::no_such_file_or_directory;
635
+
636
// See if the file didn't actually exist.
637
DWORD LastError = ::GetLastError();
638
if (LastError != ERROR_FILE_NOT_FOUND && LastError != ERROR_PATH_NOT_FOUND)
0 commit comments