Skip to content

Commit 45d4d1c

Browse files
🍒 [lldb] Remove CompilerType::GetIndexOfFieldWithName (llvm#135963) (#10641)
* [lldb] Remove CompilerType::GetIndexOfFieldWithName (llvm#135963) This patch removes the unused `CompilerType::GetIndexOfFieldWithName` API (it wasn't used apart from in a single testcase). Given we have so many similarly named APIs already, it's best not to maintain this API that's not really used (and isnt tested). * fix build error
1 parent 4e5e1d5 commit 45d4d1c

File tree

3 files changed

+6
-28
lines changed

3 files changed

+6
-28
lines changed

lldb/include/lldb/Symbol/CompilerType.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,6 @@ class CompilerType {
464464

465465
CompilerDecl GetStaticFieldWithName(llvm::StringRef name) const;
466466

467-
uint32_t GetIndexOfFieldWithName(const char *name,
468-
CompilerType *field_compiler_type = nullptr,
469-
uint64_t *bit_offset_ptr = nullptr,
470-
uint32_t *bitfield_bit_size_ptr = nullptr,
471-
bool *is_bitfield_ptr = nullptr) const;
472-
473467
llvm::Expected<CompilerType> GetChildCompilerTypeAtIndex(
474468
ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers,
475469
bool omit_empty_base_classes, bool ignore_array_bounds,

lldb/source/Symbol/CompilerType.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -941,25 +941,6 @@ CompilerDecl CompilerType::GetStaticFieldWithName(llvm::StringRef name) const {
941941
return CompilerDecl();
942942
}
943943

944-
uint32_t CompilerType::GetIndexOfFieldWithName(
945-
const char *name, CompilerType *field_compiler_type_ptr,
946-
uint64_t *bit_offset_ptr, uint32_t *bitfield_bit_size_ptr,
947-
bool *is_bitfield_ptr) const {
948-
unsigned count = GetNumFields();
949-
std::string field_name;
950-
for (unsigned index = 0; index < count; index++) {
951-
CompilerType field_compiler_type(
952-
GetFieldAtIndex(index, field_name, bit_offset_ptr,
953-
bitfield_bit_size_ptr, is_bitfield_ptr));
954-
if (strcmp(field_name.c_str(), name) == 0) {
955-
if (field_compiler_type_ptr)
956-
*field_compiler_type_ptr = field_compiler_type;
957-
return index;
958-
}
959-
}
960-
return UINT32_MAX;
961-
}
962-
963944
llvm::Expected<CompilerType> CompilerType::GetChildCompilerTypeAtIndex(
964945
ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers,
965946
bool omit_empty_base_classes, bool ignore_array_bounds,

lldb/unittests/Platform/PlatformSiginfoTest.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,12 @@ class PlatformSiginfoTest : public ::testing::Test {
6161
uint64_t total_offset = 0;
6262
for (auto field_name : llvm::split(path, '.')) {
6363
uint64_t bit_offset;
64-
ASSERT_NE(field_type.GetIndexOfFieldWithName(field_name.str().c_str(),
65-
&field_type, &bit_offset),
66-
UINT32_MAX);
64+
std::string name;
65+
lldb_private::ExecutionContext exe_ctx{};
66+
field_type = field_type.GetFieldAtIndex(
67+
field_type.GetIndexOfChildWithName(field_name, &exe_ctx, false), name,
68+
&bit_offset, nullptr, nullptr);
69+
ASSERT_TRUE(field_type);
6770
total_offset += bit_offset;
6871
}
6972

0 commit comments

Comments
 (0)