================
----------------
ojhunt wrote:
I feel like I've seen index searches before, so there should probably be a
method on ASTContext - something like `std::optional<unsigned>
getFieldIndex(const RecordDecl*, const FieldDecl*)` and then we get
```cpp
if (auto SelfIndex = Context.getFieldIndex(RD, KnownField)) {
FieldIndex = *SelfIndex;
} else {
// A field of another record: its cached index isn't RD's numbering ....
}
```
I'd kind of prefer both branches abstracted behind getFieldIndex, but I'm
unsure if the direct subobject field is useful (or even expected) in other
cases? If we think that's reasonable/safe then essentially this entire if/else
would end on in the getFieldIndex method.
https://github.com/llvm/llvm-project/pull/225573
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits