This is an archive of the discontinued LLVM Phabricator instance.

Support outputting to /dev/null
ClosedPublic

Authored by rafael on Jan 9 2017, 8:18 AM.

Details

Reviewers
ruiu
Summary

This is an alternative that involves a smaller code difference for regular and non regular files.

Diff Detail

Event Timeline

rafael updated this revision to Diff 83627.Jan 9 2017, 8:18 AM
rafael retitled this revision from to Support outputting to /dev/null.
rafael updated this object.
rafael added a reviewer: ruiu.
rafael added a subscriber: llvm-commits.
ruiu added inline comments.Jan 9 2017, 10:57 AM
lib/Support/FileOutputBuffer.cpp
62–63

Remove else.

72–73

Update the comment.

94

You want to call this only when IsRegular.

rafael updated this revision to Diff 83665.Jan 9 2017, 12:16 PM

Address comments.

rafael updated this revision to Diff 83683.Jan 9 2017, 1:32 PM

Delete temp file.

ruiu accepted this revision.Jan 9 2017, 1:39 PM
ruiu edited edge metadata.

LGTM with this fix.

lib/Support/FileOutputBuffer.cpp
128

I think I now understand why we had this code in the first place, and I believe we want to call this for both IsRegular and !IsRegular.

Once we are done with a temporary file, we rename or remove the temporary file, so the path will become nonexistent. After that, we don't want to try to remove that path, because it is useless, and sometimes harmful, if other process happens to use the same temporary filename.

This revision is now accepted and ready to land.Jan 9 2017, 1:39 PM
espindola closed this revision.Mar 14 2018, 4:27 PM
espindola added a subscriber: espindola.

291485