diff options
author | Alex Langford <alangford@apple.com> | 2023-04-17 16:11:07 -0700 |
---|---|---|
committer | Alex Langford <alangford@apple.com> | 2023-04-17 17:25:05 -0700 |
commit | 8bddb13c2470b95651955c61913627b31e9c99d6 (patch) | |
tree | b66310e7c607ccbea8f3c9f760414dd1a3126afc /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | |
parent | 8c2276f89887d0a27298a1bbbd2181fa54bbb509 (diff) | |
download | llvm-8bddb13c2470b95651955c61913627b31e9c99d6.zip llvm-8bddb13c2470b95651955c61913627b31e9c99d6.tar.gz llvm-8bddb13c2470b95651955c61913627b31e9c99d6.tar.bz2 |
[lldb] Change parameter type of StructuredData::ParseJSON
Instead of taking a `const std::string &` we can take an
`llvm::StringRef`. The motivation for this change is that many of the
callers of `ParseJSON` end up creating a temporary `std::string` from an existing
`StringRef` or `const char *` in order to satisfy the API. There's no
reason we need to do this.
Differential Revision: https://reviews.llvm.org/D148579
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index ab5e19d..858a3e5 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -3781,8 +3781,7 @@ ProcessGDBRemote::GetExtendedInfoForThread(lldb::tid_t tid) { response.GetResponseType(); if (response_type == StringExtractorGDBRemote::eResponse) { if (!response.Empty()) { - object_sp = - StructuredData::ParseJSON(std::string(response.GetStringRef())); + object_sp = StructuredData::ParseJSON(response.GetStringRef()); } } } @@ -3853,8 +3852,7 @@ ProcessGDBRemote::GetLoadedDynamicLibrariesInfos_sender( response.GetResponseType(); if (response_type == StringExtractorGDBRemote::eResponse) { if (!response.Empty()) { - object_sp = - StructuredData::ParseJSON(std::string(response.GetStringRef())); + object_sp = StructuredData::ParseJSON(response.GetStringRef()); } } } @@ -3876,8 +3874,7 @@ StructuredData::ObjectSP ProcessGDBRemote::GetDynamicLoaderProcessState() { response.GetResponseType(); if (response_type == StringExtractorGDBRemote::eResponse) { if (!response.Empty()) { - object_sp = - StructuredData::ParseJSON(std::string(response.GetStringRef())); + object_sp = StructuredData::ParseJSON(response.GetStringRef()); } } } @@ -3909,8 +3906,7 @@ StructuredData::ObjectSP ProcessGDBRemote::GetSharedCacheInfo() { response.GetResponseType(); if (response_type == StringExtractorGDBRemote::eResponse) { if (!response.Empty()) { - object_sp = - StructuredData::ParseJSON(std::string(response.GetStringRef())); + object_sp = StructuredData::ParseJSON(response.GetStringRef()); } } } @@ -5087,8 +5083,7 @@ ParseStructuredDataPacket(llvm::StringRef packet) { } // This is an asynchronous JSON packet, destined for a StructuredDataPlugin. - StructuredData::ObjectSP json_sp = - StructuredData::ParseJSON(std::string(packet)); + StructuredData::ObjectSP json_sp = StructuredData::ParseJSON(packet); if (log) { if (json_sp) { StreamString json_str; |