summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/FileOutputBuffer.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2018-08-24 18:36:22 +0000
committerMartin Storsjo <martin@martin.st>2018-08-24 18:36:22 +0000
commit4153e9fbb1562d765297fec58e903345c9f165c3 (patch)
tree6e2f3df0b3c69a585495e9aee8849697b5d98a1e /llvm/lib/Support/FileOutputBuffer.cpp
parent9920489a2aa2c73b4d757cde0de678a2d68ceab7 (diff)
downloadbcm5719-llvm-4153e9fbb1562d765297fec58e903345c9f165c3.tar.gz
bcm5719-llvm-4153e9fbb1562d765297fec58e903345c9f165c3.zip
[Support] Allow discarding a FileOutputBuffer without removing the memory mapping
Differential Revision: https://reviews.llvm.org/D51095 llvm-svn: 340634
Diffstat (limited to 'llvm/lib/Support/FileOutputBuffer.cpp')
-rw-r--r--llvm/lib/Support/FileOutputBuffer.cpp6
1 files changed, 6 insertions, 0 deletions
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<fs::mapped_file_region> Buffer;
fs::TempFile Temp;
OpenPOWER on IntegriCloud