[Lldb-commits] [lldb] [lldb] Remove CompilerType::GetIndexOfFieldWithName (PR #135963)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 16 14:28:30 PDT 2025
Michael137 wrote:
> > We probably shouldnt be removing the test. Is there some way to test whatever we used to test without the API?
>
> I see 2 options:
>
> 1. Move the body of `CompilerType::GetIndexOfFieldWithName` into the test directly. This way, we remove the API but keep the test.
> 2. Keep the API, use `llvm::Expected` and keep the test.
>
> I feel like `1` would be `hiding` the API, and I would therefore prefer `2`.
I think the test can just do this:
```
uint64_t bit_offset;
std::string name;
field_type = field_type.GetFieldAtIndex(
field_type.GetIndexOfChildWithName(field_name, /*omit_empty_base_classes=*/false),
name, &bit_offset, nullptr, nullptr);
ASSERT_TRUE(field_type);
```
Instead of using `CompilerType::GetIndexOfFieldWithName` (though I haven't actually tried to compile/run this)
Don't have a strong opinion on whether to remove or extend the API. Personally I prefer removing it just because we already have so many similarly named APIs across CompilerType/TypeSystemClang that do things slightly differently, that it would be nice to get rid of at least one of them.
https://github.com/llvm/llvm-project/pull/135963
More information about the lldb-commits
mailing list