[PATCH] D111947: [Demangle] Rename OutputStream to OutputString

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 18 12:06:48 PDT 2021


dblaikie added inline comments.


================
Comment at: libcxxabi/src/demangle/Utility.h:27
 // has been parsed.
-class OutputStream {
+class OutputString {
   char *Buffer = nullptr;
----------------
ldionne wrote:
> This was arguably written with the intent of being a stream -- that's why the class provides functions like `operator<<`. On the other hand, it also provides some functions like `operator+=`, which don't really belong in a stream, but do belong in a string.
> 
> I feel like this patch as-is kind of breaks what this class was supposed to be, since now we'll have a type that is neither a string nor a stream, but has both `operator+=` and `operator<<`. Do we use `operator<<` widely? If not, would it make sense to remove it altogether and make this closer to a real string? Otherwise, perhaps we could consider naming this something like `OutputBuffer` instead, which IMO makes it less vexing to have an `operator<<` defined on.
> 
> I don't want to stall this solely on picking a name, but I do feel like having a class called `OutputString` yet boasting `operator<<` is really un-idiomatic and I'd like to explore alternatives.
OutputBuffer?


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

https://reviews.llvm.org/D111947



More information about the llvm-commits mailing list