[clang] [Modules] Record whether VarDecl initializers contain side effects (PR #143739)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 19 18:36:35 PDT 2025


================
@@ -1442,6 +1442,10 @@ class ASTReader
     const StringRef &operator*() && = delete;
   };
 
+  /// VarDecls with initializers containing side effects must be emitted,
+  /// but DeclMustBeEmitted is not allowed to deserialize the intializer.
+  llvm::SmallPtrSet<Decl *, 16> InitSideEffectVars;
----------------
ChuanqiXu9 wrote:

I think we can erase elements from `InitSideEffectVars` if the initializer of the variable got loaded. This is helpful for memory. But given I feel it might not be significant, so if you don't want to do it right now, please leave a FIXME.

https://github.com/llvm/llvm-project/pull/143739


More information about the cfe-commits mailing list