From f76d93a92f091421f1359636575d61bab7266065 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Fri, 12 May 2017 05:49:54 +0000 Subject: Update StructuredData::String to return StringRefs. It was returning const std::string& which was leading to unnecessary copies all over the place, and preventing people from doing things like Dict->GetValueForKeyAsString("foo", ref); git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@302875 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../StructuredData/DarwinLog/StructuredDataDarwinLog.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/Plugins/StructuredData') diff --git a/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp index 82ecdc5a0..f1450c31b 100644 --- a/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ b/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -1817,7 +1817,7 @@ StructuredDataDarwinLog::DumpHeader(Stream &output_stream, } if (options_sp->GetDisplayActivityChain()) { - std::string activity_chain; + llvm::StringRef activity_chain; if (event.GetValueForKeyAsString("activity-chain", activity_chain) && !activity_chain.empty()) { if (header_count > 0) @@ -1856,7 +1856,7 @@ StructuredDataDarwinLog::DumpHeader(Stream &output_stream, } if (options_sp->GetDisplaySubsystem()) { - std::string subsystem; + llvm::StringRef subsystem; if (event.GetValueForKeyAsString("subsystem", subsystem) && !subsystem.empty()) { if (header_count > 0) @@ -1868,7 +1868,7 @@ StructuredDataDarwinLog::DumpHeader(Stream &output_stream, } if (options_sp->GetDisplayCategory()) { - std::string category; + llvm::StringRef category; if (event.GetValueForKeyAsString("category", category) && !category.empty()) { if (header_count > 0) @@ -1901,16 +1901,16 @@ size_t StructuredDataDarwinLog::HandleDisplayOfEvent( size_t total_bytes = 0; // Grab the message content. - std::string message; + llvm::StringRef message; if (!event.GetValueForKeyAsString("message", message)) return true; // Display the log entry. - const auto len = message.length(); + const auto len = message.size(); total_bytes += DumpHeader(stream, event); - stream.Write(message.c_str(), len); + stream.Write(message.data(), len); total_bytes += len; // Add an end of line. -- cgit v1.2.3