[PATCH] D75714: Add Optional overload to DiagnosticBuilder operator <<

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 9 08:03:17 PDT 2020


aaron.ballman added a comment.

In D75714#1912400 <https://reviews.llvm.org/D75714#1912400>, @njames93 wrote:

> In D75714#1912326 <https://reviews.llvm.org/D75714#1912326>, @lebedev.ri wrote:
>
> > What's the use case here?
>
>
> Mainly syntactic sugar, If you have a function that maybe returns a `FixItHint` or `SourceRange` you can pass it directly to the `DiagnosticBuilder`.


This comes up with a fair amount of regularity, even just for things like printing a simple integer (consider optional attribute arguments, etc). However, it seems like we might want to express this via the format string so that we don't run into a situation where an unavailable optional argument changes the indexing in the case where it's not additional information like a source range or fixit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75714





More information about the cfe-commits mailing list