[cfe-commits] [Patch 4 of 7] -verify fixes and enhancement

Jordan Rose jordan_rose at apple.com
Wed Jul 11 09:51:13 PDT 2012

On Jul 10, 2012, at 10:03 PM, Andy Gibbs wrote:

> On Tuesday, July 10, 2012 11:15 PM, Jordan Rose wrote:
>> Is there any particular reason why setForceEmit() is const and IsForceEmit is
>> mutable? Diags.Report returns a mutable DiagnosticBuilder.
> I kept with the idioms in use for the rest of the class.  Using a const function with
> a mutable data member, it is possible to use setForceEmit() after using the stream
> operators as well as before, so for example, the following is also valid:
> (Diags.Report(Loc, diag) << arg).setForceEmit() << arg2;
> Which means the part in brackets could be generated by a helper function.
> As to why the DiagnosticBuilder class is designed const but mutable, I can only
> think that this may originally have been so that Emit() could only be called from
> the destructor, put Emit() is protected anyway...  Whatever, perhaps Diags.Report
> should actually be returning a const object?

Hm, okay. In that case I don't like the existing design much, but that shouldn't hold up your patch. Committed in r160053!

More information about the cfe-commits mailing list