forked from OSchip/llvm-project
Use GetItemAtIndexAsString overload for ConstString and move set rather than copy.
llvm-svn: 327549
This commit is contained in:
parent
d37339d25b
commit
706a8095b3
|
@ -44,13 +44,9 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict,
|
||||||
if (dict.GetValueForKeyAsArray("sets", sets)) {
|
if (dict.GetValueForKeyAsArray("sets", sets)) {
|
||||||
const uint32_t num_sets = sets->GetSize();
|
const uint32_t num_sets = sets->GetSize();
|
||||||
for (uint32_t i = 0; i < num_sets; ++i) {
|
for (uint32_t i = 0; i < num_sets; ++i) {
|
||||||
llvm::StringRef set_name_str;
|
|
||||||
ConstString set_name;
|
ConstString set_name;
|
||||||
if (sets->GetItemAtIndexAsString(i, set_name_str))
|
if (sets->GetItemAtIndexAsString(i, set_name) && !set_name.IsEmpty()) {
|
||||||
set_name.SetString(set_name_str);
|
m_sets.push_back({ set_name.AsCString(), NULL, 0, NULL });
|
||||||
if (set_name) {
|
|
||||||
RegisterSet new_set = {set_name.AsCString(), NULL, 0, NULL};
|
|
||||||
m_sets.push_back(new_set);
|
|
||||||
} else {
|
} else {
|
||||||
Clear();
|
Clear();
|
||||||
printf("error: register sets must have valid names\n");
|
printf("error: register sets must have valid names\n");
|
||||||
|
@ -59,6 +55,7 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict,
|
||||||
}
|
}
|
||||||
m_set_reg_nums.resize(m_sets.size());
|
m_set_reg_nums.resize(m_sets.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
StructuredData::Array *regs = nullptr;
|
StructuredData::Array *regs = nullptr;
|
||||||
if (!dict.GetValueForKeyAsArray("registers", regs))
|
if (!dict.GetValueForKeyAsArray("registers", regs))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue