[PATCH] Allow overriding flag names in diagnostics.

Diego Novillo dnovillo at google.com
Mon Apr 21 16:26:37 PDT 2014


On Mon, Apr 21, 2014 at 7:20 PM, Alp Toker <alp at nuanti.com> wrote:

>
>> @@ -1084,15 +1100,22 @@
>>     return DB;
>>   }
>>   -inline DiagnosticBuilder DiagnosticsEngine::Report(SourceLocation Loc,
>> -                                                   unsigned DiagID) {
>> +inline DiagnosticBuilder
>> +DiagnosticsEngine::Report(SourceLocation Loc, unsigned DiagID,
>> StringRef Val) {
>>     assert(CurDiagID == ~0U && "Multiple diagnostics in flight at once!");
>>     CurDiagLoc = Loc;
>>     CurDiagID = DiagID;
>> +  FlagNameValue = Val.str();
>>     return DiagnosticBuilder(this);
>>   }
>>
>
> Did you consider adding a DiagnosticBuilder function to append a
> FlagNameValue instead of all this?
>
> That would reduce the impact of your patch and improve readability in the
> callers. Something like:
>
>   Diag(Loc, ID).extendFlag("=mypass") << D;
>

Yeah, briefly. But it seemed to involve more typing, so I had a slight
preference over the shorter version. It would also mean resetting the flag
name after each call.

I'm not really opposed to the idea, though. I just found the current
version easier to use.


Diego.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140421/34cf99d3/attachment.html>


More information about the cfe-commits mailing list