aboutsummaryrefslogtreecommitdiff
path: root/source/Plugins/StructuredData
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-05-12 05:49:54 +0000
committerZachary Turner <zturner@google.com>2017-05-12 05:49:54 +0000
commitf76d93a92f091421f1359636575d61bab7266065 (patch)
tree6b64abbe4f97f9ef0c59bd84463da322b76cc238 /source/Plugins/StructuredData
parent02931751c1b0aab6c404b58513b0f6388343254d (diff)
downloadlldb-f76d93a92f091421f1359636575d61bab7266065.tar.gz
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
Diffstat (limited to 'source/Plugins/StructuredData')
-rw-r--r--source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp12
1 files changed, 6 insertions, 6 deletions
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.