[cfe-dev] Notes in Clang diagnostics and LLVM DiagnosticInfo
Tobias Grosser
tobias at grosser.es
Sun Feb 23 00:56:10 PST 2014
Hi,
I just saw the LLVM DiagnosticInfo being integrated into clang in
r200931 by Quentin and noticed interesting behaviour when using Notes.
Specifically, I was using the interface in Polly to emit informative
messages to the user (similar to icc's -vec-report). To emit this
information I used the Severity 'Note' as these are neither warnings nor
errors, just pieces of information that help the user understand what
happens.
However, when running clang I realized my notes are not emitted as
expected. I tracked it down to this piece of code:
// If the client doesn't care about this message, don't issue it.
// If this is a note and the last real diagnostic was ignored, ignore
// it too.
if (DiagLevel == DiagnosticIDs::Ignored ||
(DiagLevel == DiagnosticIDs::Note &&
Diag.LastDiagLevel == DiagnosticIDs::Ignored))
return false;
From my reading it seems the only way in which clang supports notes is
as a piece of additional information for 'real diagnostic'. Now I wonder
what is the right way to emit independent informative messages. I see
two approaches:
1) Make it possible to create first-class notes, that do not depend on
previous diagnostics and that are not ignored.
2) Introduce an additional severity level (e.g. Info) that is a first
class Diagnostic.
2) allows us to also provide 'notes' for our info-diagnostics.
E.g. something like this:
/tmp/test.c:1:6: info: Polly detected an optimizable code region
/tmp/test.c:3:9: note: End of optimizable code region
Does anybody have some ideas/opinions regarding this issue?
Cheers,
Tobias
More information about the cfe-dev
mailing list