[-Wunsafe-buffer-usage] Reducing non-determinism in diagnostics output stream
The -Wunsafe-buffer-usage analysis outputs diagnostics in the order of
pointer values to associated `VarDecl`s. This creates non-determinism
in the order of diagnostics in output since the order cannot be
guaranteed in pointer values. However, our fix-it tests were written
under the assumption that diagnostics are output in source location
order. This results in non-deterministic failures in our tests. This
patch fixes the problem by keeping analysis results sorted by source
locations.
Reviewed by: jkorous, NoQ
Differential revision: https://reviews.llvm.org/
D145993