-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] Add color support to StreamString #77380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lldb] Add color support to StreamString #77380
Conversation
This change just adds a `bool colors` parameter to the `StreamString` class's constructor, which it passes up to its superclass’s constructor. rdar://120671168
@llvm/pr-subscribers-lldb Author: Pete Lawrence (PortalPete) ChangesThis change just adds a rdar://120671168 Full diff: https://github.com/llvm/llvm-project/pull/77380.diff 2 Files Affected:
diff --git a/lldb/include/lldb/Utility/StreamString.h b/lldb/include/lldb/Utility/StreamString.h
index 4c568acdcc6f60..3d675caf8f3f43 100644
--- a/lldb/include/lldb/Utility/StreamString.h
+++ b/lldb/include/lldb/Utility/StreamString.h
@@ -22,7 +22,7 @@ namespace lldb_private {
class StreamString : public Stream {
public:
- StreamString();
+ StreamString(bool colors = false);
StreamString(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
diff --git a/lldb/source/Utility/StreamString.cpp b/lldb/source/Utility/StreamString.cpp
index 745a85b7576520..0d35ccbdbbd0f5 100644
--- a/lldb/source/Utility/StreamString.cpp
+++ b/lldb/source/Utility/StreamString.cpp
@@ -11,7 +11,7 @@
using namespace lldb;
using namespace lldb_private;
-StreamString::StreamString() : Stream(0, 4, eByteOrderBig) {}
+StreamString::StreamString(bool colors) : Stream(0, 4, eByteOrderBig, colors) {}
StreamString::StreamString(uint32_t flags, uint32_t addr_size,
ByteOrder byte_order)
|
Surprised that no one is using that constructor, and if that's true - is this change to support something else or just making sure we don't make a mistake in future if we do use this class? |
Me too! The good news is that everything that uses it today (without arguments) won't see any difference, thanks to the default argument to the new parameter, making it opt-in / off by default. |
This change just adds a `bool colors` parameter to the `StreamString` class's constructor, which it passes up to its superclass’s constructor. I'm working on another patch that prints out error messages using a `StreamString` but I wasn't getting colorized text because of this missing implementation detail. rdar://120671168
This change just adds a `bool colors` parameter to the `StreamString` class's constructor, which it passes up to its superclass’s constructor. I'm working on another patch that prints out error messages using a `StreamString` but I wasn't getting colorized text because of this missing implementation detail. rdar://120671168
This change just adds a
bool colors
parameter to theStreamString
class's constructor, which it passes up to its superclass’s constructor.I'm working on another patch that prints out error messages using a
StreamString
but I wasn't getting colorized text because of this missing implementation detail.rdar://120671168