r211447 - TextDiagnostic: print remark level diagnostics in bold too
Alp Toker
alp at nuanti.com
Sat Jun 21 16:31:52 PDT 2014
Author: alp
Date: Sat Jun 21 18:31:52 2014
New Revision: 211447
URL: http://llvm.org/viewvc/llvm-project?rev=211447&view=rev
Log:
TextDiagnostic: print remark level diagnostics in bold too
The purpose of bolding these is to make them visually distinct from
continuations (supplemental note diagnostics). Therefore, the bolding applies
to all severities _including_ remarks -- it's not in any way an indicator of
priority. Also simplify and comment.
No tests.
Modified:
cfe/trunk/include/clang/Frontend/TextDiagnostic.h
cfe/trunk/lib/Frontend/TextDiagnostic.cpp
Modified: cfe/trunk/include/clang/Frontend/TextDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/TextDiagnostic.h?rev=211447&r1=211446&r2=211447&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/TextDiagnostic.h (original)
+++ cfe/trunk/include/clang/Frontend/TextDiagnostic.h Sat Jun 21 18:31:52 2014
@@ -63,18 +63,16 @@ public:
/// formatting of their diagnostic messages.
///
/// \param OS Where the message is printed
- /// \param Level Used to colorizing the message
+ /// \param IsSupplemental true if this is a continuation note diagnostic
/// \param Message The text actually printed
/// \param CurrentColumn The starting column of the first line, accounting
/// for any prefix.
/// \param Columns The number of columns to use in line-wrapping, 0 disables
/// all line-wrapping.
/// \param ShowColors Enable colorizing of the message.
- static void printDiagnosticMessage(raw_ostream &OS,
- DiagnosticsEngine::Level Level,
- StringRef Message,
- unsigned CurrentColumn, unsigned Columns,
- bool ShowColors);
+ static void printDiagnosticMessage(raw_ostream &OS, bool IsSupplemental,
+ StringRef Message, unsigned CurrentColumn,
+ unsigned Columns, bool ShowColors);
protected:
void emitDiagnosticMessage(SourceLocation Loc,PresumedLoc PLoc,
Modified: cfe/trunk/lib/Frontend/TextDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnostic.cpp?rev=211447&r1=211446&r2=211447&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnostic.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp Sat Jun 21 18:31:52 2014
@@ -689,8 +689,9 @@ TextDiagnostic::emitDiagnosticMessage(So
printDiagnosticLevel(OS, Level, DiagOpts->ShowColors,
DiagOpts->CLFallbackMode);
- printDiagnosticMessage(OS, Level, Message,
- OS.tell() - StartOfLocationInfo,
+ printDiagnosticMessage(OS,
+ /*IsSupplemental*/ Level == DiagnosticsEngine::Note,
+ Message, OS.tell() - StartOfLocationInfo,
DiagOpts->MessageLength, DiagOpts->ShowColors);
}
@@ -735,24 +736,18 @@ TextDiagnostic::printDiagnosticLevel(raw
OS.resetColor();
}
-/*static*/ void
-TextDiagnostic::printDiagnosticMessage(raw_ostream &OS,
- DiagnosticsEngine::Level Level,
- StringRef Message,
- unsigned CurrentColumn, unsigned Columns,
- bool ShowColors) {
+/*static*/
+void TextDiagnostic::printDiagnosticMessage(raw_ostream &OS,
+ bool IsSupplemental,
+ StringRef Message,
+ unsigned CurrentColumn,
+ unsigned Columns, bool ShowColors) {
bool Bold = false;
- if (ShowColors) {
- // Print warnings, errors and fatal errors in bold, no color
- switch (Level) {
- case DiagnosticsEngine::Warning:
- case DiagnosticsEngine::Error:
- case DiagnosticsEngine::Fatal:
- OS.changeColor(savedColor, true);
- Bold = true;
- break;
- default: break; //don't bold notes
- }
+ if (ShowColors && !IsSupplemental) {
+ // Print primary diagnostic messages in bold and without color, to visually
+ // indicate the transition from continuation notes and other output.
+ OS.changeColor(savedColor, true);
+ Bold = true;
}
if (Columns)
More information about the cfe-commits
mailing list