[llvm] r278907 - [LTO] Introduce an Output class to wrap the output stream creation (NFC)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 11:11:55 PDT 2016


Hi Rafael!

Great to read you! :)

> On Aug 23, 2016, at 10:49 AM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
> 
>> +/// Return the desired output filename given a base input name, a flag
>> +/// indicating whether a temp file should be generated, and an optional task id.
>> +/// The new filename generated is returned in \p NewFilename.
>> +static void getOutputFileName(SmallString<128> InFilename, bool TempOutFile,
>> +                              SmallString<128> &NewFilename, int TaskID = -1) {
>>   if (TempOutFile) {
>>     std::error_code EC =
>> -        sys::fs::createTemporaryFile("lto-llvm", "o", FD, NewFilename);
>> +        sys::fs::createTemporaryFile("lto-llvm", "o", NewFilename);
> 
> This makes the creation of the temporary file and opening it non
> atomic. Any chance this api could be improved to once again use the
> other createTemporaryFile?

I’ll give a shot.
Why is it a problem in this case?

— 
Mehdi



More information about the llvm-commits mailing list