[Lldb-commits] [PATCH] D152870: [lldb][NFCI] Remove StructuredData::Array::GetItemAtIndexAsString overloads with ConstString
Alex Langford via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 29 16:05:01 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5d49c9ce6588: [lldb][NFCI] Remove StructuredData::Array::GetItemAtIndexAsString overloads… (authored by bulbazord).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152870/new/
https://reviews.llvm.org/D152870
Files:
lldb/include/lldb/Utility/StructuredData.h
lldb/source/Target/DynamicRegisterInfo.cpp
Index: lldb/source/Target/DynamicRegisterInfo.cpp
===================================================================
--- lldb/source/Target/DynamicRegisterInfo.cpp
+++ lldb/source/Target/DynamicRegisterInfo.cpp
@@ -144,21 +144,20 @@
uint32_t composite_offset = UINT32_MAX;
for (uint32_t composite_idx = 0; composite_idx < num_composite_regs;
++composite_idx) {
- ConstString composite_reg_name;
- if (!composite_reg_list.GetItemAtIndexAsString(composite_idx,
- composite_reg_name, nullptr))
+ llvm::StringRef composite_reg_name;
+ if (!composite_reg_list.GetItemAtIndexAsString(composite_idx, composite_reg_name))
return llvm::createStringError(
llvm::inconvertibleErrorCode(),
"\"composite\" list value is not a Python string at index %d",
composite_idx);
const RegisterInfo *composite_reg_info =
- GetRegisterInfo(composite_reg_name.GetStringRef());
+ GetRegisterInfo(composite_reg_name);
if (!composite_reg_info)
return llvm::createStringError(
llvm::inconvertibleErrorCode(),
"failed to find composite register by name: \"%s\"",
- composite_reg_name.GetCString());
+ composite_reg_name.str().c_str());
composite_offset =
std::min(composite_offset, composite_reg_info->byte_offset);
@@ -206,9 +205,10 @@
if (dict.GetValueForKeyAsArray("sets", sets)) {
const uint32_t num_sets = sets->GetSize();
for (uint32_t i = 0; i < num_sets; ++i) {
- ConstString set_name;
- if (sets->GetItemAtIndexAsString(i, set_name) && !set_name.IsEmpty()) {
- m_sets.push_back({set_name.AsCString(), nullptr, 0, nullptr});
+ llvm::StringRef set_name;
+ if (sets->GetItemAtIndexAsString(i, set_name) && !set_name.empty()) {
+ m_sets.push_back(
+ {ConstString(set_name).AsCString(), nullptr, 0, nullptr});
} else {
Clear();
printf("error: register sets must have valid names\n");
@@ -345,12 +345,12 @@
const size_t num_regs = invalidate_reg_list->GetSize();
if (num_regs > 0) {
for (uint32_t idx = 0; idx < num_regs; ++idx) {
- ConstString invalidate_reg_name;
+ llvm::StringRef invalidate_reg_name;
uint64_t invalidate_reg_num;
if (invalidate_reg_list->GetItemAtIndexAsString(
idx, invalidate_reg_name)) {
const RegisterInfo *invalidate_reg_info =
- GetRegisterInfo(invalidate_reg_name.GetStringRef());
+ GetRegisterInfo(invalidate_reg_name);
if (invalidate_reg_info) {
m_invalidate_regs_map[i].push_back(
invalidate_reg_info->kinds[eRegisterKindLLDB]);
@@ -359,7 +359,7 @@
// format
printf("error: failed to find a 'invalidate-regs' register for "
"\"%s\" while parsing register \"%s\"\n",
- invalidate_reg_name.GetCString(), reg_info.name);
+ invalidate_reg_name.str().c_str(), reg_info.name);
}
} else if (invalidate_reg_list->GetItemAtIndexAsInteger(
idx, invalidate_reg_num)) {
Index: lldb/include/lldb/Utility/StructuredData.h
===================================================================
--- lldb/include/lldb/Utility/StructuredData.h
+++ lldb/include/lldb/Utility/StructuredData.h
@@ -266,25 +266,6 @@
return success;
}
- bool GetItemAtIndexAsString(size_t idx, ConstString &result) const {
- ObjectSP value_sp = GetItemAtIndex(idx);
- if (value_sp.get()) {
- if (auto string_value = value_sp->GetAsString()) {
- result = ConstString(string_value->GetValue());
- return true;
- }
- }
- return false;
- }
-
- bool GetItemAtIndexAsString(size_t idx, ConstString &result,
- const char *default_val) const {
- bool success = GetItemAtIndexAsString(idx, result);
- if (!success)
- result.SetCString(default_val);
- return success;
- }
-
bool GetItemAtIndexAsDictionary(size_t idx, Dictionary *&result) const {
result = nullptr;
ObjectSP value_sp = GetItemAtIndex(idx);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152870.554516.patch
Type: text/x-patch
Size: 4310 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230829/a3a42e83/attachment-0001.bin>
More information about the lldb-commits
mailing list