diff options
author | Raphael Isemann <teemperor@gmail.com> | 2021-10-16 13:46:21 +0200 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2021-10-16 14:20:04 +0200 |
commit | 60b96aa65e5959361e9edea15b3591f90988ccad (patch) | |
tree | 226c25f6a7017e4971074db58e9b741794b3ff83 /llvm/lib/Support/ErrorHandling.cpp | |
parent | 48ce523a26b7a5a3dc4cff616c93ed951244746b (diff) | |
download | llvm-60b96aa65e5959361e9edea15b3591f90988ccad.zip llvm-60b96aa65e5959361e9edea15b3591f90988ccad.tar.gz llvm-60b96aa65e5959361e9edea15b3591f90988ccad.tar.bz2 |
[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
c0449635b35b057c5a877343b0c5f14506c7cf02 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
Diffstat (limited to 'llvm/lib/Support/ErrorHandling.cpp')
0 files changed, 0 insertions, 0 deletions