When merging lambdas, keep track of the capture lists from each version.
authorRichard Smith <richard@metafoo.co.uk>
Wed, 7 Dec 2022 23:20:49 +0000 (15:20 -0800)
committerRichard Smith <richard@metafoo.co.uk>
Thu, 8 Dec 2022 19:37:00 +0000 (11:37 -0800)
commit4a1ccfe8a3cfd4569bc962a38b6117a9a2b8ad21
treef803cf5297ef4aee5b0fe11c513516aacf787e5a
parentdd74e6b6f4fb7a4685086a4895c1934e043f875b
When merging lambdas, keep track of the capture lists from each version.

Different versions of a lambda will in general refer to different
enclosing variable declarations, because we do not merge most
block-scope declarations, such as local variables. Keep track of all the
declarations that correspond to a lambda's capture fields so that we can
rewrite the name of any of those variables to the lambda capture,
regardless of which copy of the body of `operator()` we look at.
clang/include/clang/AST/DeclCXX.h
clang/lib/AST/DeclCXX.cpp
clang/lib/AST/ExprCXX.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/test/Modules/lambda-merge.cpp [new file with mode: 0644]