[PATCH] D65198: [LLD] Do not print additional newlines after reaching error limit
Alexander Richardson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 24 04:05:50 PDT 2019
arichardson created this revision.
arichardson added reviewers: ruiu, grimar, MaskRay.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This could previously happen if errors that are emitted after reaching the
error limit. In that case, the flag inside the newline() function will be
set to true which causes the next call to print a newline even though the
actual message will be discarded.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D65198
Files:
lld/Common/ErrorHandler.cpp
Index: lld/Common/ErrorHandler.cpp
===================================================================
--- lld/Common/ErrorHandler.cpp
+++ lld/Common/ErrorHandler.cpp
@@ -157,12 +157,16 @@
void ErrorHandler::error(const Twine &msg) {
std::lock_guard<std::mutex> lock(mu);
- newline(errorOS, msg);
if (errorLimit == 0 || errorCount < errorLimit) {
+ newline(errorOS, msg);
printHeader("error: ", raw_ostream::RED, msg);
*errorOS << msg << "\n";
} else if (errorCount == errorLimit) {
+ // Note: even though we call newline() in both branches, we can't place it
+ // before the conditions. If we did that, we might emit a newlines (without
+ // the error message) after reaching the error limit.
+ newline(errorOS, msg);
printHeader("error: ", raw_ostream::RED, msg);
*errorOS << errorLimitExceededMsg << "\n";
if (exitEarly)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65198.211461.patch
Type: text/x-patch
Size: 879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190724/5cdb4df1/attachment.bin>
More information about the llvm-commits
mailing list