Try harder to delete the temporary file.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 13 Nov 2017 18:06:43 +0000 (18:06 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 13 Nov 2017 18:06:43 +0000 (18:06 +0000)
commita4884cc38fdf6380d5cb83a8362e4d9219533a33
treebb8682d6be9ea7cad46284f1fc1276d570430b79
parentbd57b8bf3f8244545f6a58a668486f9801f3c43d
Try harder to delete the temporary file.

It is really hard to cover restarts in a debugger, SIGKILL or power
failures. I will try to handle them in a followup patch, but it will
not support all the systems lld has to run on.

RemoveFileOnSignal takes care of crashes.

So what is left is making sure all regular exits delete the file. This
patch does that by moving the buffer to error handling. That is a bit
of a hack, but seemed better than to generalize it to take a callback on
construction.

I will implement this on COFF on the next patch.

llvm-svn: 318060
lld/Common/ErrorHandler.cpp
lld/ELF/Writer.cpp
lld/include/lld/Common/ErrorHandler.h