Since D81803 / 79657e2339b58bc01fe1b85a448bb073d57d90bb, temp files
created on network shares don't set "Disposition.DeleteFile = true".
This flag normally takes care of removing the temp file both if the
process exits abnormally, and when the file is closed cleanly.
Even if we can't seem to use the flag on network shares, we can
at least make sure to remove the temp files when they are closed
cleanly.
This patch adjusts setDeleteDisposition to take a bool &Delete
reference, to let the caller know whether it actually set the
flag or not (on network shares, it returns a success error code
but doesn't do what it was asked to).
When setDeleteDisposition is called from openNativeFile, we can't
easily pass this information back to the caller without adding
extra plumbing through all the layers of functions up to the
caller in TempFile::create.
Instead have TempFile::create() do a duplicate call to
setDeleteDisposition, to see whether it actually sets the
desired flag. If not, set a Windows specific flag in TempFile,
and manually remove the file in discard().
This fixes https://github.com/mstorsjo/llvm-mingw/issues/233.
Whilst modifying the comment, let's capitalize windows -> Windows (since it's a proper noun). I also think it needs a comma.