Since 3.8 or earlier, clang-format has been lumping all #else, #elif, etc blocks together when doing whitespace replacements and causing consecutive alignments across #else blocks.
Commit c077975 partially addressed the problem but also triggered "regressions".
This patch fixes the root cause of the problem and "reverts" c077975 (except for the unit tests).
Fixes https://github.com/llvm/llvm-project/issues/36070.
Fixes https://github.com/llvm/llvm-project/issues/55265.
Fixes https://github.com/llvm/llvm-project/issues/60721.
Fixes https://github.com/llvm/llvm-project/issues/61498.
clang-format breaks the above into two separate sets:
and:
After it finishes with the first set, the preprocessor directives are marked as Finalized. Then, while the second set is being processed, the directives should not be skipped when tokens are added to the Change set. Otherwise, we would end up with the Change set below without any "scope" context: