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

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 15:27:05 PST 2021


dblaikie added inline comments.


================
Comment at: llvm/include/llvm/Support/raw_ostream.h:634
+
+  void reserve(size_t Capacity) override { OS.reserve(Capacity); }
 };
----------------
Would it make sense for the reserve operation to be relative to where the stream has reached so far?

ie: for it to be implemented as:
```
void reserve(size_t ExtraCapacity) override { OS.reserve(OS.size() + ExtraCapacity); }
```
(similarly for other implementations)
Because the average caller probably shouldn't be thinking about how many bytes have already been written to the stream when deciding how much capacity they want for future write operations?


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