llvm-project
1efd5c22 - [lldb][DWARFASTParser][NFC] Factor out CXX/ObjC method specifics out of ParseSubroutine (#95078)

Commit
1 year ago
[lldb][DWARFASTParser][NFC] Factor out CXX/ObjC method specifics out of ParseSubroutine (#95078) This patch moves some of the `is_cxx_method`/`objc_method` logic out of `DWARFASTParserClang::ParseSubroutine` into their own functions. Mainly the purpose of this is to (hopefully) make this function more readable by turning the deeply nested if-statements into early-returns. This will be useful in an upcoming change where we remove some of the branches of said if-statement. Considerations: * Would be nice to make them into static helpers in `DWARFASTParserClang.cpp`. That would require them take few more arguments which seemed to get unwieldy. * `HandleCXXMethod` can return three states: (1) found a `TypeSP` we previously parsed (2) successfully set a link between the DIE and DeclContext (3) failure. One could express this with `std::optional<TypeSP>`, but then returning `std::nullopt` vs `nullptr` becomes hard to reason about. So I opted to return `std::pair<bool, TypeSP>`, where the `bool` indicates success and the `TypeSP` the cached type. * `HandleCXXMethod` takes `ignore_containing_context` as an output parameter. Haven't found a great way to do this differently
Author
Parents
Loading