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

Marek Kurdej via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 2 13:14:10 PST 2021


curdeius 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);
 }
----------------
mstorsjo wrote:
> 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.
Is then the bit and ` & perms::mask` irrelevant on POSIX?


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