This builds a little on @ikudrin's diff D50560 which was a much improved version of D47540. I have attempted to take into account the comments on those diffs.
Adds diagnostic output functions to enable Visual Studio
compatibility with the flag --vs-diagnostics. Clang has a
flag which enables similar support, see
"-fdiagnostics-format=clang/msvc/vi" described
in https://clang.llvm.org/docs/UsersManual.html.
The existing diagnostics output format for warning and error messages is
not fully compatible with Visual Studio (VS) and can even cause VS to become
unresponsive.
The format accepted by VS
(https://msdn.microsoft.com/en-us/library/yxkt8b26.aspx):
{filename (line# [, column#]) | toolname} : [any text] {error | warning}
code####:localizable string [ any text ]
or more simply:
Origin : {warning|error} code#### : Message
The current default lld format uses the lld executable path for Origin.
Clicking the message inside VS will lead to a hang or long delay as VS
attempts to access the executable as a source code origin. Additionally, the
line and column information accepted by VS differs from the lld format.
Could you please use clang-format on the whole patch? (only changed lines)