[clang] [clang-tools-extra] [clang][Serialization] Serialize DiagStateOnPushStack to fix pragma d… (PR #190420)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 9 19:14:05 PDT 2026


brandonxin wrote:

@ChuanqiXu9  I want to clarify that these are not the same kind of issue, and this patch is not a workaround:

- This patch fixes a serialization gap: `DiagStateOnPushStack` was simply never serialized in PCH, unlike all other pragma stacks (e.g. `AlignPackStack` is already serialized via `WritePackPragmaOptions`). This is completing missing serialization, not working around anything.
- The `#pragma pack` issue that @ArcsinX raised has a completely different root cause. The pack stack IS correctly serialized and `#pragma pack(pop)` works fine in the main file. The spurious warning comes from `DiagnoseUnterminatedPragmaAlignPack()` running at end of preamble compilation, which doesn't know it's compiling a partial file. That would need a different fix (e.g. suppressing that diagnostic during preamble generation).                                                                                                                        

These are two distinct bugs with different root causes requiring different fixes. A "general mechanism" isn't applicable here because the mechanisms are already different.

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


More information about the cfe-commits mailing list