summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/Frontend/TextDiagnostic.h10
-rw-r--r--clang/lib/Frontend/TextDiagnostic.cpp33
2 files changed, 18 insertions, 25 deletions
diff --git a/clang/include/clang/Frontend/TextDiagnostic.h b/clang/include/clang/Frontend/TextDiagnostic.h
index 2aa95760fd3..a76c2bb9844 100644
--- a/clang/include/clang/Frontend/TextDiagnostic.h
+++ b/clang/include/clang/Frontend/TextDiagnostic.h
@@ -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,
diff --git a/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp
index 7d39c74cea5..840c280b518 100644
--- a/clang/lib/Frontend/TextDiagnostic.cpp
+++ b/clang/lib/Frontend/TextDiagnostic.cpp
@@ -689,8 +689,9 @@ TextDiagnostic::emitDiagnosticMessage(SourceLocation Loc,
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_ostream &OS,
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)
OpenPOWER on IntegriCloud