[PATCH] D84362: [NFC] Add missing functions to PartialDiagnostic

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 15 13:46:34 PDT 2020


tra added a comment.

In D84362#2275029 <https://reviews.llvm.org/D84362#2275029>, @yaxunl wrote:

> 

Perhaps we could inherit `PartialDiagnostic` from `DiagnosticBuilder` base class. This would probably be the least invasive approach as it would preserve existing uses while allowing reuse of common `DiagnosticBuilder` functionality. That said, it would muddle the meaning of PartialDiagnostic even more -- is it the diagnostic itself, or a thing that produces the diagnostic?

To think of it, we actually don't need the `DiagnosticBuilderBase` per se, but rather a limited subset of operations for implementing freestanding `operator<<`.  So the base class for `DiagnosticBuilder` and `PartialDiagnostic` could be called `StreamableDiagnosticBase` and only provide those bits. This way the arrangement looks a bit less awkward. Both DiagnosticBuilder and PartialDiagnostic would inherit from it and would work with `operator<<(StreamableDiagnosticBase)`. We may need to convert  StreamableDiagnosticBase results back to the original type.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84362/new/

https://reviews.llvm.org/D84362



More information about the cfe-commits mailing list