[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Adjust language type for conflicting Objective-C++ forward declarations (PR #130768)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 20 07:23:33 PDT 2025


Michael137 wrote:

> > Essentially you're suggesting going back to pre-#90663, but only if we have ObjC/ObjC++ CUs in the current module? Seems sensible to me. Will also help prevent similar issues from creeping up in the future
> 
> Yes, I think that is the best approach do to do definition search (devil's in the details of course), though I'm still not very happy about having to do this search in the first place.
> 
> Overall, I think I'd like the "forceful completion" approach more, though I understand it's fraught with more perils. I'm reasonably confident it can be made to work in the expression evaluator, but things like "frame variable" (which work directly on the module AST) are trickier, and I never got that to work with -flimit-debug-info (ran out of time). This case should be slightly simpler than that for two reasons:
> 
> * both of the types are in the same module (no need to jump to another module to search for the definition)
> * You don't need to support cases where another class inherits from a "forcefully completed" class
> 
> So, it _might_ be possible to implement something like this inside the `CompilerType` class, where if you get asked for a property of a type, and you see that it's one of these weird "maybe ObjC" types, you return the relevant property of the ObjC counterpart instead.

Coming back to this now. IIUC, you're saying when we `CompleteType` one of these C++ forward declarations, if `FindDefintionDIE` returns an Objective-C definition, we bail out of starting/completing the definition and keep it as a C++ forward declaration but mark the `CompilerType` as one of those mixed decls? I guess what I'm not seeing is when and where we would stash away the Objective-C decl so the `CompilerType` can do the switch? Also, to make this work with the expression evaluator we need to make sure that when Clang asks for a complete definition using the `ExternalASTSource`, we will be able to provide one

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


More information about the lldb-commits mailing list