[PATCH] D47688: [Support] Add functions that return native file handles on Windows instead of fds.

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 4 11:37:59 PDT 2018


zturner updated this revision to Diff 149815.
zturner added a comment.

Changes from first revision:

1. Renamed `native_file_t` -> `file_t`
2. Added a global constant `kInvalidFile` that is `-1` on Unix and `INVALID_FILE_HANDLE` on Windows.
3. Added a `closeFile(file_t &)` method that calls `::close` or `::CloseHandle`, and then sets the parameter to `kInvalidFile` so it can't be re-used.

The in/out parameter of #3 might be objectionable, so if anyone has a strong opinion I can just pass by value and not modify the argument on output.


https://reviews.llvm.org/D47688

Files:
  llvm/include/llvm/Support/FileSystem.h
  llvm/lib/Support/Unix/Path.inc
  llvm/lib/Support/Windows/Path.inc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47688.149815.patch
Type: text/x-patch
Size: 8757 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180604/94bcb369/attachment.bin>


More information about the llvm-commits mailing list