[lldb] Split ParseSingleMember into Obj-C property and normal member/ivar parsing code.
Right now DWARFASTParserClang::ParseSingleMember has two parts: One part parses Objective-C properties and the other part parses C/C++ members/Objective-C ivars. These parts are pretty much independent of each other (with one historical exception, see below) and in practice they parse DIEs with different tags/attributes: `DW_TAG_APPLE_property` and `DW_TAG_member`. I don't see a good reason for keeping the different parsing code intertwined in a single function, so instead split out the Objective-C property parser into its own function. Note that 90% of this commit is just unindenting nearly all of `ParseSingleMember` which was inside a `if (tag == DW_TAG_member)` block. I.e., think of the old `ParseSingleMember` function as: The rest is just moving the property parsing code into its own function and I added the ReportError implementation in case we fail to resolve the property type (which before was just a silent failure). ``` lang=c++ void DWARFASTParserClang::ParseSingleMember(...) { [...] if (tag == DW_TAG_member) { [...] // This huge block got unindented in this patch as the `if` above is gone. } if (property) { [...] // This is the property parsing code that is now its own function. } } ``` There is one exception to the rule that the parsers are independent. Before 2012 Objective-C properties were encoded as `DW_TAG_member` with `DW_AT_APPLE_property*` attributes describing the property. In 2012 this has changed in a series of commits (see for example c0449635 which updates the docs) so that `DW_TAG_APPLE_property` is now used for properties. With the old format we first created an ivar and afterwards used the `DW_AT_APPLE_property*` attributes to create the respective property, but there doesn't seem to be any way to create such debug info with any clang from the last 9 years. So this is technically not NFC in case some finds debug info from that time and tries to use properties. Reviewed By: aprantl Differential Revision: https://reviews.llvm.org/D111632
Loading
Please sign in to comment