This clang::DiagnosticConsumer can take normal clang diagnostics (eg., Sema errors or Clang-Tidy warnings) and turn them into static analyzer's PathDiagnostics which are then fed into PathDiagnosticConsumers. It's an essential component for my clang-tidy/static analyzer cross-integration efforts.
The consumer isn't magically aware of information that isn't present in Clang diagnostics but expected in path diagnostics. Such info includes checker name / bug type / category; the consumer expects an external provider to provide such information for every incoming diagnostic.
Additionally, PathDiagnostic's declaration-with-issue and uniqueing-declaration are currently set to nullptr. I'm slowly thinking about auto-detecting those based on the source location but technically all path diagnostic consumer facilities can function just fine without them (declaration-with-issue is there purely for displaying user-visible names and uniqueing declaration only makes sense for path-sensitive warnings that require exotic uniqueing which will probably never be fed into this consumer).
There are also a few features missing here and there, such as fix-it hint support, which i plan to add later.
Though technically possible, this consumer is never supposed to consume the output of TextPathDiagnosticConsumer; a lot of information is lost that way that can't be recovered. In particular, the proper way to teach clang-tidy to emit path diagnostics while keeping in mind that it already ships with static analyzer integration is to allow the integrated static analyzer to talk to path diagnostic consumers directly; static analyzer warnings should never go through this new consumer.
I think that this class (or file?) needs to have some comments on how it is supposed to be used.