During a highly parallel build with -fimplicit-modules, multiple translation units may generate a PCM file for the same module at the same filesystem path in a short sequence.
When the first Clang instance tries to verify signature of the module on import, it discovers the new version of the PCM file (produced by latter Clang instance) that may have a different signature, leading to a mismatch and failed build.
To be able to debug such mismatch, it's invaluable to be able to compare the latter PCM (on disk) with the first one (overwritten).
This patch adds new -cc1 option -fbackup-module that tells Clang to store each PCM to the normal location and also to a path with an unique suffix (the PID of the Clang instance).
This is mostly additional change, but PCHContainerGenerator now doesn't unconditionally destroy the given PCHBuffer anymore and instead just decreases its reference count.