[llvm] [Support] Report EISDIR when opening a directory (PR #79880)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 00:07:30 PDT 2024


================
@@ -1296,6 +1296,29 @@ TEST_F(FileSystemTest, UTF8ToUTF16DirectoryIteration) {
 }
 #endif
 
+TEST_F(FileSystemTest, OpenDirectoryAsFileForRead) {
+  std::string Buf(5, '?');
+  Expected<fs::file_t> FD = fs::openNativeFileForRead(TestDirectory);
+#ifdef _WIN32
+  ASSERT_EQ(errorToErrorCode(BytesRead.takeError()), errc::is_a_directory);
----------------
jh7370 wrote:

Windows build is failing here. It's quite hard to check the state of an `Expected` when it's not been declared yet...

https://github.com/llvm/llvm-project/pull/79880


More information about the llvm-commits mailing list