summaryrefslogtreecommitdiff
path: root/lldb/unittests
diff options
context:
space:
mode:
authorAlex Langford <alangford@apple.com>2023-04-17 16:11:07 -0700
committerAlex Langford <alangford@apple.com>2023-04-17 17:25:05 -0700
commit8bddb13c2470b95651955c61913627b31e9c99d6 (patch)
treeb66310e7c607ccbea8f3c9f760414dd1a3126afc /lldb/unittests
parent8c2276f89887d0a27298a1bbbd2181fa54bbb509 (diff)
downloadllvm-8bddb13c2470b95651955c61913627b31e9c99d6.tar.gz
[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/unittests')
-rw-r--r--lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp2
-rw-r--r--lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp3
2 files changed, 2 insertions, 3 deletions
diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
index f3eea2869048..bf43881f4905 100644
--- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -287,7 +287,7 @@ TEST_F(GDBRemoteCommunicationClientTest, TestPacketSpeedJSON) {
server_thread.join();
GTEST_LOG_(INFO) << "Formatted output: " << ss.GetData();
- auto object_sp = StructuredData::ParseJSON(std::string(ss.GetString()));
+ auto object_sp = StructuredData::ParseJSON(ss.GetString());
ASSERT_TRUE(bool(object_sp));
auto dict_sp = object_sp->GetAsDictionary();
ASSERT_TRUE(bool(dict_sp));
diff --git a/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp b/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
index a2627ad0cc9f..f131bd98c2e8 100644
--- a/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
+++ b/lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
@@ -96,8 +96,7 @@ Expected<JThreadsInfo> JThreadsInfo::create(StringRef Response,
ArrayRef<RegisterInfo> RegInfos) {
JThreadsInfo jthreads_info;
- StructuredData::ObjectSP json =
- StructuredData::ParseJSON(std::string(Response));
+ StructuredData::ObjectSP json = StructuredData::ParseJSON(Response);
StructuredData::Array *array = json->GetAsArray();
if (!array)
return make_parsing_error("JThreadsInfo: JSON array");