From 4153e9fbb1562d765297fec58e903345c9f165c3 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Fri, 24 Aug 2018 18:36:22 +0000 Subject: [Support] Allow discarding a FileOutputBuffer without removing the memory mapping Differential Revision: https://reviews.llvm.org/D51095 llvm-svn: 340634 --- llvm/lib/Support/FileOutputBuffer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib/Support') diff --git a/llvm/lib/Support/FileOutputBuffer.cpp b/llvm/lib/Support/FileOutputBuffer.cpp index 1214b5a0ba1..b8223126227 100644 --- a/llvm/lib/Support/FileOutputBuffer.cpp +++ b/llvm/lib/Support/FileOutputBuffer.cpp @@ -61,6 +61,12 @@ public: consumeError(Temp.discard()); } + void discard() override { + // Delete the temp file if it still was open, but keeping the mapping + // active. + consumeError(Temp.discard()); + } + private: std::unique_ptr Buffer; fs::TempFile Temp; -- cgit v1.2.3