[cfe-dev] Notes in Clang diagnostics and LLVM DiagnosticInfo
Tobias Grosser
tobias at grosser.es
Tue Feb 25 02:29:07 PST 2014
On 02/24/2014 07:20 PM, Quentin Colombet wrote:
> Hi Tobias,
>
> Thanks for looking into this.
>
> On Feb 23, 2014, at 1:21 AM, Tobias Grosser <tobias at grosser.es> wrote:
>
>> On 02/23/2014 10:08 AM, tsett wrote:
>>> Hi Tobias,
>>> I got the problem.
>>> I use the DiagnostigBuilder::setForceEmit() for this.
>>> An instance of DiagnostigBuilder will be returned if you use the
>>> report-function.
>>
>> Good point. The following patch makes my messages appear again:
>>
>> --- a/lib/CodeGen/CodeGenAction.cpp
>> +++ b/lib/CodeGen/CodeGenAction.cpp
>> @@ -384,7 +384,9 @@ void BackendConsumer::DiagnosticHandlerImpl(const DiagnosticInfo &DI) {
>>
>> // 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.
Tobias
More information about the cfe-dev
mailing list