[clang] fix-149477-- Emit correct closure members for lambdas in CreateLimitedType (PR #149674)
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 22 09:41:11 PDT 2025
dwblaikie wrote:
> According to my understanding, this issue happens because when a standard library header like uses a function-local lambda, the compiler generates a closure type for that lambda sometimes this closure type gets added to the debug info without including its captured variables.
>
> when LLDB runs import std and tries to inspect types that indirectly depend on that header (for ex- std::list), it needs the debug info for all these
>
> I made CreateLimitedType keep all fields for lambdas, so their captures aren’t skipped by the isImplicit check
>
> am I missing something here or am I looking at this from the wrong angle?
I think we need some more detail - generally we try not to emit definitions of classes (implicitly, including the closure type of a lambda) if the definition isn't needed (essentially, if the code doesn't do something that would fail to compile if the class were declared but not defined, we skip the definition in the DWARF).
Most issues that could apply to lambda closure types would apply to local class types - so mostly any bug that would apply to a lambda, would apply to a local class type - so I'm suspicious of any change that's lambda specific like this one. Feels like we might not know enough about the problem yet.
Can you provide a specific example? (source code, compilation commands, platform, debugger, debugger commands, failure mode/crash/etc)
https://github.com/llvm/llvm-project/pull/149674
More information about the cfe-commits
mailing list