ChuanqiXu9 wrote:

I think we shouldn't remove the assertion. Your test passes with the removal of 
the assertion since the initializers are not complex. So it ends quickly. But 
if it is a complex initialization which triggers more deserialization, I feel 
it will be problematic.

I think the point is in `DeclMustBeEmitted`, this should be a "pure" method but 
it triggers deserialization.

I think, the proper solution may be:
1. When we write a VarDecl, use a bit to record whether the var decl has an 
initialization with side effects.
2. When we read a var decl with the above information, let's record it in a set 
in ASTReader.
3. When we decide if a VarDecl needs to be emitted in `DeclMustBeEmitted`, 
let's lookup it in the above set.

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

Reply via email to