[clang-tools-extra] r365606 - [clangd] Consume error to avoid assertion failures

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 10 02:18:09 PDT 2019


Author: ibiryukov
Date: Wed Jul 10 02:18:09 2019
New Revision: 365606

URL: http://llvm.org/viewvc/llvm-project?rev=365606&view=rev
Log:
[clangd] Consume error to avoid assertion failures

When we fail to calculate #include insertion for a completion item.
Note that this change does not add a test, although that would be good.

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

Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=365606&r1=365605&r2=365606&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original)
+++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Wed Jul 10 02:18:09 2019
@@ -346,8 +346,9 @@ struct CodeCompletionBuilder {
         Completion.Includes.push_back(std::move(Include));
       } else
         log("Failed to generate include insertion edits for adding header "
-            "(FileURI='{0}', IncludeHeader='{1}') into {2}",
-            C.IndexResult->CanonicalDeclaration.FileURI, Inc, FileName);
+            "(FileURI='{0}', IncludeHeader='{1}') into {2}: {3}",
+            C.IndexResult->CanonicalDeclaration.FileURI, Inc, FileName,
+            ToInclude.takeError());
     }
     // Prefer includes that do not need edits (i.e. already exist).
     std::stable_partition(Completion.Includes.begin(),




More information about the cfe-commits mailing list