[Lldb-commits] [lldb] [WIP][lldb][DWARFASTParserClang] Eagerly search definitions for Objective-C classes (PR #119860)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 17 13:12:29 PST 2024


Michael137 wrote:

> > I think the way it's currently written doesn't handle the case where we call ParseStructureLikeDIE with a forward declaration, and then later on with a definition DIE. For C++ structures we handle that by updating the UniqueTypeMap with the definition DIE, etc. We'll probably have to do what we do for enums and also put the definition DIE into the DIEToType map.
> 
> In `UniqueTypeMap`, C++ is only special in that the unique name is constructed by walking all the way up in the DIE tree to get its fully qualified name. If we can do something similar when constructing the unique names for objc/objc++, that map should be reusable.
> 
> Actually, there's already a block to eagerly find the complete type when `!is_complete_objc_class` for objc/objc++:
> 
> https://github.com/llvm/llvm-project/blob/c9a5a6d18bd71b203798b9188f565bdf173ad91b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp#L1713-L1715
> 
> . How is it different from the change in this PR? Is `is_complete_objc_class` the same as `!is_forward_declaration`?

Yea that part of the ObjC support is particularly confusing. I added some context here: https://github.com/llvm/llvm-project/pull/120279

It previously had pretty much no coverage (and for some reason `frame var` doesn't need it). Any class that has `is_complete_objc_class` is definitely `!is_forward_declaration`, but the lack of `is_complete_objc_class` doesn't mean it's a forward declaration. There's 3 states of an objective-c type: (1) forward declaration as in other C-languages, (2) interface declarations (which aren't forward declarations in the C and C++ sense), and (3) interface implementations. If `is_complete_objc_class == true` it indicates (3). If `!is_complete_objc_class && !is_forward_declaration` then we're dealing with (2). Otherwise, `is_forward_declaration` is (1) (which never has `is_complete_objc_class` set).

https://github.com/llvm/llvm-project/pull/119860


More information about the lldb-commits mailing list