This is an archive of the discontinued LLVM Phabricator instance.

Make sure the temporary file is almost always deleted
ClosedPublic

Authored by rafael on Nov 9 2017, 1:45 PM.

Details

Reviewers
ruiu
Summary

It is really hard to cover restarts in a debug, SIGKILL or power failures.

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 hack, but seemed better than to generalize it to take a callback on construction.

Sending for review with just ELF. It something like this is OK I will update COFF too.

Diff Detail

Event Timeline

rafael created this revision.Nov 9 2017, 1:45 PM
ruiu accepted this revision.Nov 13 2017, 2:34 AM

LGTM

Yeah, this is a bit hacky and we could implement a more abstract way of implementing it (e.g. implementing at_lld_exit() and add this feature using it), but I think this would be too much. Practically, this is probably the best way of doing it.

This revision is now accepted and ready to land.Nov 13 2017, 2:34 AM
espindola closed this revision.Mar 14 2018, 3:30 PM
espindola added a subscriber: espindola.

318060