[clang-tools-extra] r341319 - [clangd] Handle errors before checking for cancelltion

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 3 07:39:35 PDT 2018


Author: ibiryukov
Date: Mon Sep  3 07:39:34 2018
New Revision: 341319

URL: http://llvm.org/viewvc/llvm-project?rev=341319&view=rev
Log:
[clangd] Handle errors before checking for cancelltion

To avoid hitting assertions in llvm::Expected destructor.

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

Modified: clang-tools-extra/trunk/clangd/ClangdServer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.cpp?rev=341319&r1=341318&r2=341319&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdServer.cpp Mon Sep  3 07:39:34 2018
@@ -191,11 +191,10 @@ TaskHandle ClangdServer::codeComplete(Pa
   auto Task = [PCHs, Pos, FS, CodeCompleteOpts,
                this](Path File, Callback<CodeCompleteResult> CB,
                      llvm::Expected<InputsAndPreamble> IP) {
-    if (isCancelled())
-      return CB(llvm::make_error<CancelledError>());
-
     if (!IP)
       return CB(IP.takeError());
+    if (isCancelled())
+      return CB(llvm::make_error<CancelledError>());
 
     auto PreambleData = IP->Preamble;
 




More information about the cfe-commits mailing list