[clang][modules] Avoid serializing all diag mappings in non-deterministic order
authorBen Langmuir <blangmuir@apple.com>
Wed, 28 Jun 2023 22:54:17 +0000 (15:54 -0700)
committerBen Langmuir <blangmuir@apple.com>
Thu, 29 Jun 2023 20:17:24 +0000 (13:17 -0700)
commit1ede7b47493f8d8548202e5f4e4a150c11e070fd
treee952a6d2ee8fe1f0ff09961ceb9b28466ac4a36a
parent92fbb602f3b635110417e40e2f774b31798b0b1d
[clang][modules] Avoid serializing all diag mappings in non-deterministic order

When writing a pcm, we serialize diagnostic mappings in order to
accurately reproduce the diagnostic environment inside any headers from
that module. However, the diagnostic state mapping table contains
entries for every diagnostic ID ever accessed, while we only want to
serialize the ones that are actually modified from their default value.
Futher, we need to serialize them in a deterministic order.

rdar://111477511

Differential Revision: https://reviews.llvm.org/D154016
clang/include/clang/Basic/DiagnosticIDs.h
clang/lib/Basic/Diagnostic.cpp
clang/lib/Basic/DiagnosticIDs.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/test/Modules/diag-mappings.c [new file with mode: 0644]