Skip to content

Commit a6fa51f

Browse files
authored
[lld] Move handling of message separator to reportDiagnostic()
This ensures that it is also updated when calling log() and not just for errors and warnings. This was noticed in the downstream CHERI fork where a test using CHECK-NEXT was seeing empty lines after single-line log() messages. Reviewed By: MaskRay Pull Request: #117587
1 parent c9fa319 commit a6fa51f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lld/Common/ErrorHandler.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ void ErrorHandler::reportDiagnostic(StringRef location, Colors c,
219219
}
220220
os << msg << '\n';
221221
errs() << buf;
222+
// If msg contains a newline, ensure that the next diagnostic is preceded by
223+
// a blank line separator.
224+
sep = getSeparator(msg);
222225
}
223226

224227
void ErrorHandler::log(const Twine &msg) {
@@ -247,7 +250,6 @@ void ErrorHandler::warn(const Twine &msg) {
247250

248251
std::lock_guard<std::mutex> lock(mu);
249252
reportDiagnostic(getLocation(msg), Colors::MAGENTA, "warning", msg);
250-
sep = getSeparator(msg);
251253
}
252254

253255
void ErrorHandler::error(const Twine &msg) {
@@ -278,7 +280,6 @@ void ErrorHandler::error(const Twine &msg) {
278280
exit = exitEarly;
279281
}
280282

281-
sep = getSeparator(msg);
282283
++errorCount;
283284
}
284285

0 commit comments

Comments
 (0)