[llvm] r186588 - Windows/Path.inc: Introduce file_type::character_file and file_type::fifo_file in sys::fs::getStatus(HANDLE).

NAKAMURA Takumi geek4civic at gmail.com
Thu Jul 18 10:00:54 PDT 2013


Author: chapuni
Date: Thu Jul 18 12:00:54 2013
New Revision: 186588

URL: http://llvm.org/viewvc/llvm-project?rev=186588&view=rev
Log:
Windows/Path.inc: Introduce file_type::character_file and file_type::fifo_file in sys::fs::getStatus(HANDLE).

It fixes llvm/test/Other/close-stderr.ll on msys.

FIXME: Provide unittests.

Modified:
    llvm/trunk/lib/Support/Windows/Path.inc
    llvm/trunk/test/Other/close-stderr.ll

Modified: llvm/trunk/lib/Support/Windows/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Path.inc?rev=186588&r1=186587&r2=186588&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc (original)
+++ llvm/trunk/lib/Support/Windows/Path.inc Thu Jul 18 12:00:54 2013
@@ -579,6 +579,19 @@ static error_code getStatus(HANDLE FileH
   if (FileHandle == INVALID_HANDLE_VALUE)
     goto handle_status_error;
 
+  switch (::GetFileType(FileHandle)) {
+  default:
+  case FILE_TYPE_UNKNOWN:
+  case FILE_TYPE_DISK:
+    break;
+  case FILE_TYPE_CHAR:
+    Result = file_status(file_type::character_file);
+    return error_code::success();
+  case FILE_TYPE_PIPE:
+    Result = file_status(file_type::fifo_file);
+    return error_code::success();
+  }
+
   BY_HANDLE_FILE_INFORMATION Info;
   if (!::GetFileInformationByHandle(FileHandle, &Info))
     goto handle_status_error;

Modified: llvm/trunk/test/Other/close-stderr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/close-stderr.ll?rev=186588&r1=186587&r2=186588&view=diff
==============================================================================
--- llvm/trunk/test/Other/close-stderr.ll (original)
+++ llvm/trunk/test/Other/close-stderr.ll Thu Jul 18 12:00:54 2013
@@ -9,9 +9,6 @@
 ; XFAIL: vg_leak
 ; REQUIRES: shell
 
-; FIXME: sys::fs::status() doesn't work on pipes, since r186560.
-; XFAIL: mingw32
-
 ; opt will fail to open /dev/null on native win32.
 ; XFAIL: win32
 





More information about the llvm-commits mailing list