[PATCH] D19838: [LLVM-AR] Fixed bug where temporary file would be left behind every time an archive was updated
Cameron via llvm-commits
llvm-commits at lists.llvm.org
Tue May 3 14:49:17 PDT 2016
cameron314 added a comment.
@silvas: Yes, that's exactly what I discovered too while debugging this.
================
Comment at: include/llvm/Object/Archive.h:179
@@ +178,3 @@
+ // We supply two flavours of constructors, one that can work with an existing
+ // buffer, and another that takes over ownership of a buffer. It is sometimes
+ // important to link ownership of the buffer with the archive in the case where
----------------
rafael wrote:
> We really should not do this.
>
> All these objects just wrap a MemoryBufferRef. It is llvm-ar that should be deleting these buffers earlier.
Ideally, I agree. But the design is such that llvm-ar has no control over when the buffer is done being used. It passes an `Archive` off to `writeArchive` which consumes it and does the file replacement in one step. I thought about splitting that function in two, but that's even uglier.
This was the cleanest way of fixing the bug I could come up with.
Repository:
rL LLVM
http://reviews.llvm.org/D19838
More information about the llvm-commits
mailing list