[libcxx-commits] [PATCH] D91171: [16/N] [libcxx] Implement the permissions function for windows

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 2 13:05:54 PST 2021


mstorsjo added inline comments.


================
Comment at: libcxx/src/filesystem/operations.cpp:460
 ::mode_t posix_convert_perms(perms prms) {
   return static_cast< ::mode_t>(prms & perms::mask);
 }
----------------
ldionne wrote:
> I don't understand the purpose of that function. Isn't that equivalent to just `static_cast<::mode_t>(prms)`?
> 
> If so, this function is called only once below. Why don't we simply use:
> 
> ```
> #if defined(_LIBCPP_WIN32API)
>   using ModeT = int;
> #else
>   using ModeT = ::mode_t;
> #endif
> 
> const auto real_perms = static_cast<ModeT>(prms);
> ```
> 
> Well, you get the idea.
Yeah, that clearly seems better.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91171/new/

https://reviews.llvm.org/D91171



More information about the libcxx-commits mailing list