Preparing to use diagnostics about ODR hash mismatches outside of ASTReader.
Sorry for the huge amount of changes in ASTReader.cpp but most of them are indentation changes, so I hope it's not too bad. I've tried to minimize the changes unrelated to introducing ODRDiagsEmitter but if anybody has other ideas/requests, I'm totally willing to reduce the load on reviewers.
That is a good idea. I'm thinking about a different option: I make my change but keep ODRDiagsEmitter methods over-indented to preserve the old indentation. The code is moved to a different file in D128695 and I just format the entire file. This way the current change is easier to review (now and in git history) and the formatting is [eventually] correct. As for me, having good git blame is more important than having perfect formatting (proposed formatting will be still OK).
Hmm, I've tried removing the old one ASTReader::getOwningModuleNameForDiagnostic but some tests were failing. Now all the tests seem to be fine. I'll remove ASTReader::getOwningModuleNameForDiagnostic and we'll see if pre-commit tests are happy.
Sure. I see your point that ODRDiagsEmitter is stateless regarding diagnoseMismatch methods, so repeating the same construction looks excessive and verbose. But if anybody later has any reasons to change that, it should be possible as ODRDiagsEmitter construction is cheap.