Skip to content

Commit f135ce6

Browse files
[lldb] Remove CompilerType::GetIndexOfFieldWithName (#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).
1 parent d744596 commit f135ce6

File tree

3 files changed

+5
-28
lines changed

3 files changed

+5
-28
lines changed

lldb/include/lldb/Symbol/CompilerType.h

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

434434
CompilerDecl GetStaticFieldWithName(llvm::StringRef name) const;
435435

436-
uint32_t GetIndexOfFieldWithName(const char *name,
437-
CompilerType *field_compiler_type = nullptr,
438-
uint64_t *bit_offset_ptr = nullptr,
439-
uint32_t *bitfield_bit_size_ptr = nullptr,
440-
bool *is_bitfield_ptr = nullptr) const;
441-
442436
llvm::Expected<CompilerType> GetChildCompilerTypeAtIndex(
443437
ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers,
444438
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
@@ -893,25 +893,6 @@ CompilerDecl CompilerType::GetStaticFieldWithName(llvm::StringRef name) const {
893893
return CompilerDecl();
894894
}
895895

896-
uint32_t CompilerType::GetIndexOfFieldWithName(
897-
const char *name, CompilerType *field_compiler_type_ptr,
898-
uint64_t *bit_offset_ptr, uint32_t *bitfield_bit_size_ptr,
899-
bool *is_bitfield_ptr) const {
900-
unsigned count = GetNumFields();
901-
std::string field_name;
902-
for (unsigned index = 0; index < count; index++) {
903-
CompilerType field_compiler_type(
904-
GetFieldAtIndex(index, field_name, bit_offset_ptr,
905-
bitfield_bit_size_ptr, is_bitfield_ptr));
906-
if (strcmp(field_name.c_str(), name) == 0) {
907-
if (field_compiler_type_ptr)
908-
*field_compiler_type_ptr = field_compiler_type;
909-
return index;
910-
}
911-
}
912-
return UINT32_MAX;
913-
}
914-
915896
llvm::Expected<CompilerType> CompilerType::GetChildCompilerTypeAtIndex(
916897
ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers,
917898
bool omit_empty_base_classes, bool ignore_array_bounds,

lldb/unittests/Platform/PlatformSiginfoTest.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ class PlatformSiginfoTest : public ::testing::Test {
6060
uint64_t total_offset = 0;
6161
for (auto field_name : llvm::split(path, '.')) {
6262
uint64_t bit_offset;
63-
ASSERT_NE(field_type.GetIndexOfFieldWithName(field_name.str().c_str(),
64-
&field_type, &bit_offset),
65-
UINT32_MAX);
63+
std::string name;
64+
field_type = field_type.GetFieldAtIndex(
65+
field_type.GetIndexOfChildWithName(field_name, false), name,
66+
&bit_offset, nullptr, nullptr);
67+
ASSERT_TRUE(field_type);
6668
total_offset += bit_offset;
6769
}
6870

0 commit comments

Comments
 (0)