[Lldb-commits] [lldb] r327549 - Use GetItemAtIndexAsString overload for ConstString and move set rather than copy.
Tatyana Krasnukha via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 14 11:29:41 PDT 2018
Author: tkrasnukha
Date: Wed Mar 14 11:29:41 2018
New Revision: 327549
URL: http://llvm.org/viewvc/llvm-project?rev=327549&view=rev
Log:
Use GetItemAtIndexAsString overload for ConstString and move set rather than copy.
Modified:
lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
Modified: lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp?rev=327549&r1=327548&r2=327549&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp Wed Mar 14 11:29:41 2018
@@ -44,13 +44,9 @@ DynamicRegisterInfo::SetRegisterInfo(con
if (dict.GetValueForKeyAsArray("sets", sets)) {
const uint32_t num_sets = sets->GetSize();
for (uint32_t i = 0; i < num_sets; ++i) {
- llvm::StringRef set_name_str;
ConstString set_name;
- if (sets->GetItemAtIndexAsString(i, set_name_str))
- set_name.SetString(set_name_str);
- if (set_name) {
- RegisterSet new_set = {set_name.AsCString(), NULL, 0, NULL};
- m_sets.push_back(new_set);
+ if (sets->GetItemAtIndexAsString(i, set_name) && !set_name.IsEmpty()) {
+ m_sets.push_back({ set_name.AsCString(), NULL, 0, NULL });
} else {
Clear();
printf("error: register sets must have valid names\n");
@@ -59,6 +55,7 @@ DynamicRegisterInfo::SetRegisterInfo(con
}
m_set_reg_nums.resize(m_sets.size());
}
+
StructuredData::Array *regs = nullptr;
if (!dict.GetValueForKeyAsArray("registers", regs))
return 0;
More information about the lldb-commits
mailing list