[PATCH] D91693: [Support] Add reserve() method to the raw_ostream.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 20 05:37:16 PST 2020


avl added a comment.

> Yeah, I suppose that's reasonable. Though, if the scope of this is small (e.g.: it only needs to write to files _or_ memory buffers, and it's not going go have a lot of callers/large surface area), I would not completely dismiss some custom solution either...

This work is done exactly because of scope for custom solution become wider. There is a D88827 <https://reviews.llvm.org/D88827> review which tries to move core implementation of llvm-objcopy into the Object library. So there is a request to avoid using custom solution in favor of more standard one. That is why I am trying to replace custom llvm-objcopy solution(D91028 <https://reviews.llvm.org/D91028>).

> I don't think that would be *un*reasonable, but I'd wait until a use case for it shows up.

There is such a use case in D91028 <https://reviews.llvm.org/D91028>

  SmallVector<char, 0> Buffer;
  raw_svector_ostream MemStream(Buffer);
  
  if (Error E = executeObjcopyOnBinary(Config, **ObjOrErr, MemStream))
    return E;


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91693/new/

https://reviews.llvm.org/D91693



More information about the llvm-commits mailing list