clayborg wrote:

The main issue we have is they way that clang works currently with the external 
AST source. We currently create a forward declaration type "struct Foo;" and we 
allow it to be completed once. Once it is completed clang expects the struct 
type to have everything that it needs, like all contained types (forward decls 
are allowed), otherwise we will never find that type as the external AST source 
thinks it is done. 

I would like to avoid having to find _all_ copies of a struct type and parse 
all contained types in all of matching entries from everywhere in the DWARF if 
possible. If we did this then we would be parsing tons of debug info to add any 
and all potentially contained types and that would cause way too much debug 
info to be parsed.

The best solution I can think of is to have the compile continue to call the 
external AST source to say "please find this type within this struct/class". 
These calls don't happen today, but if they did, we could do this very 
efficiently without having to populate all contained types into every 
struct/class anytime we complete the type.

So right now the flow is:
- any struct/class gets created as a forward declaration and has the external 
AST source enabled
- the external AST calls to complete the type when needed by expression parser 
or LLDB APIs
- we complete the type
- we remove the external AST flag on the type so no more external AST calls 
happen on this class

The new flow could be:
- any struct/class gets created as a forward declaration and has the external 
AST source enabled
- the external AST calls to complete the type when needed by expression parser 
or LLDB APIs
- we complete the type
- we leave the external AST enabled so we can get called for contained types

The last item here would require modifications to clang which could be debugger 
specific changes that are only enabled in a special debug compiler mode so they 
don't affect the actual compiler. Thoughts?

https://github.com/llvm/llvm-project/pull/77029
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to