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

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 10:49:17 PDT 2016


> +/// 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?

Cheers,
Rafael


More information about the llvm-commits mailing list