[clang-tools-extra] aa1ac2a - [clangd] Flush stderr after signal handlers run, so we always get the full stack/crash info
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 25 16:09:17 PDT 2021
Author: Sam McCall
Date: 2021-10-26T01:08:36+02:00
New Revision: aa1ac2ae451e54dfa19dce2794800bbd034e2194
URL: https://github.com/llvm/llvm-project/commit/aa1ac2ae451e54dfa19dce2794800bbd034e2194
DIFF: https://github.com/llvm/llvm-project/commit/aa1ac2ae451e54dfa19dce2794800bbd034e2194.diff
LOG: [clangd] Flush stderr after signal handlers run, so we always get the full stack/crash info
Added:
Modified:
clang-tools-extra/clangd/tool/ClangdMain.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index 2e48bfb433f0c..4f8895b5d605c 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -681,7 +681,12 @@ int main(int argc, char *argv[]) {
llvm::InitializeAllTargetInfos();
llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
llvm::sys::AddSignalHandler(
- [](void *) { ThreadCrashReporter::runCrashHandlers(); }, nullptr);
+ [](void *) {
+ ThreadCrashReporter::runCrashHandlers();
+ // Ensure ThreadCrashReporter and PrintStackTrace output is visible.
+ llvm::errs().flush();
+ },
+ nullptr);
llvm::sys::SetInterruptFunction(&requestShutdown);
llvm::cl::SetVersionPrinter([](llvm::raw_ostream &OS) {
OS << versionString() << "\n"
More information about the cfe-commits
mailing list