<div dir="ltr">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<div><br></div><div>
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.</div>
<div><br></div><div>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 <<a href="http://llvm.org/docs/doxygen/html/raw__ostream_8cpp_source.html#l00464">http://llvm.org/docs/doxygen/html/raw__ostream_8cpp_source.html#l00464</a>>.</div>
<div><br></div><div style>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)?</div><div style><br></div><div style>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 <<a href="http://llvm.org/docs/doxygen/html/raw__ostream_8cpp_source.html#l00451">http://llvm.org/docs/doxygen/html/raw__ostream_8cpp_source.html#l00451</a>></div>
<div style><br></div><div style>-- Sean Silva</div></div>