[clang-tools-extra] 4e3a44d - [clangd] Disable new errs()-tie behavior, it's racy.

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 10 07:11:27 PDT 2020


Author: Sam McCall
Date: 2020-06-10T16:08:37+02:00
New Revision: 4e3a44d42eace1924c9cba3b7c1ea9cdbbd6cb48

URL: https://github.com/llvm/llvm-project/commit/4e3a44d42eace1924c9cba3b7c1ea9cdbbd6cb48
DIFF: https://github.com/llvm/llvm-project/commit/4e3a44d42eace1924c9cba3b7c1ea9cdbbd6cb48.diff

LOG: [clangd] Disable new errs()-tie behavior, it's racy.

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D81538

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 c43f125d50d7..331dd1121d17 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -585,6 +585,8 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
   // Use buffered stream to stderr (we still flush each log message). Unbuffered
   // stream can cause significant (non-deterministic) latency for the logger.
   llvm::errs().SetBuffered();
+  // Don't flush stdout when logging, this would be both slow and racy!
+  llvm::errs().tie(nullptr);
   StreamLogger Logger(llvm::errs(), LogLevel);
   LoggingSession LoggingSession(Logger);
   // Write some initial logs before we start doing any real work.


        


More information about the cfe-commits mailing list