diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2017-11-13 18:06:43 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2017-11-13 18:06:43 +0000 |
commit | 8aa2f5dbe48308b940dcb49a79a1c6fce34f9633 (patch) | |
tree | 0ce22517b1ea6e74352c78e57a33318a267ed6bc /lld/Common | |
parent | 65232632407753fef88100b6d871106bd6d82d0b (diff) |
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.
Diffstat (limited to 'lld/Common')
-rw-r--r-- | lld/Common/ErrorHandler.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lld/Common/ErrorHandler.cpp b/lld/Common/ErrorHandler.cpp index 52f40c5cf38..cd9f38c4a29 100644 --- a/lld/Common/ErrorHandler.cpp +++ b/lld/Common/ErrorHandler.cpp @@ -46,6 +46,9 @@ ErrorHandler &lld::errorHandler() { } void lld::exitLld(int Val) { + // Delete the output buffer so that any tempory file is deleted. + errorHandler().OutputBuffer.reset(); + // Dealloc/destroy ManagedStatic variables before calling // _exit(). In a non-LTO build, this is a nop. In an LTO // build allows us to get the output of -time-passes. |