[clang] [clang-tools-extra] [clang][modules] Serialize `CodeGenOptions` (PR #146422)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 1 12:58:23 PDT 2025


================
@@ -1181,8 +1183,9 @@ class Preprocessor {
 
 public:
   Preprocessor(const PreprocessorOptions &PPOpts, DiagnosticsEngine &diags,
-               const LangOptions &LangOpts, SourceManager &SM,
-               HeaderSearch &Headers, ModuleLoader &TheModuleLoader,
+               const LangOptions &LangOpts, const CodeGenOptions &CGOPts,
----------------
jansvoboda11 wrote:

Hmm, my thinking was that since the predefines buffer is initialized with `CodeGenOptions`, attaching them to `Preprocessor` isn't _that_ weird. And since `Preprocessor` already depends on `TargetInfo` that exposes `TargetOptions` there already is some precedent for weird layering. The original reason was (2) and (3), and with those (1) made sense.

I implemented your suggestion in the newest commit. Let me know what you think.

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


More information about the cfe-commits mailing list