On Wed, 2024-10-30 at 12:22 +0000, Jonathan Wakely wrote:
> On 29/10/24 19:19 -0400, David Malcolm wrote:
> > This patch generalizes diagnostic_context so that rather than
> > having
> > a single output format, it has a vector of zero or more.
> 
> [snip]
> 
> > +/* Class for parsing the arguments of -fdiagnostics-add-output=
> > and
> > +   -fdiagnostics-set-output=, and making diagnostic_output_format
> > +   instances (or issuing errors).  */
> > +
> > +class output_factory
> > +{
> > +public:
> > +  class handler
> > +  {
> > +  public:
> > +    handler (std::string name) : m_name (name) {}
> 
> How long are these names?
> 
> If they don't fit in 15 chars, then this should be std::move(name).
> 
> So for a name like "sarif:version=2.1" it should be moved, otherwise
> you make a deep copy and reallocate a new string.

These are the names of the output schemes, which currently are just
"text" and "sarif" [1], well under 15 chars - but there might be other
schemes with longer names in the future [2] so I can use std::move here
(and reinforce the habit of doing it).

Dave

[1] see
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html#index-fdiagnostics-add-output

[2] I'm playing with "experimental-html" which is 17 chars

Reply via email to