[cfe-dev] Notes in Clang diagnostics and LLVM DiagnosticInfo

Chris Lattner clattner at apple.com
Tue Feb 25 03:26:39 PST 2014


On Feb 25, 2014, at 2:29 AM, Tobias Grosser <tobias at grosser.es> wrote:
>>>   // Report the backend message using the usual diagnostic mechanism.
>>>   FullSourceLoc Loc;
>>> -  Diags.Report(Loc, DiagID).AddString(MsgStorage);
>>> +  DiagnosticBuilder DB = Diags.Report(Loc, DiagID);
>>> +  DB.setForceEmit();
>>> +  DB.AddString(MsgStorage);
>>> 
>>> We could use this to either force printing of all backend diagnostics or only the notes. However, I am afraid that would break existing flags to suppress diagnostics.
>> Would it be hard to check what is the actual behavior?
>> That would indeed be unfortunate!
> 
> As Richard confirmed, using 'note' to provide information not attached to another warning or error is not intended. I submitted two patches
> to introduce a new 'remark' type that can be used for exactly this purpose.

How about calling these "informative" diagnostics, and use "info:" for them?  That seems more descriptive than remark.

FWIW, I agree with Richard, notes are always supposed to be the continuation of an existing diagnostic.

-Chris



More information about the cfe-dev mailing list