[Common] Discard the temp file while keeping the memory mapping open, on errors

Differential Revision: https://reviews.llvm.org/D51095

llvm-svn: 340635
This commit is contained in:
Martin Storsjo 2018-08-24 18:36:42 +00:00
parent 4153e9fbb1
commit 0f3d8e2360
1 changed files with 3 additions and 2 deletions

View File

@ -47,8 +47,9 @@ ErrorHandler &lld::errorHandler() {
}
void lld::exitLld(int Val) {
// Delete the output buffer so that any tempory file is deleted.
errorHandler().OutputBuffer.reset();
// Delete any temporary file, while keeping the memory mapping open.
if (errorHandler().OutputBuffer)
errorHandler().OutputBuffer->discard();
// Dealloc/destroy ManagedStatic variables before calling
// _exit(). In a non-LTO build, this is a nop. In an LTO