[lldb][NFCI] Remove redundant accessibility heuristic in the DWARF parser

Authored by teemperor on Jul 22 2021, 4:31 AM.


[lldb][NFCI] Remove redundant accessibility heuristic in the DWARF parser

LLDB's DWARF parser has some heuristics for guessing and fixing up the
accessibility of C++ class/struct members after they were already created in the
internal Clang AST. The heuristic is that if a struct/class has a base class,
then it's actually a class and it's members are private unless otherwise

From what I can see this heuristic isn't sound and also unnecessary. The idea
that inheritance implies that the class keyword was used and the default
visibility is private is incorrect. Also both GCC and Clang use
DW_TAG_structure_type and DW_TAG_class_type for struct and class types
respectively, so the default visibility we infer from that information is always
correct and there is no need to fix it up.

And finally, the access specifiers we set in the Clang AST are anyway unused
within LLDB. The expression parser explicitly ignores them to give users access
to private members and there is not SBAPI functionality that exposes this

This patch removes all the heuristic code for the reasons above and instead
just relies on the access values we infer from the tag kind and explicit
annotations in DWARF.

This patch is NFCI.

Reviewed By: werat

Differential Revision: https://reviews.llvm.org/D105463