[C++20][Modules] Do not apply `getAdjustedOffset` to file-internal byte offset. (#184956)
In https://reviews.llvm.org/D137214 and
https://reviews.llvm.org/D136624, offset adjustment logic was added to
account for the non-affecting module map files that are removed. While
the adjustment logic applies to global source location offsets, they do
not apply to file-internal offsets (relative within the file).
In `ASTWriter::WritePragmaDiagnosticMappings`, the adjustment is applied
to `StatePoint.Offset`s in `StateTransitions`. However, these offsets
are file-internal offsets, not global source location offsets. As such,
applying adjustment to these offsets result in incorrect diagnostic
behavior from the module.
Specifically, wrapping a piece of code in `pragma clang diagnostic
push/pop`, inside of a module is not applied correctly. A new test case
`diag-pragma-nonaffecting.cpp` was added to verify the broken behavior
as well as the corrected behavior with this commit.
Assisted-by: Claude Opus 4.6