================
@@ -3454,9 +3454,21 @@ uint64_t
ASTWriter::WriteDeclContextLexicalBlock(ASTContext &Context,
if (DC->decls_empty())
return 0;
- // In reduced BMI, we don't care the declarations in functions.
- if (GeneratingReducedBMI && DC->isFunctionOrMethod())
- return 0;
+ // In reduced BMI, we don't care the declarations in functions, unless they
+ // are templated functions, because their bodies may contain nested
class/lambda
+ // definitions that are canonicalized and need mapping of local declarations.
+ if (GeneratingReducedBMI && DC->isFunctionOrMethod()) {
----------------
ipopov wrote:
You're right about the existing test - sorry... (as Reduced BMI is C++20
modules-specific.)
But I think that the underlying deserialization bug will recur when templates
containing generic lambdas are defined in C++20 named modules (compiled with
Reduced BMI) and then imported or mixed with header modules.
I added a separate C++20 named modules test
(`modules-generic-lambda-local-mapping-bmi.cpp`) that compiles using
`-emit-reduced-module-interface`. It crashes on the assertion without the
`ASTWriter` fix, and passes with it.
LMK if this kind of mixing of C++20 modules with Clang header modules is
unrealistic. I figured since it can trigger an alert, it's worth fixing.
Thanks for having a look!
https://github.com/llvm/llvm-project/pull/202248
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits