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? > Other than that, I guess it looks good to me. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
