-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[lld] Move handling of message separator to reportDiagnostic() #117587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lld] Move handling of message separator to reportDiagnostic() #117587
Conversation
Created using spr 1.3.6-beta.1
|
@llvm/pr-subscribers-lld-macho @llvm/pr-subscribers-lld-wasm Author: Alexander Richardson (arichardson) ChangesThis ensures that it is also updated when calling log() and not just for Full diff: https://github.com/llvm/llvm-project/pull/117587.diff 1 Files Affected:
diff --git a/lld/Common/ErrorHandler.cpp b/lld/Common/ErrorHandler.cpp
index 6b60ebb18e8212..8ba2d9fe0c9079 100644
--- a/lld/Common/ErrorHandler.cpp
+++ b/lld/Common/ErrorHandler.cpp
@@ -219,6 +219,7 @@ void ErrorHandler::reportDiagnostic(StringRef location, Colors c,
}
os << msg << '\n';
errs() << buf;
+ sep = getSeparator(msg);
}
void ErrorHandler::log(const Twine &msg) {
@@ -247,7 +248,6 @@ void ErrorHandler::warn(const Twine &msg) {
std::lock_guard<std::mutex> lock(mu);
reportDiagnostic(getLocation(msg), Colors::MAGENTA, "warning", msg);
- sep = getSeparator(msg);
}
void ErrorHandler::error(const Twine &msg) {
@@ -278,7 +278,6 @@ void ErrorHandler::error(const Twine &msg) {
exit = exitEarly;
}
- sep = getSeparator(msg);
++errorCount;
}
|
|
@llvm/pr-subscribers-lld-elf Author: Alexander Richardson (arichardson) ChangesThis ensures that it is also updated when calling log() and not just for Full diff: https://github.com/llvm/llvm-project/pull/117587.diff 1 Files Affected:
diff --git a/lld/Common/ErrorHandler.cpp b/lld/Common/ErrorHandler.cpp
index 6b60ebb18e8212..8ba2d9fe0c9079 100644
--- a/lld/Common/ErrorHandler.cpp
+++ b/lld/Common/ErrorHandler.cpp
@@ -219,6 +219,7 @@ void ErrorHandler::reportDiagnostic(StringRef location, Colors c,
}
os << msg << '\n';
errs() << buf;
+ sep = getSeparator(msg);
}
void ErrorHandler::log(const Twine &msg) {
@@ -247,7 +248,6 @@ void ErrorHandler::warn(const Twine &msg) {
std::lock_guard<std::mutex> lock(mu);
reportDiagnostic(getLocation(msg), Colors::MAGENTA, "warning", msg);
- sep = getSeparator(msg);
}
void ErrorHandler::error(const Twine &msg) {
@@ -278,7 +278,6 @@ void ErrorHandler::error(const Twine &msg) {
exit = exitEarly;
}
- sep = getSeparator(msg);
++errorCount;
}
|
| } | ||
| os << msg << '\n'; | ||
| errs() << buf; | ||
| sep = getSeparator(msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps add a comment like
if msg contains a newline, ensure that the next diagnostic is preceded by a blank line separator.
Created using spr 1.3.6-beta.1
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.