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 | a4884cc38fdf6380d5cb83a8362e4d9219533a33 (patch) | |
tree | bb8682d6be9ea7cad46284f1fc1276d570430b79 /lld/include/lld | |
parent | bd57b8bf3f8244545f6a58a668486f9801f3c43d (diff) | |
download | bcm5719-llvm-a4884cc38fdf6380d5cb83a8362e4d9219533a33.tar.gz bcm5719-llvm-a4884cc38fdf6380d5cb83a8362e4d9219533a33.zip |
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.
llvm-svn: 318060
Diffstat (limited to 'lld/include/lld')
-rw-r--r-- | lld/include/lld/Common/ErrorHandler.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lld/include/lld/Common/ErrorHandler.h b/lld/include/lld/Common/ErrorHandler.h index 05a1d6cd5fc..86d1494932c 100644 --- a/lld/include/lld/Common/ErrorHandler.h +++ b/lld/include/lld/Common/ErrorHandler.h @@ -31,6 +31,7 @@ #include "lld/Common/LLVM.h" #include "llvm/Support/Error.h" +#include "llvm/Support/FileOutputBuffer.h" namespace lld { @@ -52,6 +53,8 @@ public: void message(const Twine &Msg); void warn(const Twine &Msg); + std::unique_ptr<llvm::FileOutputBuffer> OutputBuffer; + private: void print(StringRef S, raw_ostream::Colors C); }; |