Skip to content

Commit 4eae6fc

Browse files
committed
[clang] Fix incorrect call to TextDiagnostic::printDiagnosticMessage
As per the documentation, the 2nd argument in printDiagnosticMessage should be a bool that specifies whether the underlying message is a continuation note diagnostic or not. More specifically, it should be: ``` Level == DiagnosticsEngine::Note ``` instead of: ``` Level ``` This change means that `no input file` in the following scenario will be now correctly printed in bold: ``` $ bin/clang clang: error: no input files ``` In terminals that don't support text formatting the behaviour doesn't change. Differential Revision: https://reviews.llvm.org/D87816
1 parent 349af80 commit 4eae6fc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/lib/Frontend/TextDiagnosticPrinter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ void TextDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
135135
if (!Info.getLocation().isValid()) {
136136
TextDiagnostic::printDiagnosticLevel(OS, Level, DiagOpts->ShowColors,
137137
DiagOpts->CLFallbackMode);
138-
TextDiagnostic::printDiagnosticMessage(OS, Level, DiagMessageStream.str(),
139-
OS.tell() - StartOfLocationInfo,
140-
DiagOpts->MessageLength,
141-
DiagOpts->ShowColors);
138+
TextDiagnostic::printDiagnosticMessage(
139+
OS, /*IsSupplemental=*/Level == DiagnosticsEngine::Note,
140+
DiagMessageStream.str(), OS.tell() - StartOfLocationInfo,
141+
DiagOpts->MessageLength, DiagOpts->ShowColors);
142142
OS.flush();
143143
return;
144144
}

0 commit comments

Comments
 (0)