[lldb-dev] LLDB Evolution - Final Form
Zachary Turner via lldb-dev
lldb-dev at lists.llvm.org
Mon Sep 19 13:45:52 PDT 2016
On Mon, Sep 19, 2016 at 1:38 PM Sean Callanan <scallanan at apple.com> wrote:
> I'll only comment on the stuff that affects me.
>
>
> 1. Use llvm streams instead of lldb::StreamString
> 1. Supports output re-targeting (stderr, stdout, std::string, etc),
> printf style formatting, and type-safe streaming operators.
> 2. Interoperates nicely with many existing llvm utility classes
> 3. Risk: 4
> 4. Impact: 5
> 5. Difficulty / Effort: 7
>
>
> I don't like that llvm's stringstream needs to be babied to make it
> produce its string. You have to wrap it and then flush it and then read
> the string. Maybe a subclass could be made that wraps its own string and
> flushes automatically on read?
>
You do have to wrap it. But if you call llvm::raw_string_ostream::str(),
it will internally flush before it returns the thing. So if you write:
std::string s;
llvm::raw_string_ostream stream(s);
stream << "foo";
return stream.str();
then the code will be correct. It's still a bit more annoying then if the
string were automatically part of the stream though, so there's probably a
clean way to design a version of it that owns the string.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20160919/52f5b15c/attachment.html>
More information about the lldb-dev
mailing list