[PATCH] D87816: [clang] Fix incorrect call to TextDiagnostic::printDiagnosticMessage
Andrzej Warzynski via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 17 01:10:40 PDT 2020
awarzynski created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
awarzynski requested review of this revision.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87816
Files:
clang/lib/Frontend/TextDiagnosticPrinter.cpp
Index: clang/lib/Frontend/TextDiagnosticPrinter.cpp
===================================================================
--- clang/lib/Frontend/TextDiagnosticPrinter.cpp
+++ clang/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -135,10 +135,10 @@
if (!Info.getLocation().isValid()) {
TextDiagnostic::printDiagnosticLevel(OS, Level, DiagOpts->ShowColors,
DiagOpts->CLFallbackMode);
- TextDiagnostic::printDiagnosticMessage(OS, Level, DiagMessageStream.str(),
- OS.tell() - StartOfLocationInfo,
- DiagOpts->MessageLength,
- DiagOpts->ShowColors);
+ TextDiagnostic::printDiagnosticMessage(
+ OS, /*IsSupplemental=*/Level == DiagnosticsEngine::Note,
+ DiagMessageStream.str(), OS.tell() - StartOfLocationInfo,
+ DiagOpts->MessageLength, DiagOpts->ShowColors);
OS.flush();
return;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87816.292422.patch
Type: text/x-patch
Size: 987 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200917/12d71552/attachment.bin>
More information about the cfe-commits
mailing list