[PATCH] D47688: [Support] Add functions that return native file handles on Windows instead of fds.
Adrian McCarthy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 4 09:40:21 PDT 2018
amccarth accepted this revision.
amccarth added inline comments.
This revision is now accepted and ready to land.
================
Comment at: llvm/lib/Support/Windows/Path.inc:1070
SmallVectorImpl<char> *RealPath) {
- ResultFD = -1;
+ Expected<HANDLE> NativeFile = openNativeFileForRead(Name, RealPath);
+ return nativeFileToFd(std::move(NativeFile), ResultFD, 0);
----------------
zturner wrote:
> amccarth wrote:
> > Does this work? Function returns `Expected<native_file_t>` which is `Expected<void *>`. Can you assign that to `Expected<HANDLE>` and get the implicit (reinterpret) cast from `void *` to `HANDLE`?
> `HANDLE` and `void*` are literally the same type, so yes it should work. From `winnt.h`:
>
> ```
> #ifdef STRICT
> typedef void *HANDLE;
> #else
> typedef PVOID HANDLE;
> #endif
> ```
Oh, duh! I should have realized that.
https://reviews.llvm.org/D47688
More information about the llvm-commits
mailing list