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

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 24 11:36:43 PDT 2018


Author: mstorsjo
Date: Fri Aug 24 11:36:42 2018
New Revision: 340635

URL: http://llvm.org/viewvc/llvm-project?rev=340635&view=rev
Log:
[Common] Discard the temp file while keeping the memory mapping open, on errors

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

Modified:
    lld/trunk/Common/ErrorHandler.cpp

Modified: lld/trunk/Common/ErrorHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/Common/ErrorHandler.cpp?rev=340635&r1=340634&r2=340635&view=diff
==============================================================================
--- lld/trunk/Common/ErrorHandler.cpp (original)
+++ lld/trunk/Common/ErrorHandler.cpp Fri Aug 24 11:36:42 2018
@@ -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




More information about the llvm-commits mailing list