[clang-tools-extra] 31a8f84 - [clangd] Fix crash with sanitizers if blocking with no timeout

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 22 02:57:57 PDT 2023


Author: Sam McCall
Date: 2023-08-22T11:57:42+02:00
New Revision: 31a8f840f327694a6c74dac15702eeb85281c1e2

URL: https://github.com/llvm/llvm-project/commit/31a8f840f327694a6c74dac15702eeb85281c1e2
DIFF: https://github.com/llvm/llvm-project/commit/31a8f840f327694a6c74dac15702eeb85281c1e2.diff

LOG: [clangd] Fix crash with sanitizers if blocking with no timeout

Added: 
    

Modified: 
    clang-tools-extra/clangd/ClangdServer.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp
index d44d1e272b9b77..6610961b2202d1 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -1117,7 +1117,8 @@ ClangdServer::blockUntilIdleForTest(std::optional<double> TimeoutSeconds) {
 #if defined(__has_feature) &&                                                  \
     (__has_feature(address_sanitizer) || __has_feature(hwaddress_sanitizer) || \
      __has_feature(memory_sanitizer) || __has_feature(thread_sanitizer))
-  (*TimeoutSeconds) *= 10;
+  if (TimeoutSeconds.has_value())
+    (*TimeoutSeconds) *= 10;
 #endif
 
   // Nothing else can schedule work on TUScheduler, because it's not threadsafe


        


More information about the cfe-commits mailing list