In D106876, we stopped serializing module map files that didn't affect compilation of the current module.
However, since each SourceLocation is simply an offset into SourceManager's global buffer of concatenated input files in, these need to be adjusted during serialization. Otherwise, they can incorrectly point after the buffer or into subsequent input file.
This patch starts adjusting SourceLocations, FileIDs and other SourceManager offsets in ASTWriter.
Can you collect a histogram for how big these vectors are? Can we avoid pointer chasing in the common case by making them SmallVector of some size during lookup?