Author: Raphael Isemann Date: 2020-05-22T11:24:48+02:00 New Revision: bca378f68a7d21f9da7d2f86a54fdbb5604b4d05
URL: https://github.com/llvm/llvm-project/commit/bca378f68a7d21f9da7d2f86a54fdbb5604b4d05 DIFF: https://github.com/llvm/llvm-project/commit/bca378f68a7d21f9da7d2f86a54fdbb5604b4d05.diff LOG: [lldb][NFC] Overload raw_ostream operator << for ConstString Summary: We are not doing this very often, but sometimes it's convenient when I can just << ConstStrings into llvm::errs() during testing. Reviewers: labath, JDevlieghere Reviewed By: labath, JDevlieghere Subscribers: JDevlieghere Differential Revision: https://reviews.llvm.org/D80310 Added: Modified: lldb/include/lldb/Utility/ConstString.h lldb/source/Core/Section.cpp lldb/source/Symbol/Function.cpp Removed: ################################################################################ diff --git a/lldb/include/lldb/Utility/ConstString.h b/lldb/include/lldb/Utility/ConstString.h index c2419407f2f6..1e55b2ebb957 100644 --- a/lldb/include/lldb/Utility/ConstString.h +++ b/lldb/include/lldb/Utility/ConstString.h @@ -490,6 +490,11 @@ template <> struct ScalarTraits<lldb_private::ConstString> { static QuotingType mustQuote(StringRef S) { return QuotingType::Double; } }; } // namespace yaml + +inline raw_ostream &operator<<(raw_ostream &os, lldb_private::ConstString s) { + os << s.GetStringRef(); + return os; +} } // namespace llvm LLVM_YAML_IS_SEQUENCE_VECTOR(lldb_private::ConstString) diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp index ce4715721ee7..9bf1c62c5ab8 100644 --- a/lldb/source/Core/Section.cpp +++ b/lldb/source/Core/Section.cpp @@ -337,7 +337,7 @@ void Section::DumpName(llvm::raw_ostream &s) const { if (name && name[0]) s << name << '.'; } - s << m_name.GetStringRef(); + s << m_name; } bool Section::IsDescendant(const Section *section) { diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp index 0b1f6a8c3a3d..953c77632e01 100644 --- a/lldb/source/Symbol/Function.cpp +++ b/lldb/source/Symbol/Function.cpp @@ -374,9 +374,9 @@ void Function::GetDescription(Stream *s, lldb::DescriptionLevel level, *s << "id = " << (const UserID &)*this; if (name) - *s << ", name = \"" << name.GetCString() << '"'; + s->AsRawOstream() << ", name = \"" << name << '"'; if (mangled) - *s << ", mangled = \"" << mangled.GetCString() << '"'; + s->AsRawOstream() << ", mangled = \"" << mangled << '"'; *s << ", range = "; Address::DumpStyle fallback_style; if (level == eDescriptionLevelVerbose) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits