tra added a comment. In D84362#2274790 <https://reviews.llvm.org/D84362#2274790>, @yaxunl wrote:
> There are use patterns expecting `PartialDiagnosticInst << X << Y` to > continue to be a `PartialDiagnostic&`, e.g. > > PartialDiagnosticAt PDAt(SourceLoc, PartialDiagnosticInst << X << Y); > > However if we derive PartialDiagnostic and DiagnosticBuilder from a base > class DiagnosticBuilderBase which implements the `<<` operators, > `PartialDiagnosticInst << X << Y` will become a `DiagnosticBuilderBase&`, > then we can no longer write the above code. > > That's one reason I use templates to implement `<<` operators. > > Do we want to sacrifice this convenience? I don't think we have to. AFAICT, virtually all such patterns (and there are only 20-ish of them in total) are used with `EmitFormatDiagnostic(S.PDiag())` which could be adapted to accept `DiagnosticBuilderBase` and `Sema::PDiag()` changed to return `PartialDiagnosticBuilder` with no loss of convenience. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D84362/new/ https://reviews.llvm.org/D84362 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits