[clang] Reset CodeGenOptions fields for clean module/PCH builds (PR #138256)

Ayush Pareek via cfe-commits cfe-commits at lists.llvm.org
Tue May 6 02:33:42 PDT 2025


ayushpareek2003 wrote:

> hmmm for `test case`, I mean a test case in clang, either a unit test or a lit test, so we can understand the effect on users more clearly.
> 
> And if you're talking about the general code policy, I'll suggest you to https://discourse.llvm.org/ to make it more verbose.

I've added a lit test under clang/test/Modules/reset-codegen-options.c to demonstrate that the affected fields (like MainFileName and DebugCompilationDir) are correctly reset and no longer leak into the module or PCH output.
This test helps confirm that switching from .clear() to = {} results in cleaner and more consistent output, particularly by fully resetting the fields to their default-constructed state

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


More information about the cfe-commits mailing list