[llvm] r200040 - Make ObjectFile ownership of the MemoryBuffer optional.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Fri Jan 24 14:35:08 PST 2014


> I'm not sure exactly what would be an improvement but it doesn't seem great
> to have three manual buffer deletes. I guess let's just keep an eye open for
> options here.

3? The handling in llvm-ar will get quiet a bit better with c++11
since then owning pointers have move semantics and can go in a vector.

> Refcounting isn't great either because it becomes less clear who's holding
> the allocation. Perhaps we want something like a MemoryBuffer dup facility
> or centralized management of mapped files? Feels like we're missing a good
> solution in various parts of LLVM right now using MemoryBuffer.

I can see the point for a central MemoryBuffer manager for, for
example, avoiding using too many open files, but I am would still try
no not refcount the handles if it is always clear that there is only
one owner.

Cheers,
Rafael



More information about the llvm-commits mailing list