[Lldb-commits] [lldb] [WIP][lldb] Use forward decls with redeclared definitions instead of minimal import for records (PR #95100)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 14 05:24:41 PDT 2024
Michael137 wrote:
> A possibly silly question, but my understanding was that this effort will better align us with the interfaces that are used within clang (for compiling modules I think). Is that correct?
Regarding Clang interfaces, one of the main benefits of this patch is that we can simplify LLDB's interaction with the ASTImporter and also align us with the more tested/robust way of completing types in Clang. E.g., calls to `CompleteType` such as the following might no longer be necessary (at least for LLDB, not sure if other external sources started relying on this): https://github.com/llvm/llvm-project/blob/ad702e057cf7fc1ffdc0f78f563b416170ea7d57/clang/lib/Sema/SemaType.cpp#L9078-L9081
It is true that the `ASTReader` external source implements the completion mechanism via `CompleteRedeclChain`/`ExternalASTSource::IncrementGeneration`, and this patch aligns us with that mechanism. But I'm not familiar enough with the modules infrastructure to confidently say whether there'll be ways to re-use some of it in LLDB (I suspect not, but definitely worth exploring).
> And if so, does it mean that clang does this explosive import whenever it imports a type from a (precompiled) module?
Good question, I haven't dug into the modules import mechanism yet, but if this is true, then that could give us an opportunity to introduce a "lazy method loading" mechanism on the ExternalASTSource that would fit both LLDB and modules? Will try to confirm this (unless someone else knows the answer to this already, e.g., @dwblaikie).
https://github.com/llvm/llvm-project/pull/95100
More information about the lldb-commits
mailing list