Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lldb/include/lldb/Utility/Scalar.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Scalar {

const char *GetTypeAsCString() const { return GetValueTypeAsCString(m_type); }

void GetValue(Stream *s, bool show_type) const;
void GetValue(Stream &s, bool show_type) const;

bool IsValid() const { return (m_type >= e_int) && (m_type <= e_float); }

Expand Down
4 changes: 3 additions & 1 deletion lldb/source/Core/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ void Value::AppendBytes(const void *bytes, int len) {
}

void Value::Dump(Stream *strm) {
m_value.GetValue(strm, true);
if (!strm)
return;
m_value.GetValue(*strm, true);
strm->Printf(", value_type = %s, context = %p, context_type = %s",
Value::GetValueTypeAsCString(m_value_type), m_context,
Value::GetContextTypeAsCString(m_context_type));
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Interpreter/CommandInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@ CommandInterpreter::PreprocessToken(std::string &expr_str) {

StreamString value_strm;
const bool show_type = false;
scalar.GetValue(&value_strm, show_type);
scalar.GetValue(value_strm, show_type);
size_t value_string_size = value_strm.GetSize();
if (value_string_size) {
expr_str = value_strm.GetData();
Expand Down
10 changes: 5 additions & 5 deletions lldb/source/Utility/Scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,20 @@ bool Scalar::IsZero() const {
return false;
}

void Scalar::GetValue(Stream *s, bool show_type) const {
void Scalar::GetValue(Stream &s, bool show_type) const {
if (show_type)
s->Printf("(%s) ", GetTypeAsCString());
s.Printf("(%s) ", GetTypeAsCString());

switch (m_type) {
case e_void:
break;
case e_int:
s->PutCString(llvm::toString(m_integer, 10));
s.PutCString(llvm::toString(m_integer, 10));
break;
case e_float:
llvm::SmallString<24> string;
m_float.toString(string);
s->PutCString(string);
s.PutCString(string);
break;
}
}
Expand Down Expand Up @@ -894,6 +894,6 @@ bool Scalar::SetBit(uint32_t bit) {

llvm::raw_ostream &lldb_private::operator<<(llvm::raw_ostream &os, const Scalar &scalar) {
StreamString s;
scalar.GetValue(&s, /*show_type*/ true);
scalar.GetValue(s, /*show_type*/ true);
return os << s.GetString();
}
2 changes: 1 addition & 1 deletion lldb/unittests/Utility/ScalarTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ TEST(ScalarTest, ExtractBitfield) {

template <typename T> static std::string ScalarGetValue(T value) {
StreamString stream;
Scalar(value).GetValue(&stream, false);
Scalar(value).GetValue(stream, false);
return std::string(stream.GetString());
}

Expand Down