dmpolukhin wrote:

> I feel the change is somewhat odd to me. Since the description is about the 
> lambda but the change is about VarDecls. I feel there is a mismatch and I 
> feel this may not solve the underlying problem fundamentally. I feel it'll be 
> better to make it more straight forward. e.g., load the context when loading 
> the lambda (or only make it if there is captures.)

It was my initial approach to make sure that clang loads function and its 
lambdas from the same module. But I haven't found examples in clang how to make 
that canonical decls for two related things are always loaded from the same 
module. Clang starts loading function `tryTo` from `thrift_cpp2_base.h` module 
it follow links and via `declval` function specialization it discovers the 
lambda from `folly-conv.h` module that becomes canonical so by the time when it 
recursively returns to the lambda inside `thrift_cpp2_base.h` it just merged it 
to already known decl from `folly-conv.h`. I don't know how to make sure that 
deserialization won't intermix. As far as I understand code, clang solves this 
issue by merging identical decls so I implemented merging for VarDecls that 
cause this issue. But if there is a way to synchronize loading for a function 
and it's lambda, it should be more reliable but I failed to find the way. Help 
with solving this issue is very appreciated, clang seems to have other issues 
with merging lambdas too but I was not able to create small reproducers in 
other cases yet.

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

Reply via email to