[llvm] r185832 - Create files with the correct permission instead of changing it afterwards.

Sean Silva silvas at purdue.edu
Fri Jul 12 19:16:58 PDT 2013


The raw calls to open/close in this code (and the corresponding #ifdef's)
make me sad. It seems like the whole reason that this code is using raw
calls to open() and close() is because of

1. This call to sys::fs::setLastModificationAndAccessTime, which needs the
FD. Would it be possible to add a getter to raw_fd_ostream for getting the
FD? Then you could use tool_output_file.os().get_fd() instead of keeping
the FD around explicitly.

2. Setting the mode. It seems like we could just add an extra argument
(defaulted to 0644) to raw_fd_ostream's constructor, which can then just
pass it in on the call <
http://llvm.org/docs/doxygen/html/raw__ostream_8cpp_source.html#l00464>.

Also can we use tool_output_file here (after adding a default parameter to
the constructor that gets passed though to raw_fd_ostream's constructor)?

Also, for the O_* constants above, you can use the corresponding F_* flags
which will then get appropriately translated into O_* flags if necessary by
<http://llvm.org/docs/doxygen/html/raw__ostream_8cpp_source.html#l00451>

-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130712/c91b0eb0/attachment.html>


More information about the llvm-commits mailing list